Scaleable, draggable box on plots that can select data

纵然是瞬间 提交于 2019-12-04 03:39:39
Andrey Rubshtein

I would start with imrect. It is draggable, and you can add callbacks to it.

(Taken directly from MATLAB help)

figure, imshow('cameraman.tif');
h = imrect(gca, [10 10 100 100]);
addNewPositionCallback(h, @(p) title(mat2str(p, 3)));
fcn = makeConstrainToRectFcn('imrect', get(gca,'XLim'), get(gca, 'YLim'));
setPositionConstraintFcn(h, fcn);

Change the addNewPositionCallback to something that suits your needs. Specifically, get the needed pixels from the image (by using the position), and calculate whatever you like.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!