Ask Your Question

Revision history [back]

see the documentation you don't need to copy data

see the documentation you don't need to copy data

try

cv::Mat img( 2048, 2048, CV_16U, bufframe.buf);

see the documentation you don't need to copy data

try

cv::Mat img( 2048, 2048, CV_16U, bufframe.buf);
// ushort* pointer_to_data_start = img.ptr<ushort>();
// memcpy(pointer_to_data_start, bufframe.buf, bufframe.height * bufframe.rowbytes);
imshow("image", img);

see the documentation you don't need to copy data

try

cv::Mat img( 2048, 2048, CV_16U, bufframe.buf);
bufframe.buf );
// ushort* pointer_to_data_start = img.ptr<ushort>();
img.ptr<ushort>();  
// memcpy(pointer_to_data_start, bufframe.buf, bufframe.height * bufframe.rowbytes);
imshow("image", img);
cv::imshow( "image", img );
cv::waitKey( 30 );

Please see the documentation . you You don't need to copy data

try

cv::Mat img( 2048, 2048, CV_16U, bufframe.buf );
// ushort* pointer_to_data_start = img.ptr<ushort>();  
// memcpy(pointer_to_data_start, bufframe.buf, bufframe.height * bufframe.rowbytes);
cv::imshow( "image", img );
cv::waitKey( 30 );

Please see the documentation. You don't need to copy data

try

cv::Mat img( 2048, 2048, CV_16U, bufframe.buf );
// ushort* pointer_to_data_start = img.ptr<ushort>();  
// memcpy(pointer_to_data_start, bufframe.buf, bufframe.height * bufframe.rowbytes);
cv::imshow( "image", img );
cv::waitKey( 30 );

note: (as stated in the documentation ) The external data is not automatically deallocated, so you should take care of it.