I am using this code under a push button to browse and save the path for a image under handles.myimage for further use in another push button.
if truefunction pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (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';'*.bmp'},'File Selector');handles.myImage = strcat(pathname, filename);%axes(handles.axes1);
imshow(handles.myImage)set(handles.edit1,'string',handles.myImage); % save the updated handles object
guidata(hObject,handles);end
So now the complete path of the image is in handles.myImage. i want to use this path as the input of 'imread' function for this code block
if true function pushbutton9_Callback(hObject, eventdata, handles)% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) clear allclcFDetect = vision.CascadeObjectDetector;O = get(handles.edit1,'string');I = imread('C:\Users\Abhijeet\Desktop\PROJECT\Code\Images\img4.jpg');BB = step(FDetect,I);figure,imshow(I); hold onfor i = 1:size(BB,1) rectangle('Position',BB(i,:),'LineWidth',5,'LineStyle','-','EdgeColor','r');
Please help me out. Any links to the required answer or suggestion are appreciated. Thanks in advance !
Best Answer