how to plot mouse movment without missing any point

2 次查看(过去 30 天)
Hii every one I need help In my project I am ploting mouse movment on x and y axes. But in that some points misses..
This is how I am using plot..
p = get(h_axes,'CurrentPoint');
x = p(1,1);
y = p(1,2);
x_pen = [x_pen x];
y_pen = [y_pen y];
plot( h_axes,[x_pen(end-1) x],[y_pen(end-1) y]','b.-', ...
'MarkerEdgeColor','k', 'MarkerFaceColor','b', ...
'MarkerSize',10, 'Tag','TRAJECTORIA' );
I am devloping pen like tool which in which I want to plots mouse tracing continously but some points misses,,.. Is there any way to solve this..
  2 个评论
per isakson
per isakson 2015-1-29
编辑:per isakson 2015-1-29
  • Is this code inside a loop?
  • Which Matlab release?
  • Is&nbsp hold on ?
  • Only the two most recent points are displayed. Is that by intent?
chhaya gohel
chhaya gohel 2015-1-30
sir i am capturing mouse movment from mouse button down to next up event.
so this code is in WindowButtonMotionFcn@movment where movment is my function for capturing and plotting co-ordinates..
hold is on
and not just two but all the points of mouse movment is going to be plot.. but the problem is some points misses during this plot ..

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2015-1-30
If you have the Image Processing Toolbox, how about using imfreehand()? Demos attached.
  1 个评论
chhaya gohel
chhaya gohel 2015-1-30
thank you sir.. now with this code i can add the points with interpolation..
but my problem is still there..
sir actully i am capturing mouse movment and same time plotting it..
so when x and y co ordinate Reaptes it will be taken as a junction point. So I need to get the points without missing any of them..
Suppose
X -> 1.2 1.3 1.5 1.6
y->1.4,1.6,1.7,1.8
here in x 1.4 and in y 1.5 in missing so I will not get continouse
plotting and that’s why I am not getting reaptes points even if I draw in such way that points get reapted..
so is there any way to add this points without distrbing the existing point..
i can not add points dynamically , it is very time consuming anf the size of x and y changes with my free hand drawing so how to solve it

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by