Reputation: 210
So I have an image img.jpg I read the image with
Im = imread('img.jpg');
I = im2double(Im);
I got separate channels from it
R = I(:,:,1);
G = I(:,:,2);
B = I(:,:,3);
I calculated the sum like this
S = R+G+B;
Now when I divide the blue channel with S
NV = B/S;
B = NV;
I get a weird image back with
imshow(B);
What's wrong with the code?
Upvotes: 1
Views: 3126
Reputation: 7919
if S is a matrix, you need to use element-wise division:
NV = B/S;
should be
NV = B./S;
Upvotes: 3