Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

1. convert cv::Mat to CvMat

cv::Mat img = ...;

CvMat des_img(img);

2. convert CvMat to Gdk::Pixbuf

auto img_buf = Gdk::Pixbuf::create_from_data(des_img.data.ptr, Gdk::COLORSPACE_RGB, false, 8, des_img.rows, des_img.cols, des_img.step)

NOTE: CvMat is defined in opencv2/core/types_c.h header file. It may work...

click to hide/show revision 2
No.2 Revision

1. convert cv::Mat to CvMatCvMat:

cv::Mat img = ...;

...;

CvMat des_img(img);

des_img(img);

2. convert CvMat to Gdk::PixbufGdk::Pixbuf:

auto img_buf = Gdk::Pixbuf::create_from_data(des_img.data.ptr, Gdk::COLORSPACE_RGB, false, 8, des_img.rows, des_img.cols, des_img.step)

des_img.step)

NOTE: CvMat CvMat is defined in opencv2/core/types_c.h header file. It may work...