Thread Subject:
image aggregation by regions

Subject: image aggregation by regions

From: Michael Lonther

Date: 25 Jan, 2008 16:06:03

Message: 1 of 2

I have two images with the same dimensions (1000 x 1000),
one image contains data values that I am trying to aggregate
and the other image contains regions (labeled 1 through 305)
over which I would like to do the aggregation in the form of
sum. In other words, I would like to sum the values of the
first image over each region and write the output as ascii.
 I do not have access to image processing toolbox.

Any help would be greatly appreciated.

Thanks..

Subject: image aggregation by regions

From: Ian Clarkson

Date: 25 Jan, 2008 17:44:03

Message: 2 of 2

"Michael Lonther" <rsbu@yahoo.com> wrote in message
<fnd1db$kdi$1@fred.mathworks.com>...
> I have two images with the same dimensions (1000 x 1000),
> one image contains data values that I am trying to
aggregate
> and the other image contains regions (labeled 1 through
305)
> over which I would like to do the aggregation in the form
of
> sum. In other words, I would like to sum the values of
the
> first image over each region and write the output as
ascii.
> I do not have access to image processing toolbox.
>
> Any help would be greatly appreciated.
>
> Thanks..

try something like this:

% generate your labels (regions)
labels=rand(10,10);
labels=round(labels*9+1);

% generate your data to be aggregated
values=rand(10,10);

% find the largest label (should be 305 in your case)
maxLabel=max(labels(:));

% loop through and find sum of all elements with those
indices
for i = 1:maxLabel
  agg(i) = sum(values(find(labels==i)));
end;

% now agg(i) contains the sum of all values labeled with
index i. ex. agg(305) contains the sum of all elements with
index 305 in the labels matrix.

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
image processing Michael Lonther 25 Jan, 2008 11:09:58
rssFeed for this Thread

Contact us