Info

此问题已关闭。 请重新打开它进行编辑或回答。

Hi everyone, I am trying to find a code for my problem.ie, I want to hide bits in an image by shifting two highest peaks in the histogram.here is my program but it wont work.I am not much familiar with MATLAB. can anybody please help me?

1 次查看(过去 30 天)
I = imread('image.jpg'); message = 'hi I am ATHIRA' message = strtrim(message); m = length(message) * 8; AsciiCode = uint8(message) binarystring = transpose(dec2bin(AsciiCode,8)) binarystring = binarystring(:); N = length(binarystring); b = zeros(N,1); for k = 1:N if(binarystring(k) == '1') b(k) = 1; else b(k) = 0; end end c=rgb2gray(I); Ih1=imhist(c,256); [h,bin]=imhist(c); x=h [p a]=max(x(:)) x(a,1)=0; [p1 a1]=max(x(:)) ir=max(a,a1) is=min(a,a1) s = c; height = size(c,1); width = size(c,2); for i = 1 : height for j = 1 : width if (c(i,j) < is) s(i,j) = (c(i,j)-1); elseif (c(i,j) == is) if(b(k)==1) s(i,j) = (c(i,j)-1); else s(i,j)=c(i,j); end elseif(is < c(i,j) < ir ) s(i,j) = c(i,j) ; elseif(c(i,j)==ir) if(b(k)==1) s(i,j)=(c(i,j)+1); else s(i,j)=c(i,j); end
elseif(c(i,j)>ir)
s(i,j)= (c(i,j)+1);
end
end
end

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by