.net - Copying a 14bit grayscale image (saved in long[]) to a pictureBox -


I'm assuming 4 bytes)

My application has been written in C ++ / CLI, and the picture box is of .NET type.
I am currently using BitmapData to get Pointer access to image data in lockbits () , and memcpy (bmpData.Scan0.ToPointer (), image data, Size to size (long) * Height * Width to use mechanism
To copy image data in bitmap.
For now, only pixel format is 32bit RGB, and the image is shaped Appears in blue with

to start the bitmap as 16bpp Trying GRrayscale is not working.
I would ideally prefer to use the array and 16bit format for longer term (hopefully 14bit data will be displayed properly) but I'm not sure that this Besides, I do not want to overuse the image data, so knowing minimum / maximum and then histogram dragging [0..255] there is no option for me (performance should be as efficient as possible)

Thanks

Yes, they will appear in very blue, some color of green for high-intensity pixels Close is a pixel format mismatch, 32bppRgb is a byte for blue, one for green, one for red and one unused byte. By making a straight copy of the gray image, the blue byte will be set to 6 bit green in color.

16bppGrayScale would be great, if only GDI + has actually supported it, the problem is that no main-stream video adapter handles this format. You have to translate the pixel values ​​into RGB triplets. To make it gray, you have to set the blue, green and red bytes at the same value. This will be a lossy conversion because you need to squeeze 14 bits in 8 bits. It does not really matter, the human eye is not nearly enough enough to be able to distinguish 16,384 different gray levels. Move the 6-pixel value accurately, assuming the camera produces a pixel value of 16383 for high bright pixels. Either a 24bppRgb or 32bppRgb pixel format will work, the latter will be faster as it is an int fit and you do not need a monkey with a monkey.

Note that the wrong color image is also possible, you can arbitrarily map a 14-bit gray value to Color. The fastest way to do this is by using the [16384] mapping table, which you stick in the table, it is entirely up to you, normal mapping is dark red for low intensity, purple for high intensity values.

It's great for image display. However, if you do any image processing, you probably would like to take advantage of the camera's resolution. You must stay away from bitmap by watching graphics library vendors like LeadTools.


Comments