[Insight-users] How does ITK covert color image into grayscaleimage?

Albert Chitemyan abbs_c at yahoo.com
Wed Nov 30 03:07:49 EST 2005


Hi Chris,
   
  I didn't mean that.
  I mean, I have got code
   
  typedef itk::Image<unsigned char, 2> ImageType;
  typedef itk::ImageFileReader<ImageType> ReaderType;
  ReaderType::Pointer reader = ReaderType::New();
   
  reader->SetFileName("d:\\image.bmp");//color image
  reader->Update();
   
  unsigned char* buffer = reader->GetOutput()->GetBufferPointer();
   
  what does contain buffer? Is its elements RED(or GREEN or BLUE) channel of color image?
  As I know it isn't so. In that case how is obtained these values?
   
   
  Albert
   
   
   
   
  

Chris Farmer <cfarmer at scitegic.com> wrote:
  

Hi Albert,

Check out the itk::RGBPixel type. If you use RGBPixel as the template type of your itk::Image, then you'll get access to the R, G, and B channels in your image. There are some good sections on this early in the ITK software guide. You're right that many ITK operations are not available to RGB images. You could flatten your images to a scalar pixel type with the RGBToLuminanceImageFilter or treat it as a vector image with the RGBToVectorImageAdaptor. There are at least a few messages in the very recent past from the list that mention these classes, and there are some examples in the ITK source distribution that show how you can work with RGB images.


Chris




 
-----Original Message-----
From: Albert Chitemyan [mailto:abbs_c at yahoo.com] 
Sent: Tuesday, November 29, 2005 11:26 PM
To: insight-users at itk.org
Subject: [Insight-users] How does ITK covert color image into grayscaleimage?

Hi all,
 
As far as I know ITK's most classes are dealing with grayscale images.
How does ImageFileReader read pixel values from color image?. 
Does it take only one component(e.g. red) of RGB, or copmute pixel value using those 3 components?(grayscale pixel value = R*a + G*b + B*c).
 
Thanks.
 
Albert
 
 

Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
Click here to report this email as spam.
  


		
---------------------------------
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20051130/35b894ea/attachment.html


More information about the Insight-users mailing list