Unrecognized function or variable 'delta'.

%function fn = retrieve(X,irow,icol);
watermark = imread('watermark.jpg');
watermark=imresize(watermark,[32 32]);
watermarked_img = imread('watermarked_img.jpg');
[irow icol dim] = size(watermark);
watermark=rgb2gray(watermark);
watermark=im2bw(watermark,0.5);
w = reshape(watermark,irow*icol,1);
X=[];
rng(1,'twister');
for i=1:size(w,1)
for j=1:7
r_range=[5 507];
x=randi(r_range,1,1);
y=randi(r_range,1,1);
temp=[];
a=delta(watermarked_img,x,y);
temp=[double(a)];
for j=-2:2
if(j~=0)
temp=[temp ; double(delta(watermarked_img,x+j,y))];
end
end
for j=-2:2
if(j~=0)
temp=[temp ; double(delta(watermarked_img,x,y-j))];
end
end
X=[X double(temp)];
end
end
%%%%%%%%%%%%%%%%%%%%%%
global net
out=net(X);
%count1=0;
for i=1:size(out,2)
if(out(i)>0)
out(i)=1;
%count1=count1+1;
else
out(i)=0;
end
end
j=0;
out2=[];
'bbbbbbbbbbbb'
size(out,2)
for i=[1:7:size(out,2)]
j=j+1;
t=[out(i) out(i+1) out(i+2) out(i+3) out(i+4) out(i+5) out(i+6)];
out2(j)=mode(t);
end
irow
icol
size(out2,2);
w = reshape(out2,irow,icol);
[w map]=gray2ind(w,255);
imwrite(uint8(w), 'retrieve.jpg');
I = imread('retrieve.jpg');
imshow(I)
accuracy();
% T = imread('watermark.jpg');
% imshow(T)
%

댓글 수: 3

madhan ravi
madhan ravi 2023년 11월 18일
There’s no such function as delta(). You should define your own.
Dear madhan ravi thanx for your response
kindly, how to define this function ??
Dyuman Joshi
Dyuman Joshi 2023년 11월 18일
We can't tell you that because we do not have any information as to what the code is supposed to do or what you want to do.
In case you are asking how to define a function, refer to this - function

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

답변 (1개)

Ayush
Ayush 2024년 1월 1일

1 개 추천

I understand that you are getting unrecognized function of variable error. The error you are encountering is due to the use of delta, which is not defined as a function in the MATLAB code you have provided. It appears that delta is meant to be a custom function that you are using to process the image at specific pixel coordinates (x,y). You need to define this function or replace it with the correct MATLAB function that performs the intended operation.
Here is how you can define your own custom functions in MATLAB: https://www.mathworks.com/help/matlab/ref/function.html
Thanks,
Ayush

카테고리

도움말 센터File Exchange에서 Function Creation에 대해 자세히 알아보기

질문:

2023년 11월 18일

답변:

2024년 1월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by