Limit unclean clicks and convert them to a rectangle - Matlab

I am using impoly, as in the script below, and I have two questions:

  • Can I limit clicks on points (e.g. 5) and automatically close it?

  • Is there a way to convert impoly to fix as in the attached image (red square)?

Script:

clc;
clear; 

figure, imshow('pout.tif');
hpoly = impoly(gca);

enter image description here

+4
source share
1 answer

From the impoly documentation, I don't think this is possible. For this user behavior, you should probably write your own point selection function.

Several Matlab features will help you in this direction.

  • [x,y] = ginput(n) to select points
  • impoint(hparent,x, y)to draw the drag points,
  • lineto draw a line between the points and a rectangular frame.

impoint 'PositionConstraintFcn', , . , , .

, ( ..) "", , , ( ) ( 'PositionConstraintFcn').

0

Source: https://habr.com/ru/post/1687742/


All Articles