Click here to Skip to main content
15,905,967 members

Comments by kodmail (Top 5 by date)

kodmail 2-Jan-14 3:24am View    
i_tmp = (int)(floating_radar_data * 16777216 / 256); //values are very small

byte_data1D[i * 3 + 2] = (byte)((i_tmp & 0xFF0000) >> 16);
byte_data1D[i * 3 + 1] = (byte)((i_tmp & 0xFF00) >> 8);
byte_data1D[i * 3 + 0] = (byte)((i_tmp & 0xFF) >> 0);

Bitmap bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
kodmail 2-Jan-14 2:59am View    
16 bit radar data. This data scale 0 - 65536 values and type UInt16.
kodmail 26-Dec-13 10:54am View    
data is 16bit
kodmail 26-Dec-13 3:49am View    
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);
}
kodmail 26-Dec-13 3:46am View    
not camera data just ushort 16bit data, raw data: 512*512 16 bit ushort data just it. Like this in link.