【问题标题】:rgb2gray returns a blank white image, whereas image(I) returns the image correctlyrgb2gray 返回一个空白的白色图像,而 image(I) 正确返回图像
【发布时间】:2012-01-03 22:52:58
【问题描述】:

这是我的代码:

I = imread(fullfile(vl_root,'data','cup1.jpg')) ;
%returns a picture of a cup
image(I)
colormap gray;
%returns a white blank picture
image(rgb2gray(I))

奇怪的是,下面的代码对我有用:

    I = getsnapshot(vid);
 %returns a picture of a snapshot
    image(I)
    colormap gray;
    %returns a black and white  picture
    image(rgb2gray(I))

据此,我只能假设这两种图像类型之间存在某种差异,但我似乎无法确定原因。他们都是

有什么想法吗?

【问题讨论】:

    标签: image-processing matlab


    【解决方案1】:

    我运行您的代码,显然“颜色图灰色”创建了一个尺寸为 64x3 的颜色图,这对于 8 位灰度图像来说是不够的,这反过来又会使颜色看起来被截断。 我用过

            colormap([linspace(0,1,255)' linspace(0,1,255)' linspace(0,1,255)'])
    

    效果很好。

    我没有摄像头,所以我无法验证第二部分,但也许摄像头图像是低强度的?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-28
      • 2012-10-08
      • 1970-01-01
      • 1970-01-01
      • 2014-03-27
      • 2012-06-03
      • 1970-01-01
      • 2011-02-26
      相关资源
      最近更新 更多