Thread Subject: continue m-file after using impoint

Subject: continue m-file after using impoint

From: Oliver Warlow

Date: 5 Mar, 2010 11:57:05

Message: 1 of 2

I am using impoint to digitise a number of points in an image. I want to digitise an unknown number of points, then continue with the rest of the m-file fater this has been done. I would like to the user to be able to push a button or keyboard to continue. My current method uses a while loop, but I cannot figure out how to break out of this loop once the user has finished digitising the points.
Oli

Subject: continue m-file after using impoint

From: Matthew Whitaker

Date: 12 Mar, 2010 16:48:02

Message: 2 of 2

"Oliver Warlow" <oli.warlow@gmail.com> wrote in message <hmqrih$shm$1@fred.mathworks.com>...
> I am using impoint to digitise a number of points in an image. I want to digitise an unknown number of points, then continue with the rest of the m-file fater this has been done. I would like to the user to be able to push a button or keyboard to continue. My current method uses a while loop, but I cannot figure out how to break out of this loop once the user has finished digitising the points.
> Oli

Oliver ,
you might want to look at ginput for your needs but if you want to use impoint you can use its wait property. Here is a demo of how you might approach it.

function impointDigitizeDemo
    figure;
    hIm = imshow('pout.tif');
    hAx = get(hIm,'Parent');
    title(hAx,'Click on Image to place digitizer point');
    p = impoint(hAx,[]);
    title(hAx,'Drag Point to digitize, double click point to continue');
    drawnow;
    digitizedPoints = p.getPosition;
    % Construct boundary constraint function
    fcn = makeConstrainToRectFcn('impoint',get(hAx,'XLim'),get(hAx,'YLim'));
    p.setPositionConstraintFcn(fcn);
    callbackID= p.addNewPositionCallback(@digitizePoints);
    finalPoint =wait(p);
    p.removeNewPositionCallback(callbackID);
    digitizedPoints = [digitizedPoints;finalPoint];
    h2 = figure;
    axes('Parent',h2);
    digitizedPoints = unique(digitizedPoints,'rows');
    plot(digitizedPoints(:,1),digitizedPoints(:,2),'.');
    
    
    function digitizePoints(newPos)
        digitizedPoints = [digitizedPoints;newPos];
    end %digitizePoints

end %impointDigitizeDemo


Hope this helps
Matt W

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
impoint wait Matthew Whitaker 12 Mar, 2010 11:49:14
impoint Oliver Warlow 5 Mar, 2010 06:59:10
rssFeed for this Thread

Contact us at files@mathworks.com