Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have 512*512 16 bit raw 'Lena' data I wanna show this data 24bit or 32bit depth colored image. I use C#.

I show this data 16 bit gray scale;
gray scale 16bit depth Lena

but I wanna show colored image as the given link colored Lena
Posted
Comments
BillWoodruff 26-Dec-13 3:44am    
When you say "raw data," do you mean the RAW files made available by many digital cameras ? And you do know that RAW format varies from device to device, although there are some companies attempting to set a standard ... like Adobe's "Adobe Camera Raw" ?

http://en.wikipedia.org/wiki/Raw_image_format

http://en.wikipedia.org/wiki/Adobe_Camera_Raw#Plugins

You are dealing with a source image with color information, not a gray-scale image ... correct ?
kodmail 26-Dec-13 3:46am    
not camera data just ushort 16bit data, raw data: 512*512 16 bit ushort data just it. Like this in link.
BillWoodruff 26-Dec-13 4:52am    
Okay, is your source image data in 16bit color ?
kodmail 26-Dec-13 10:54am    
data is 16bit
kodmail 26-Dec-13 3:49am    
this code return gray scale 24 bit depth image:
private void CreateBitmap()
{
bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
BitmapData bmd = bmp.LockBits(new Rectangle(0, 0, width, height),
System.Drawing.Imaging.ImageLockMode.ReadOnly, bmp.PixelFormat);

// This 'unsafe' part of the code populates the bitmap bmp with data stored in pixel16.
// It does so using pointers, and therefore the need for 'unsafe'.
unsafe
{
int pixelSize = 3;
int i, j, j1, i1;
byte b;
ushort sVal;
double lPixval;

for (i = 0; i < bmd.Height; ++i)
{
byte* row = (byte*)bmd.Scan0 + (i * bmd.Stride);
i1 = i * bmd.Height;

for (j = 0; j < bmd.Width; ++j)
{
sVal = (ushort)(pixels16[i1 + j]);
lPixval = (sVal / 255.0); // Convert to a 255 value range
if( lPixval > 255 ) lPixval = 255;
if( lPixval < 0 ) lPixval = 0;
b = (byte)(lPixval);
j1 = j * pixelSize;
row[j1] = b; // Red
row[j1 + 1] = b; // Green
row[j1 + 2] = b; // Blue
}
}
}
bmp.UnlockBits(bmd);
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900