Prev: Creating a legend for a grayscale image
Next: Controlling Lecroy Oscilloscope with Instrument Control Toolbox
From: Sai Mithinti on 15 Jul 2010 13:34 Hi All, I have an axes that has two images in it(overlapped). I would like to see and store the pixel values of mouseclick on the picture. I used impixelinfo which shows the pixel values(RGB) at the bottom but I need to store them, and I have not been able to do it the way it was mentioned in one of the other forums http://www.mathkb.com/Uwe/Forum.aspx/matlab/129188/impixelinfo-question I tried using impixel, and the resulting matrix had only 'NaN' in it. here are the code snippets.... handles.display =axes('Parent',hfig,... 'Position',[.01,0.2,1.0,0.6],... 'ActivePositionProperty','Position',... 'Visible','off'); mapshow(handles.display, DOQQ_fileAddress) P = shaperead(get(handles.Shape,'String')); x = [P.X]; y = [P.Y]; mapshow(handles.display,x,y); imageInfo = geotiffinfo(get(handles.DOQQ,'String')); axis(handles.display,[imageInfo.BoundingBox(1,1) imageInfo.BoundingBox(2,1)... imageInfo.BoundingBox(1,2) imageInfo.BoundingBox(2,2)]) vals = impixel; t = uitable('Parent',hfig,'Position',[800 400 200 200]); disp(vals); set(t,'Data',vals); Can anyone help me with fix this.. thanks in advance
From: Sean on 15 Jul 2010 13:51
"Sai Mithinti" <sainiranjanm(a)gmail.com> wrote in message <i1ngqd$76f$1(a)fred.mathworks.com>... > Hi All, > > > I have an axes that has two images in it(overlapped). > I would like to see and store the pixel values of mouseclick on the picture. > > > I used impixelinfo which shows the pixel values(RGB) at the bottom but I need to store them, and I have not been able to do it the way it was mentioned in one of the other forums http://www.mathkb.com/Uwe/Forum.aspx/matlab/129188/impixelinfo-question > > > I tried using impixel, and the resulting matrix had only 'NaN' in it. > > here are the code snippets.... > > handles.display =axes('Parent',hfig,... > 'Position',[.01,0.2,1.0,0.6],... > 'ActivePositionProperty','Position',... > 'Visible','off'); > > > mapshow(handles.display, DOQQ_fileAddress) > > P = shaperead(get(handles.Shape,'String')); > > x = [P.X]; y = [P.Y]; > > mapshow(handles.display,x,y); > > imageInfo = geotiffinfo(get(handles.DOQQ,'String')); > > axis(handles.display,[imageInfo.BoundingBox(1,1) imageInfo.BoundingBox(2,1)... > imageInfo.BoundingBox(1,2) imageInfo.BoundingBox(2,2)]) > > vals = impixel; > t = uitable('Parent',hfig,'Position',[800 400 200 200]); > disp(vals); > set(t,'Data',vals); > > > Can anyone help me with fix this.. thanks in advance One way if I understand you properly: I = imread('cameraman.tif'); imshow(I) [x y] = ginputs(3); %get 3 points values = I(sub2ind(size(I),y,x); %Note, y,x are switched because sub2ind() works along vertical dimension first. |