Instant Display

I am now writing a GUI program using LibRaw with C++, Visual Studio. I would like to display the RAW images (14-bit or 16-bit) instantly in the GUI window, say, a PictureBox. However I cannot find a function that can help me to draw and display the image. I can get the R,G1,G2,B data from imgdata array though. Is there any functions from libraw or functions of Windows built-in that can help me to draw RAW images?

On the other hand, how can I get the information of Histogram and Level of the image by using Libraw??


LibRaw does not contain any

LibRaw does not contain any drawing code. You need to implement it yourself.

Histograms are calculated for auto-brightness code, but these histograms are not intended to use in external application:
- histograms calculated before white balance and brightness applied
- the actual pixel value is divided by 8 to make histograms compact.

-- Alex Tutubalin

I finally can display the

I finally can display the image using LibRaw together with OpenCV. However, I found that it is okay to display .CR2 files of 5D Mark III but .CR2 files of 5D Mark II. It gives a error:
"An unhandled exception of type 'System.ArgumentException' occurred in System.Drawing.dll
Additional information: Parameter is not valid."
Is there any difference between the .CR2 files of 5D Mark II and Mark III?

My code is:

int check = Processor1->dcraw_process();
//process the image into memory buffer
libraw_processed_image_t *image = Processor1->dcraw_make_mem_image(&check);

//create a Mat object by data obtained from LibRaw
cv::Mat cvImage(cv::Size(image->width, image->height), CV_8UC3, image->data, cv::Mat::AUTO_STEP);

cv::cvtColor(cvImage, cvImage, CV_RGB2BGR); //Convert RGB to BGR

IntPtr ptr(cvImage.ptr()); //create a pointer based on the Mat object image

//Error occurs in the following statement, the last line with 'ptr'
Bitmap^ b = gcnew Bitmap(cvImage.cols,
ptr); //bitmap object of the image

I'm not OpenCV specialist, so

I'm not OpenCV specialist, so I cannot help with OpenCV/System.drawing errors.

-- Alex Tutubalin