0

私は matlab で GUI の設計を練習したいと思います。この GUI には 2 つの機能があります。
ここに画像の説明を入力

ここに2つのコードがあります.1つは選択画像を押した後に画像を選択し、2つ目はフィルター画像をクリックした後に単純な平均フィルターを使用して画像をフィルタリングします

function select_image_Callback(hObject, eventdata, handles)
% hObject    handle to select_image (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[filename, pathname] = uigetfile({'*.jpg';'*.png'},'File select');
image=strcat(pathname,filename);
axes(handles.axes1);
imshow(image);

およびフィルタリング用

function filter_image_Callback(hObject, eventdata, handles)
% hObject    handle to filter_image (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
h = ones(5,5) / 25;
Filtered_image = imfilter(image,h);
axes(handles.axes2);
imshow(Filtered_image);

しかし、コードを実行すると、単純なこのファイルを選択しました

ここに画像の説明を入力

次のエラーが発生しました

Error using imfilter
Expected input number 1, A, to be one of these types:

numeric, logical

Instead its type was matlab.graphics.primitive.Image.

Error in imfilter>parse_inputs (line 186)
validateattributes(a,{'numeric' 'logical'},{'nonsparse'},mfilename,'A',1);

Error in imfilter (line 118)
[a, h, boundary, sameSize, convMode] = parse_inputs(varargin{:});

Error in filter_image_filter_image_Callback (line 92)
Filtered_image = imfilter(image,h);

Error in gui_mainfcn (line 95)
        feval(varargin{:});

Error in filter_image (line 42)
    gui_mainfcn(gui_State, varargin{:});

Error in @(hObject,eventdata)filter_image('filter_image_Callback',hObject,eventdata,guidata(hObject))


Error while evaluating UIControl Callback

なぜこれが起こるのですか?前もって感謝します

4

1 に答える 1