Google Answers Logo
View Question
 
Q: Image processing ( No Answer,   2 Comments )
Question  
Subject: Image processing
Category: Computers > Graphics
Asked by: sailr-ga
List Price: $20.00
Posted: 15 Jan 2005 01:12 PST
Expires: 19 Jan 2005 15:56 PST
Question ID: 457564
Hi,

I got a picture that has different coloured areas in it. i would like
to output only certain(green in my case) coloured areas in my final
picture.

to put in steps:
1) read the image
2) find the color at every pixel
3) write only those pixels whose color is green.
4) write the image 

it doesn't matter which procedure(steps) you use. all that is needed
is my final picture should have only green coloured areas, all the
other areas should be deleted(either made black or white)

i would like to have the program written either in C/C++ or matlab. I
would really appreciate your help.

Thank you!

Request for Question Clarification by hammer-ga on 15 Jan 2005 08:24 PST
What constitutes "green"?  Are only pixels with an RGB value of
0,255,0 considered green?

In what graphics format/color depth is the incoming image? 

In what graphics format/color depth must the output image be? 

- Hammer

Clarification of Question by sailr-ga on 15 Jan 2005 08:38 PST
pixels with rgb value that is equivalent to that of  green  ; ie
pixels(areas) that appear green on the picture.

i dont know about color depth but the input image in is Jpeg format.
and  need the output could be in any fromat(doesn't matter)

Thank you

Clarification of Question by sailr-ga on 15 Jan 2005 12:14 PST
My picture has different levels of green color like light green,
gretish green. i would like to output those green areas.  i can send
you the image if you want me to.

The input image is a jpeg and output could be in any format.

Thanks a lot!!

Request for Question Clarification by hammer-ga on 15 Jan 2005 12:29 PST
Yes, it would be helpful for whoever works on your question to have
the actual image. Please upload it to a publicly accessible place and
post a link to it.

- Hammer

Clarification of Question by sailr-ga on 15 Jan 2005 13:29 PST
Thank you for your reply. 

actually i found out the rgb values, i shall list those here.  i also
shall upload the picture.


35   169    48          29   179    53          38   164    41

24   168    57          143  187    90          55   182    53

75   147    73          108  138    52          76   132    57

75   179    84          106   181    98         29   138    80

99   136    58          79   137    60


it would be great if you could apply tolerances(to each component of
rgb) to these values since there are many shades of green and slight
change in the value would result in a different shade of green.

here is the link to the image : http://www.etsu.edu/ospa/rso/image/sai.html
( in the image the semi circular green part at the left bottom and
rectangular green part to the right need not be analysed. they are not
needed).

Thank you So Much!
-Venkat

Request for Question Clarification by endo-ga on 15 Jan 2005 13:45 PST
Hi,

There are at least a couple of image processing libraries in C++, are
you willing to code the program yourself?

Thanks.
endo

Clarification of Question by sailr-ga on 15 Jan 2005 16:48 PST
I already spent a lot of time on the coding but with no success. So, i
don't feel like trying again.  I knew about the libraries and some
functions in matlab too that serve this purpose.

i would like to get the coding too  done!

Thank you,
Venkat
Answer  
There is no answer at this time.

Comments  
Subject: Re: Image processing
From: puripant-ga on 19 Jan 2005 09:00 PST
 
Frankly, I think that you can do what you want easily by using
Photoshop, if I understand your question correctly.

However, I create a short piece of code in Matlab that can do your job well.
Firstly, point Current Directoty in Matlab to your desired folder
(where it contains your image file.) In this code, I will point to
your attached filename.

I = imread('sai.jpg');
threshold = 150;
J = I(:,:,2) > threshold;
figure, imshow(I);
figure, imshow(J);

J is the result image whose active pixel is the pixel whose green
value in I is more than the threshold. You can change the threshold as
you want. I found that 150 works well for your image.

If you want more information about Matlab programming or Image
Processing, I am very pleased to clarify my answer.
Subject: Re: Image processing
From: puripant-ga on 19 Jan 2005 09:36 PST
 
I have revised my code now. Here it is.




[filename,pathname] = uigetfile({'*.*','All Files'},'Select the image file');
I = imread([pathname,filename]);

thresholdArray  = inputdlg({'Red: low threshold', 'Red: high threshold', ...
        'Green: low threshold', 'Green: high threshold', ...
        'Blue: low threshold', 'Blue: high threshold'}, ...
    'Enter the threshold values', ...
    1, ...
    {'0', '255', '150', '255', '0', '255'});


J = (I(:,:,1) >= str2num(thresholdArray{1})) .* (I(:,:,1) <=
str2num(thresholdArray{2})) .* ...
    (I(:,:,2) >= str2num(thresholdArray{3})) .* (I(:,:,2) <=
str2num(thresholdArray{4})) .* ...
    (I(:,:,3) >= str2num(thresholdArray{5})) .* (I(:,:,3) <=
str2num(thresholdArray{6}));

figure, imshow(I);
figure, imshow(J);

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy