필터 지우기
필터 지우기

How to interrupt the roipoly function

조회 수: 5 (최근 30일)
Silvia
Silvia 2020년 3월 10일
댓글: Silvia 2020년 3월 10일
Good morning,
I am having problems with the roipoly function. I would like to know if it is possible to interrupt/cancel the action of roipoly.
I mean, I have a button (in a GUI) that launches the roipoly function but if I press the button unintentionally the antion starts and I can not cancel the action.
Is there any way to cancel the action without having to select the points in the image?
Thank you very much,
Silvia

답변 (1개)

Image Analyst
Image Analyst 2020년 3월 10일
편집: Image Analyst 2020년 3월 10일
If you put a title over your image that says to right click to cancel,
title('Left click vertices then right click to finish');
[x, y] = roipolyold();
then you can check if the returned point set is empty or less than 2, and if so, they bailed out.
if isempty(x) || length(x) <= 2
% Not a complete polygon. Better not continue with code or you'll get an error.
return;
end
You can also use questdlg() to ask the user if the polygon is acceptable or not, and if not, have them redraw it.
  댓글 수: 1
Silvia
Silvia 2020년 3월 10일
Thank you very much for the idea.
I have also found information about using a Robot to simulate that I have press the ESCAPE button.
I'll try both options.
Thank you again
Silvia

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Filtering and Enhancement에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by