表示されている画像から矩形座標を取得したいと思います。画像を前後に移動したいここに私のmatlabのGUIがあります。
正しいMatlab GUIを止めないでください。
だから私が次を押すと、次の画像が直列に表示され、同様の戻るボタンが表示されます。私は
function next_Callback(hObject, eventdata, handles)
% hObject handle to next (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if handles.mypointer~=length(handles.cur_images)
handles.mypointer=handles.mypointer+1;
pic=imread(fullfile('images',handles.cur_images(handles.mypointer).name));
handles.imageName=handles.cur_images(handles.mypointer).name;
imshow(pic);
h=imrect;
getMyPos(getPosition(h));
addNewPositionCallback(h,@(p) getMyPos(p));
fcn = makeConstrainToRectFcn('imrect',get(gca,'XLim'),get(gca,'YLim'));
setPositionConstraintFcn(h,fcn);
handles.output = hObject;
handles.posi=getPosition(h);
guidata(hObject, handles);
このコードを使用しています。しかし、このコードの欠点は、次のボタンが、その後押されたときに、それはそう四角形を描画するためにユーザを待たh=imrect
に停止することです。私は四角形を描画しないと何もしません。私はバックまたは次のボタンをもう一度押しても、ユーザーが長方形を描くのをまだ待っているので何もしません。申し訳ありませんが、それは明らかな質問ですが、私はmatlabのGUIには新しいです。
質問:
Imrect
'imrect'のために別のボタンを作成してください... – excaza