Thread Subject: Detection of pixels

Subject: Detection of pixels

From: Christian

Date: 31 Oct, 2007 21:29:09

Message: 1 of 8


I have a picture in rgb corresponding to a map, this image
contains a lake, and I need to separate the image of water
from the rest of colors that presents the image, so as to
obtain the number of pixels corresponding to water.

Appreciate that someone might have an idea as I do not know
how to begin.


Subject: Detection of pixels

From: Pete

Date: 1 Nov, 2007 01:08:40

Message: 2 of 8

Hi,
Perhaps someone will give you a fuller answer, but in case they don't I will ask
you 2 things:
 - does you image contain flat colours, and so you just want to count the pixels
which are a particular shade of blue, or is it more complicated than that (e.g.
there are blue pixels which aren't part of the lake, or there are different shades
of blue in the lake)?
 - do you have the image processing toolbox?

I wasn't sure if you meant a 'colourmap', or a map like you'd find in an atlas.

Subject: Detection of pixels

From: Christian

Date: 1 Nov, 2007 01:26:37

Message: 3 of 8

"Christian " <christian_zepeda_e@yahoo.com.ar> wrote in
message <fgas35$dqm$1@fred.mathworks.com>...
>
> I have a picture in rgb corresponding to a map, this image
> contains a lake, and I need to separate the image of water
> from the rest of colors that presents the image, so as to
> obtain the number of pixels corresponding to water.
>
> Appreciate that someone might have an idea as I do not know
> how to begin.
>
>


The image is an image Lansat, ".tif" format, is rgb real
color and well-defined sectors of water, so that certain
colors necessarily represent levels of water, so it is
necessary to define how many pixels represent this region of
interest and this exactly represented by shades of blue hue.

In my version I have installed the MATLAB toolbox processing
images.

A hug.

Christian

Subject: Detection of pixels

From: Christian

Date: 1 Nov, 2007 01:28:36

Message: 4 of 8

"Christian " <christian_zepeda_e@yahoo.com.ar> wrote in
message <fgas35$dqm$1@fred.mathworks.com>...
>
> I have a picture in rgb corresponding to a map, this image
> contains a lake, and I need to separate the image of water
> from the rest of colors that presents the image, so as to
> obtain the number of pixels corresponding to water.
>
> Appreciate that someone might have an idea as I do not know
> how to begin.
>
>

The image is an image Lansat, ".tif" format, is rgb real
color and well-defined sectors of water, so that certain
colors necessarily represent levels of water, so it is
necessary to define how many pixels represent this region of
interest and this exactly represented by shades of blue hue.

In my version I have installed the MATLAB toolbox processing
images.

A hug.

Christian

Subject: Detection of pixels

From: Christian

Date: 1 Nov, 2007 01:31:11

Message: 5 of 8

"Pete " <pete.dot.bankhead@btinternet.dot.com> wrote in
message <fgb8uo$jie$1@fred.mathworks.com>...
> Hi,
> Perhaps someone will give you a fuller answer, but in case
they don't I will ask
> you 2 things:
> - does you image contain flat colours, and so you just
want to count the pixels
> which are a particular shade of blue, or is it more
complicated than that (e.g.
> there are blue pixels which aren't part of the lake, or
there are different shades
> of blue in the lake)?
> - do you have the image processing toolbox?
>
> I wasn't sure if you meant a 'colourmap', or a map like
you'd find in an atlas.

The image is an image Lansat, ".tif" format, is rgb real
color and well-defined sectors of water, so that certain
colors necessarily represent levels of water, so it is
necessary to define how many pixels represent this region of
interest and this exactly represented by shades of blue hue.

In my version I have installed the MATLAB toolbox processing
images.

A hug.

Christian

Subject: Detection of pixels

From: Pete

Date: 1 Nov, 2007 02:46:55

Message: 6 of 8

Wow. Three answers and three hugs. I wasn't expecting that.

I'd suggest looking at some of the colour image segmentation examples at
http://www.mathworks.com/products/image/demos.html

Also, as a very basic starting point you can open the image using IMTOOL in
the image processing toolbox, e.g.
imtool('landsat.tif', []);
then move your cursor over the lakes. In the bottom left corner of the
window you should see "Pixel info: (X, Y) [R G B]" where X and Y are the cursor
coordinates and R G B are the red, green and blue colour values respectively.
This will give you an idea of what RGB combinations you are trying to find.
The image itself will be stored as an (m x n x 3) array, where each m x n
'plane' is for a different colour. You can treat each of these as if they were
separate greyscale images and threshold them or search for specific values
etc. If your problem isn't very hard you might not need much more than
this.... but often these things are harder than that.

In the end, you will probably want a binary image where the lake is white and
everything else is black. Then you can use BWAREA to get the area of the
white bit, or a combination of BWLABEL and REGIONPROPS.

Sorry, I'm not sure if you wanted a more or less complicated answer than that.
MATLAB also has a "Mapping toolbox", but I have no idea about this area so I
don't know if it is relevant to this specific problem - http://
www.mathworks.com/products/mapping/
Good luck anyway.

Subject: Detection of pixels

From: Christian

Date: 1 Nov, 2007 03:41:43

Message: 7 of 8

Thanks ... Try your way, I think will be useful.

Christian

Subject: Detection of pixels

From: Dave Robinson

Date: 1 Nov, 2007 09:56:38

Message: 8 of 8

"Christian " <christian_zepeda_e@yahoo.com.ar> wrote in
message <fgbhtn$12n$1@fred.mathworks.com>...
> Thanks ... Try your way, I think will be useful.
>
> Christian
>

You will almost certainly benefit from converting your rgb
image into an intensity independent image (this is an image
which only displays colour information, where the
variations of illumination have been removed e.g. a pixel
whose rgb values are 128 128 64 is the same colour as a
pixel whose rgb values are 64 64 32 the difference is the
second one is simply darker).

There are several options open to you, for example

1) Convert your image into HSV and set up your colour
filter using the values taken from the HS planes, ignoring
the V plane (i.e. you have a 2 plane image).

2) Convert your image into normalized rgb. The
approximation functions
 
Redness(r,g,b) = r/(r+g+b)
Greenness(r,g,b) = g/(r+g+b)
Blueness(r,g,b) = b/(r+g+b)

applied to every image pixel will do the job.

Then apply the techniques described by Pete should now
perform substantially better.

Regards

Dave Robinson

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
detection procc... Christian 31 Oct, 2007 17:30:25
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