0
내가 GUI를 MATLAB에서 GUI를 설계 연습하고 싶습니다,이 GUI는 두 가지 기능을 가지고 있습니다 - 하나의 이미지를 선택하고 필터링을위한 일반적인 구조는 그래픽 인터페이스는 매우 간단합니다
이미지를 선택하고 필터링을위한 GUI를 만들려면
여기 필터 화상
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);
을 클릭 한 후 단순 평균 필터를 이용하여 이미지를 필터링 선택 이미지 및 제 눌러 후
012 필터링하기위한 이미지를 선택 개의 코드 온이고 내가 코드를 실행하면 3,516,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
왜 이런 오류
다음있어이 파일을 간단한 선택? 미리 감사드립니다
'image'가있다 Matlab의 함수 이름이므로 변수 이미지의 이름을 지정한 이후에 충돌이 발생할 수 있습니다. 해당 변수의 이름을 변경해보십시오 –
두 번째 함수에서 첫 번째 함수에서 변수에 액세스 할 수없는 한 가지 문제가 있습니다. 변수 범위가 위반됨을 의미하므로 전역 변수로 선언해야합니까? –
나는 해결했고 내 코드를 올릴 것이다. –