How to manipulate lines in a figure using a mouse

2 Ansichten (letzte 30 Tage)
Morris Vanegas
Morris Vanegas am 14 Jul. 2015
Beantwortet: Richa Gupta am 16 Jul. 2015
I have a line that is detecting an edge of a grayscale image in the form of two row vectors of length almost 2000. I overlay this line on the image, and want to manually adjust certain points with my mouse for a better fit. Currently, I am using ginput() to obtain the x,y position of my mouse when I click, find the corresponding index on my two vectors, define three points (a few indices before and after the point I clicked on), and am using splice() on these three points to create a new line. This, however, only creates a spike at the location where the mouse click was. I would rather it slowly smooth up from a predefined distance (or sensitivity) away from where I clicked.
In the attached image, the purple line is the edge detected. The blue asterisk is where I clicked, and the orange segment is the splice of three points: The ends of the orange line and the blue asterisk. How can I make this orange line fit more of a smooth curve?
Thanks!

Antworten (1)

Richa Gupta
Richa Gupta am 16 Jul. 2015
Hi Morris,
It looks like the image that you attached did not come through. Also, can you describe what your “splice” function does because I was not able to find this function in the MATLAB built-in functions list. It would be easier for the community to help if you can provide the image and the description of the 'splice' function.
Richa

Community Treasure Hunt

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

Start Hunting!

Translated by