opencv Bitmap to cv::Mat?

Hey all, I am streaming video from an ethernet camera into an opencv c++ application, and need to use the camera's SDK to get the image.

The example code calls each frame, then rasterizes it to a Bitmap withn a command: frame->Rasterize->framebuffer.

All my other code though, uses a Mat image. (Mat InputImage)

What would be the best and/or fastest way to convert the incoming bitmaps to Mat with opencv?  (in c++)

Thanks for your help!
Who is Participating?
chemicalx001Author Commented:
I ended up using the camera SDK header file, there was a function in it to convert.

As here:

Can you show your sample code? The 'Mat' ctor 'Mat::Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP);' ( should handle that for you, e.g,

    cv::Mat mat(image_hight, image_width, frame->Rasterize->framebuffer, CV_8UC3);

Open in new window

chemicalx001Author Commented:
a custom third party SDK function was the answer.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.