Thread Subject: matrix labels for color segmentation

Subject: matrix labels for color segmentation

From: francesco santi

Date: 21 Nov, 2008 23:11:03

Message: 1 of 3

I have a MxNx3 matrix which is a color image.
Then I add a 4th column to be used as labeling index for segmentation.
I reshape this matrix to a MNx4 matrix where the first 3 columns are the 3 color components and the 4th column are the labels index.
I need to compute mean and cov of the pixels with assigned label.
I thought about scanning the matrix looking for the rows having as 4th value in the row the same number of the label index.

temp=zeros(1,4);
    for x = 1:3
        if (RGB_columns(x,4) == label)
            temp(x,:) = RGB_columns(x,:);
        end;
    end
MU = mean(temp(:,:));

In this way I should create the temp matrix with only the rows having the value that I am looking for in the label field...but I get this error message:
"Maximum recursion limit of 500 reached"
and if I change this value of course Matlab crashes.

Subject: matrix labels for color segmentation

From: francesco santi

Date: 21 Nov, 2008 23:41:02

Message: 2 of 3

Please consider this code instead of the previous posted.


    temp=zeros(HLS_RESHAPE_ROWS,HLS_RESHAPE_COLS);
    for x = 1:HLS_RESHAPE_ROWS
        if (HLS_RESHAPE(x,4) == label)
            temp(x,1:3) = HLS_RESHAPE(x,1:3);
        end;
    end
MU=mean(temp);

Thanks very much in advance to whom could help me.

Subject: matrix labels for color segmentation

From: francesco santi

Date: 22 Nov, 2008 00:04:02

Message: 3 of 3

solved...

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
matrix francesco santi 21 Nov, 2008 18:15:04
segmentation francesco santi 21 Nov, 2008 18:15:04
index francesco santi 21 Nov, 2008 18:15:04
label francesco santi 21 Nov, 2008 18:15:04
mean francesco santi 21 Nov, 2008 18:15:04
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