Ali Mirzaei
Ali Mirzaei

Reputation: 1552

getting 2D points from mouse in simulink?

I want to apply perspective transform in Computer Vision toolbox in simulink of Matlab. I need to get 4 points from mouse on a given image to compute perspective matrix according these points.

I want to use the first frame of movie to get points on it.enter image description here

Upvotes: 0

Views: 323

Answers (1)

Navan
Navan

Reputation: 4477

One possible way is to create a level-2 MATLAB S-Function block which takes input from "From Multimedia File" and shows a figure window with the first frame to the user. From the figure window you can use ginput to get mouse clicks and then send that as output Pts connected to "Estimate Geometric Transformation". After the first frame you need to continue to send the same Pts as output. See documentation for creating level-2 MATLAB s-function at

http://www.mathworks.com/help/simulink/slref/level2matlabsfunction.html

It is probably easier if you do this outside simulink, by reading the first frame and find the points using ginput on a figure window. You can then use some Constant blocks as Pts1 and Pts2 inputs for which you can set the values using set_param.

Upvotes: 1

Related Questions