What is the problem with my code? please help me
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Rik
il 24 Set 2019
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?
Risposte (1)
Guillaume
il 24 Set 2019
Modificato: Guillaume
il 24 Set 2019
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.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!