What is the problem with my code? please help me

조회 수: 1 (최근 30일)
SUBROTO KUNDU
SUBROTO KUNDU 2019년 9월 24일
편집: Guillaume 2019년 9월 24일
function main()
clc
clear close all
global bimg m n k block varr;
m=1; n=0; k=1; block=0;
bimg=imread('p.tif');
varr=zeros(1,1024);
img=imread('pep.tif');
lab=rgb2lab(img);
l=lab(:,:,1);
a=lab(:,:,2);
b=lab(:,:,3);
img_block=blockproc(b,[16,16], @embedding, 'BorderSize', [1,1], 'Trimborder', true);
w_lab=cat(l,a,img_block);
w_img=lab2rgb(w_lab);
subplot(1,2,1); imshow(img); title('Original Image');
subplot(1,2,2); imshow(w_img); title('Watermarked Image');
imwrite(im2unit8(w_img), 'wimage.png');
save('emb.mat', 'varr');
psnr_val=psnr(img, im2unit8(w_img));
end
function [inv_randon]=embedding(block_struct)
data=block_struct.data;
theta=0:179;
randon_trans=randon(data, theta);
portion=randon_trans(5:6, 5:6);
[V,J]=jordan(portion);
global bimg m n k block varr;
block=block+1;
q=3;
det=25;
vmax=max(V(:));
bmodq=mod(block,q);
Q=(bmodq/(vmax*del))+(vamx*del);
q=1;
p=1;
for i=1:4
n=n+1;
if n==33
m=m+1;
n=1;
end
if q==3
q=1;
p=2;
end
if bimg(m,n)==1
V(p,q)=V(p,q)+Q;
else
V(p,q)=V(p,q)+bmodq;
end
varr(1,k)=V(p,q);
k=k+1;
q=q+1;
end
inv_jor=real(V*J/V);
randon_trans(5:6, 5:6)=inv_jor;
output_size=max(size(data));
inv_randon=irandon(randon_trans, theta, output_size);
end
  댓글 수: 2
Rik
Rik 2019년 9월 24일
Apart from the use of clc, clear, close all, and the use of global variables I don't immediately see the source of the problem. What line gives an error and what is the full error text?
SUBROTO KUNDU
SUBROTO KUNDU 2019년 9월 24일
편집: the cyclist 2019년 9월 24일
Function BLOCKPROC encountered an error
while evaluating the user supplied
function handle, FUN.
The cause of the error was:
Undefined function 'randon' for input
arguments of type 'double'.
Error in testing>embedding (line 52)
randon_trans=randon(data, theta);
Error in blockprocFunDispatcher (line
13)
output_block =
fun(block_struct);
Error in blockprocInMemory (line 80)
[ul_output fun_nargout] =
blockprocFunDispatcher(fun,block_struct,...
Error in blockproc (line 236)
result_image =
blockprocInMemory(source,fun,options);
Error in testing (line 21)
img_block=blockproc(b,[16,16],
@embedding, 'BorderSize', [1,1],
'Trimborder', true);

댓글을 달려면 로그인하십시오.

답변 (1개)

Guillaume
Guillaume 2019년 9월 24일
편집: Guillaume 2019년 9월 24일
Isn't the error message clear enough?
Undefined function 'randon' ...
Indeed, I'm not aware of a randon function in matlab. Maybe you've written you own function, in which case it must be on the path, but most likely you meant to call the radon (with only one n) function.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by