2012-11-14 73 views
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尺寸的標準化圖像?

回答

7

試試這個:

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

太好了!你能舉出這個答案嗎? – dustincarr