Thread Subject: regionprops AND x-y axis problem

Subject: regionprops AND x-y axis problem

From: Parker

Date: 9 Feb, 2010 10:51:54

Message: 1 of 3

hi all, i use 'regionprops' to get the region properties of an image
as following,

> > a = imread('test.jpg');
> > b = im2bw( a) ;
> > st = regionprops( b, 'PixelIdxList', 'PixelList');

the st should include all regions where the values are 1 in binary
image b. the PixelList is like:

>> st(3).PixelList
ans =
    16 123
    16 124
    16 125
    17 121
    17 122
    17 123
    17 124
    17 126
...

However, when I want to check the Value of b(16,123), b( 16,
124) . . . ,
MATLAB returned 0 instead of 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
How did it happened? when i swap the indexes by b(123,16), it
returned 1.

thus i was totally confused about the indexes returned by regionprops
function. How do the x and y axises arranged in the image?

Can anybody help?

Subject: regionprops AND x-y axis problem

From: Ashish Uthama

Date: 9 Feb, 2010 13:40:20

Message: 2 of 3

On Tue, 09 Feb 2010 05:51:54 -0500, Parker <xenoszh@gmail.com> wrote:

> hi all, i use 'regionprops' to get the region properties of an image
> as following,
>
>> > a = imread('test.jpg');
>> > b = im2bw( a) ;
>> > st = regionprops( b, 'PixelIdxList', 'PixelList');
>
> the st should include all regions where the values are 1 in binary
> image b. the PixelList is like:
>
>>> st(3).PixelList
> ans =
> 16 123
> 16 124
> 16 125
> 17 121
> 17 122
> 17 123
> 17 124
> 17 126
> ...
>
> However, when I want to check the Value of b(16,123), b( 16,
> 124) . . . ,
> MATLAB returned 0 instead of 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
> How did it happened? when i swap the indexes by b(123,16), it
> returned 1.
>
> thus i was totally confused about the indexes returned by regionprops
> function. How do the x and y axises arranged in the image?
>
> Can anybody help?

Have a look at the doc for PixelList:
'PixelList' — p-by-Q matrix specifying the locations of pixels in the
region. Each row of the matrix has the form [x y z ...] and specifies the
coordinates of one pixel in the region.

They are 'arranged' the same way, but you index into a matrix using
(row,col). Rows increase along the y direction, hence in Cartesian
coordinates, (row,col) converts to (y,x).

Subject: regionprops AND x-y axis problem

From: Parker

Date: 9 Feb, 2010 15:27:15

Message: 3 of 3

On 2月9日, 下午1时40分, "Ashish Uthama" <first.l...@mathworks.com> wrote:
> On Tue, 09 Feb 2010 05:51:54 -0500, Parker <xeno...@gmail.com> wrote:
> > hi all, i use 'regionprops' to get the region properties of an image
> > as following,
>
> >> >  a =  imread('test.jpg');
> >> >  b = im2bw( a) ;
> >> >  st = regionprops( b, 'PixelIdxList', 'PixelList');
>
> > the st should include all regions where the values are 1 in binary
> > image b. the PixelList is like:
>
> >>> st(3).PixelList
> > ans =
> >     16   123
> >     16   124
> >     16   125
> >     17   121
> >     17   122
> >     17   123
> >     17   124
> >     17   126
> > ...
>
> > However,  when I want to check the Value of b(16,123),  b( 16,
> > 124)  . . . ,
> > MATLAB returned 0 instead of 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
> > How did it happened?  when i swap the indexes by b(123,16), it
> > returned 1.
>
> > thus i was totally confused about the indexes returned by regionprops
> > function. How do the x and y axises arranged in the image?
>
> > Can anybody help?
>
> Have a look at the doc for PixelList:
> 'PixelList' — p-by-Q matrix specifying the locations of pixels in the  
> region. Each row of the matrix has the form [x y z ...] and specifies the  
> coordinates of one pixel in the region.
>
> They are 'arranged' the same way, but you index into a matrix using  
> (row,col). Rows increase along the y direction, hence in Cartesian  
> coordinates, (row,col) converts to (y,x).

many thx. I got it.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com