Thread Subject: index number

Subject: index number

From: Mathew Thomas

Date: 25 Nov, 2009 05:50:20

Message: 1 of 7

Hey all,

How can I find the "index number" in an image ? I can see the index number on the image itself when I click on the different colors, but how can I access the index number in maybe some kind of an array or so...

Any ideas are welcome....

Thank you
Matt

Subject: index number

From: Jan Simon

Date: 25 Nov, 2009 11:06:05

Message: 2 of 7

Dear Mathew!

> How can I find the "index number" in an image ? I can see the index number on the image itself when I click on the different colors, but how can I access the index number in maybe some kind of an array or so...

What is the "index number"?
In which program can you click on a color - and what is "clicking on a color".

Kind regards, Jan

Subject: index number

From: Mathew Thomas

Date: 25 Nov, 2009 14:15:09

Message: 3 of 7

Hey Jan,

Im talking about color map index number....For example, what I have is a grayscale image with different shades of gray for different objects. Now if I put the cursor over each object, it shows me a different index and RGB values...I want to save the index values, but I cant figure out where to access them or which code to use. I am able to separate the objects using this command: x = ismember(L,3); imshow(x), where 3 is the index number here, but sadly I have to look at the image for each object's index number each time....

Hope this helps in understanding my problem...

Matt

Subject: index number

From: ImageAnalyst

Date: 25 Nov, 2009 14:21:04

Message: 4 of 7

The gray level IS the index number. If you have a monochrome image,
and use a colormap with it, MATLAB calls that monochrome image an
"indexed" image. The gray value is the index (row) into the
pseudocolor look up table. So if you have the image (which of course
you do), you have the indexes.

Subject: index number

From: Mathew Thomas

Date: 25 Nov, 2009 14:52:22

Message: 5 of 7

Hey Imageanalyst,

That is what I wanted to convey in my last message...I understand it is the gray level..for each gray level there is an index number...true....But is there any way I can access this numbers from the code instead of the image... ??

Thanks
Matt

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <255f3f2f-5e8c-4f96-9cca-647febcae7df@s31g2000yqs.googlegroups.com>...
> The gray level IS the index number. If you have a monochrome image,
> and use a colormap with it, MATLAB calls that monochrome image an
> "indexed" image. The gray value is the index (row) into the
> pseudocolor look up table. So if you have the image (which of course
> you do), you have the indexes.

Subject: index number

From: Image Analyst

Date: 25 Nov, 2009 15:43:21

Message: 6 of 7

Mathew Thomas:
Either I don't understand you, or you don't understand me. Let's say you have an array called imageArray, which is a monochrome (gray scale) image with 256 gray levels in the range of 0-255. If you have a colormap (256 by 3) and you look at row (index) 42, and it is [0 1 0] and you then display the imageArray with a colormap, then every pixel in the image that has gray level 41 will show up as green. Same for all the other gray levels in the image - each gets displayed with the color that is indicated by it's gray level, which (after you add 1 to it) is an index into the pseudo color look up table. If you really want the "index" as a separate variable, then just try this:

grayValue= imageArray(123, 319);
index = grayValue + 1; % because arrays are 1 based while gray scale is zero based.

This will give you the "index" for the pixel at (row, column) = (123, 319). Let's say that index = 42 (meaning that imageArray(123, 3199) equals 41). Then you look at row 42, and read off the 3 normalized (must be in the range 0-1) values of colormap in row 42 that correspond to the color that all pixels of value 41 will be displayed with if you use the colormap.

I have no idea what you mean by "But is there any way I can access this numbers from the code instead of the image." The image is a variable, and you can get values from variables by writing code, like I showed above. So I really don't understand the difference that you think exists between "the image" and "the code."

Subject: index number

From: Mathew Thomas

Date: 26 Nov, 2009 01:13:05

Message: 7 of 7

Hey ImageAnalyst,

I got what you meant now.. Thank you so much for the detailed explaination..

Matt

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
colormap Image Analyst 25 Nov, 2009 10:44:11
rssFeed for this Thread

Contact us at files@mathworks.com