2

我有 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 尺寸的标准化图像?

4

1 回答 1

7

试试这个:

  x = double(Image_green);  
  m = mean(x(:));  
  s = std(x(:));
  x = (x - m) / s;   % normalization of green channel
于 2012-11-14T14:46:01.127 回答