图像标准化

时间:2012-11-14 14:42:09

标签: matlab image-processing

我有uint8类的大小(2048X3072X3)的RGB图像,我想要标准化RGB图像的绿色和红色通道。我写了以下代码:

      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

但归一化后,图像x的尺寸为6291456x1,而不是2048X3072。

有人可以告诉我如何才能获得2048X3072尺寸的标准化图像?

1 个答案:

答案 0 :(得分:7)

试试这个:

  x = double(Image_green);  
  m = mean(x(:));  
  s = std(x(:));
  x = (x - m) / s;   % normalization of green channel