MATLAB Answers

0

Help with my code please!

Asked by Portgas Ace on 30 Sep 2014
I attached images from one literature i read and what is written there is what i want to do. Can you guys help me correct my code? Because i can't make it work. :(
gray_no_OD=im2double(ODRemove);
r=gray_no_OD(:,:,1);
g=gray_no_OD(:,:,2);
b=gray_no_OD(:,:,3);
I=(r+g+b)/3;
MaxI = max(I(:));
MinI = min(I(:));
%subplot(1,2,2); imshow(gray_no_OD)
bs_r=50; %Row value for block segmentation
bs_c=55; %colume value for block (84*84)
[r, c]=size(gray_no_OD)
kk=0;
q=0;
w=0;
store_orig_image = gray_no_OD;
% Dividing the Cover image into bs_r x bs_c Blocks
for i=1:(r/bs_r)
for j=1:(c/bs_c)
feature(:,:,kk+j)=(gray_no_OD((bs_r*(i-1)+1:bs_r*(i-1)+bs_r),(bs_c*(j-1)+1:bs_c*(j-1)+bs_c)));
mean_block = mean2(feature(:,:,kk+j));
std_block = std2(feature(:,:,kk+j));
%===============Sigmoid function================
for m=1:bs_r
for n=1:bs_c
sigm = inv(1+ exp((mean_block-feature(m,n,kk+j))/std_block));
gray_no_OD(m+q,n+w) = 255*((sigm-MinI)/(MaxI-MinI));
end
end
%===============================================
w = w+55;
end
m= m+50;
kk=kk+(r/bs_c);
end

  0 Comments

Sign in to comment.

0 Answers