rgb2hsv出错

时间:2013-03-16 18:05:03

标签: matlab matlab-guide

rgb2hsv函数为某些图像提供了错误,但在下面显示的代码中为其他图像提供了良好的结果。

    [fname path] = uigetfile('*.*','open image file');%*.*
    %dn=path;
    [path,name,ext,ver] = fileparts(fname);
    handles.fname = strcat(name,ext);
    [handles.queryx, handles.querymap] = imread(fname);
    figure
    imshow(handles.queryx, handles.querymap); %This displays the image.
    question_Callback(hObject, eventdata, handles)
    % Obtain HSV format of the image...
    handles.queryhsv = rgb2hsv(handles.querymap);
    guidata(hObject,handles)

如果我为石头雕塑运行此图像会导致错误

    ??? Attempted to access r(:,2); index out of bounds because size(r)=[0,0,1].

    Error in ==> rgb2hsv at 74
         g = r(:,2); b = r(:,3); r = r(:,1);

    Error in ==> CBIR_MJP>insert_Callback at 101
    handles.queryhsv = rgb2hsv(handles.querymap);

    Error in ==> gui_mainfcn at 96
         feval(varargin{:});

    Error in ==> CBIR_MJP at 42
         gui_mainfcn(gui_State, varargin{:});

    Error in ==>
   @(hObject,eventdata)CBIR_MJP('insert_Callback',hObject,eventdata,guidata(hObject))


     ??? Error while evaluating uicontrol Callback

是吗?

0 个答案:

没有答案