Reputation: 329
I have RGB image of size (2048X3072X3) with uint8 class and I want to normalize the Green and Red channel of the RGB image. I wrote following code:
Image_rgb=imread('RGB.jpg'); %Reading RGB image
Image_red = Image_rgb(:,:,1); %Reading R channel of image
Image_green = Image_rgb(:,:,2); %Reading G channel of image
x = double(Image_green(:));
m = mean(x);
s = std(x);
x = (x - m) / s; % normalization of green channel
But after normalization the image x is of dimension 6291456x1 rather then 2048X3072.
Can anybody please tell me how can I get normalize image with 2048X3072 dimension?
Upvotes: 2
Views: 5181
Reputation: 1415
Try this:
x = double(Image_green);
m = mean(x(:));
s = std(x(:));
x = (x - m) / s; % normalization of green channel
Upvotes: 7