Why does a second call to IMPIXEL clear my figure and not show previously selected points in the Image Processing Toolbox 7.2 (R2011a) ?
1 view (last 30 days)
Show older comments
I am using IMPIXEL to select a point. Then when I call IMPIXEL again, the previously selected point is not shown in the figure.
Accepted Answer
MathWorks Support Team
on 4 Aug 2011
The IMPIXEL function clears the figure once the points have been selected and you hit the Enter key. The function does not currently provide the functionality to keep previously selected points.
In order to get such functionality, a possible workaround would be to implement the functionality using a function like GINPUT or GETPTS along with IMSHOW. You can refer to the sample MATLAB script that I have written below to help you:
clc;
clear all;
close all;
% initialize number of points
np = 1;
% read sample image
img = imread('cameraman.tif');
% display image
imshow(img);
title('Click on an UPPER point');
hold on;
% get coordinates and intensity of selected point
[x,y] = ginput(1);
intensity1 = img(round(x),round(y));
% plot selected point
plot(x,y,'r+');
hold on;
% place text on image
text(x,y,[' \color{blue}' num2str(np)],'FontWeight','bold');
% change title
title('Click on matching LOWER point');
% update np
np = np+1;
% get coordinates and intensity of selected point
[x,y] = ginput(1);
intensity2 = img(round(x),round(y));
% plot selected point
plot(x,y,'r+');
hold on;
% place text on image
text(x,y,[' \color{blue}' num2str(np)],'FontWeight','bold');
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!