Prev: find roots on uqtaion
Next: custom legend graphics
From: Sai Mithinti on 21 Jul 2010 17:40 Hi All, Here is my problem.. I have a shape file and an image file. I am overlaying the shapefile on the imagefile and am trying to retrive the pixel values from the image. I need to select a few points on the image whose pixel values need to be stored in a vector. Can anyone suggest any matlab functions for doing the same. I have tried the impixelinfo, impixel and impixelinfoval but I was not able to succeed in doing that.
From: Walter Roberson on 21 Jul 2010 17:52 Sai Mithinti wrote: > Here is my problem.. > > I have a shape file and an image file. > I am overlaying the shapefile on the imagefile and am trying to retrive > the pixel values from the image. I need to select a few points on the > image whose pixel values need to be stored in a vector. Can anyone > suggest any matlab functions for doing the same. I have tried the > impixelinfo, impixel and impixelinfoval but I was not able to succeed in > doing that. As I read that, that appears to be two different issues: 1) overlaying a shape on the image and retrieve pixel values from the image. This part sounds like applying a Region of Interest (ROI) to the image, which is a relatively simple operation when done on the data matrices level (rather than trying to work on what is showing on the screen.) 2) selecting points on the image and storing the pixel values in a vector. There are a number of different ways of approaching this that depend upon the sophistication of the interface you want to present to the user. If you just need a small number of points and no "undo" and no shape creation, then primitives such as ginput() and indexing into the data matrices are fine. If you want a full shape creation tool, then roipoly() is available in the Image Processing Toolkit You have not provided anything that links these two operations logically together ?
From: Sai Mithinti on 21 Jul 2010 18:12 I must have put the question in an incorrect way. here is what I did exactly.. %image file display handles.display =axes('Parent',hfig,... 'Position',[.01,0.2,1.0,0.6],... 'ActivePositionProperty','Position',... 'Visible','off'); [handles.img, handles.cmap, handles.R, handles.bbox] = geotiffread(<image path>); mapshow(handles.display, handles.img,handles.R) %shape file display P = shaperead(<shape file path>); x = [P.X]; y = [P.Y]; mapshow(handles.display,x,y); imageInfo = geotiffinfo(<image file path>); axis(handles.display,[imageInfo.BoundingBox(1,1) imageInfo.BoundingBox(2,1)... imageInfo.BoundingBox(1,2) imageInfo.BoundingBox(2,2)]) impixelinfo; %the code for retrieving pixel values [x y handles.val] = impixel(handles.display,handles.cmap); handles.val = [x y handles.val]; % Initiate a table on the GUI cnames = {'X','Y','Red','Green','Blue'}; % column names t = uitable('Parent',hfig,... 'Data',handles.val,... 'ColumnName',cnames,... 'Position',[800 400 200 200]); The final part is where I am stuck up where I cant retrive pixel values from the actual image being displayed. Please let me know if my problem is clearer now and if you can suggest any changes to the snippet. Thanks, Sai Walter Roberson <roberson(a)hushmail.com> wrote in message <i27qef$ig8$1(a)canopus.cc.umanitoba.ca>... > Sai Mithinti wrote: > > > Here is my problem.. > > > > I have a shape file and an image file. > > I am overlaying the shapefile on the imagefile and am trying to retrive > > the pixel values from the image. I need to select a few points on the > > image whose pixel values need to be stored in a vector. Can anyone > > suggest any matlab functions for doing the same. I have tried the > > impixelinfo, impixel and impixelinfoval but I was not able to succeed in > > doing that. > > As I read that, that appears to be two different issues: > > 1) overlaying a shape on the image and retrieve pixel values from the image. > This part sounds like applying a Region of Interest (ROI) to the image, which > is a relatively simple operation when done on the data matrices level (rather > than trying to work on what is showing on the screen.) > > 2) selecting points on the image and storing the pixel values in a vector. > There are a number of different ways of approaching this that depend upon the > sophistication of the interface you want to present to the user. If you just > need a small number of points and no "undo" and no shape creation, then > primitives such as ginput() and indexing into the data matrices are fine. If > you want a full shape creation tool, then roipoly() is available in the Image > Processing Toolkit > > > You have not provided anything that links these two operations logically > together ?
|
Pages: 1 Prev: find roots on uqtaion Next: custom legend graphics |