From: Jack Branning on 22 Jul 2010 06:34 Hi, I have an image which contains 24 squares of roughly equal size. I have used segmentation techniques and regionprops to obtain the coordinates that represent the center of each of these squares... Now I need to use these centroid coordinates to create a 50x50 square. I then need to extract all pixels within these squares in a 2-D array. Does anyone know how to create a region of interest (ROI) based on a center coordinate? Thanks in advance for any help you can give me! Jack
From: Sean on 22 Jul 2010 09:23 "Jack Branning" <jbr.nospam(a)nospam.com> wrote in message <i296qs$590$1(a)fred.mathworks.com>... > Hi, > > I have an image which contains 24 squares of roughly equal size. I have used segmentation techniques and regionprops to obtain the coordinates that represent the center of each of these squares... > > Now I need to use these centroid coordinates to create a 50x50 square. I then need to extract all pixels within these squares in a 2-D array. I don't understand what you're trying to do here, but I think I can still answer your question > Does anyone know how to create a region of interest (ROI) based on a center coordinate? row_idx = row_centroid; col_idx = column_centroid; ROI_size = 11; %Will have to add more if you want even ROI_size (pick which side is greater) or if you want a non square ROI_size ROI = I((row_idx-floor(ROI_size/2)):(row_idx+floor(ROI_size/2)),(row_idx-floor(ROI_size/2)):(row_idx+floor(ROI_size/2)));%I is your image. These are the actual pixels. If you want a mask: Imask = false(size(I)); Imask((row_idx-floor(ROI_size/2)):(row_idx+floor(ROI_size/2)),(row_idx-floor(ROI_size/2)):(row_idx+floor(ROI_size/2))) = true; %logical true part will be your region of interest.
From: Jack Branning on 22 Jul 2010 10:21 "Sean " <sean.dewolski(a)nospamplease.umit.maine.edu> wrote in message <i29gno$rmu$1(a)fred.mathworks.com>... > "Jack Branning" <jbr.nospam(a)nospam.com> wrote in message <i296qs$590$1(a)fred.mathworks.com>... > > Hi, > > > > I have an image which contains 24 squares of roughly equal size. I have used segmentation techniques and regionprops to obtain the coordinates that represent the center of each of these squares... > > > > Now I need to use these centroid coordinates to create a 50x50 square. I then need to extract all pixels within these squares in a 2-D array. > > I don't understand what you're trying to do here, but I think I can still answer your question > Thanks for your help! To clarify, I am trying to extract the pixels from each of the squares in the image. I am thinking that the best way to do this is to use the center coordinates that I have, and somehow make 50x50 pixel squares around these coordinates for each...
From: Sean on 22 Jul 2010 10:35 "Jack Branning" <jbr.nospam(a)nospam.com> wrote in message <i29k4j$8m5$1(a)fred.mathworks.com>... > "Sean " <sean.dewolski(a)nospamplease.umit.maine.edu> wrote in message <i29gno$rmu$1(a)fred.mathworks.com>... > > "Jack Branning" <jbr.nospam(a)nospam.com> wrote in message <i296qs$590$1(a)fred.mathworks.com>... > > > Hi, > > > > > > I have an image which contains 24 squares of roughly equal size. I have used segmentation techniques and regionprops to obtain the coordinates that represent the center of each of these squares... > > > > > > Now I need to use these centroid coordinates to create a 50x50 square. I then need to extract all pixels within these squares in a 2-D array. > > > > I don't understand what you're trying to do here, but I think I can still answer your question > > > > Thanks for your help! To clarify, I am trying to extract the pixels from each of the squares in the image. I am thinking that the best way to do this is to use the center coordinates that I have, and somehow make 50x50 pixel squares around these coordinates for each... The what I provided is fine ROI_size = 50; %You'll have to pick which side of the centroid gets 24 added and the other 25; to do this use ceil() on one and floor on the other. Then the ROI code above will work. You'll have to loop over all of them and store each ROI or you could create a mask for the entire thing. 2 ways to store them would be: 1. Use cells: >>ROI = cell(24,1)% Then store each ROI as a cell 2. Use the 3rd dimension: >>ROI = zeros(50,50,24); %Where each page is a ROI. This works because they're all the same size.
From: Sean on 22 Jul 2010 10:43 "Jack Branning" <jbr.nospam(a)nospam.com> wrote in message <i29k4j$8m5$1(a)fred.mathworks.com>... > "Sean " <sean.dewolski(a)nospamplease.umit.maine.edu> wrote in message <i29gno$rmu$1(a)fred.mathworks.com>... > > "Jack Branning" <jbr.nospam(a)nospam.com> wrote in message <i296qs$590$1(a)fred.mathworks.com>... > > > Hi, > > > > > > I have an image which contains 24 squares of roughly equal size. I have used segmentation techniques and regionprops to obtain the coordinates that represent the center of each of these squares... > > > > > > Now I need to use these centroid coordinates to create a 50x50 square. I then need to extract all pixels within these squares in a 2-D array. > > > > I don't understand what you're trying to do here, but I think I can still answer your question > > > > Thanks for your help! To clarify, I am trying to extract the pixels from each of the squares in the image. I am thinking that the best way to do this is to use the center coordinates that I have, and somehow make 50x50 pixel squares around these coordinates for each... You could also just use the 'BoundingBox' output of regionprops and segment everything inside that.
|
Next
|
Last
Pages: 1 2 Prev: Create a message 'Processing...' Next: How can i implement fourier transform in Simulink? |