[Insight-users] Determine if BMP is color or grayscale
Sébastien Fricker
sebastien.fricker at phaseview.net
Tue Oct 23 02:53:43 EDT 2007
Dear ITK users,
How can I determine if a BMP image is 8 bits grayscale or 24 bits RGB?
I was able to use an ImageIO to read image information, but I cant seem to
access the bit depth information (m_Depth being private).
I would like to write an application that can open and process grayscale or
color images, then save the output as grayscale or color.
Color images are processed differently (they are treated as vector images)
so I need to differentiate them.
Here is a sample of my code:
itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(
fileName.c_str(), itk::ImageIOFactory::ReadMode );
imageIO->SetFileName( fileName );
imageIO->ReadImageInformation();
imageIO->GetComponentType() returns UCHAR in both cases.
imageIO->GetNumberOfComponents() returns 3 in both cases.
Thanks for your help,
Sébastien Fricker
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20071023/1d0a38f8/attachment.htm
More information about the Insight-users
mailing list