Sign in to follow this  

Displaying 16 bit raw images

This topic is 3118 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If I have an array of data (16 bit values) that represent pixel intensity (in other words a grayscale image), can anyone tell me how to display this data in a picture box in an MFC application? If the code is long or complicated I guess don't worry about it, but it seems like a simple thing that I've just spent way too much time digging around trying to solve. Thanks, Andrew

Share this post


Link to post
Share on other sites
I'm not much in the MFC, but AFAIK you have a Paint event for the picture box.
In it, you can do a blit to the HWND with the data, but I guess you'll need some data transforming before.

I would create a bitmap in memory. I'm not sure if there's an standard 16 bits greyscale bmp, but you can always do:


unsigned char R,G,B;
for (i = 0; i < ArraySize; i++)
{
int Luminance = Array[i] * 256 / 65535;
R = G = B = Luminance;
...
}


And fill up a BitmapInfo structure with these values.
http://msdn.microsoft.com/en-us/library/aa921550.aspx

Share this post


Link to post
Share on other sites

This topic is 3118 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this