0

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

是吗?

4

0 回答 0