Eka
Eka

Reputation: 15000

How to save measured pixel distance data in matlab

I got this code from here

figure, imshow('pout.tif');
h = imdistline(gca);
api = iptgetapi(h);
fcn = makeConstrainToRectFcn('imline',...
                              get(gca,'XLim'),get(gca,'YLim'));
api.setDragConstraintFcn(fcn);   

Can you tell me how i can save the pixel distance data measured between two points "dynamically" into a separate file or as a variable in matlab

Upvotes: 0

Views: 1886

Answers (1)

athypes
athypes

Reputation: 185

figure, imshow('pout.tif');
h = imdistline(gca);
api = iptgetapi(h);
fcn = makeConstrainToRectFcn('imline',...
                              get(gca,'XLim'),get(gca,'YLim'));
api.setDragConstraintFcn(fcn);  

dist = api.getDistance()

I believe you are looking for how to use the API. In the above example, you call api followed by the functions on the page you listed. I.e.

api.getDistance
api.getAngleFromHorizontal

etc

Upvotes: 1

Related Questions