Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Help with retrieving pixel values

Subject: Help with retrieving pixel values

From: Sai Mithinti

Date: 15 Jul, 2010 17:34:05

Message: 1 of 2

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

Subject: Help with retrieving pixel values

From: Sean

Date: 15 Jul, 2010 17:51:04

Message: 2 of 2

"Sai Mithinti" <sainiranjanm@gmail.com> wrote in message <i1ngqd$76f$1@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.

Tags for this Thread

No tags are associated with this thread.

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.

Contact us