1 | initial version |
sure this should be possible !
caller need to malloc the buffer, make sure the size is big enough
assuming you know width, height, and num_channels, you can prealloc a cv::Mat:
// setup data:
Mat frame(height, width, CV_8UC1); // grayscale, CV_8UC3 for bgr data
long iBuffSize = frame.total() * frame.elemSize(); // pls check if it fits your expectation !
// acquire image, using Mat::data ptr (uchar as well):
auto res = ASIGetVideoData(iCameraID, frame.data, lBuffSize, iWaitms);
// IF it is a 3 channel img, AND it is in RGB order (look it up),
// you *might* need to convert to BGR (preferred channel order in opencv)
// cvtColor(frame, frame, COLOR_RGB2BGR);
2 | No.2 Revision |
sure this should be possible !
caller need to malloc the buffer, make sure the size is big enough
assuming you know width, height, and num_channels, you can prealloc a cv::Mat:
// setup data:
8bit grayscale, CV_8UC3 for bgr data, CV_16U for 16bit gray
Mat frame(height, width, CV_8UC1); // grayscale, CV_8UC3 for bgr data
long iBuffSize = frame.total() * frame.elemSize(); // pls check if it fits your expectation !
// acquire image, using Mat::data ptr (uchar as well):
auto res = ASIGetVideoData(iCameraID, frame.data, lBuffSize, iWaitms);
// IF it is a 3 channel img, AND it is in RGB order (look it up),
// you *might* need to convert to BGR (preferred channel order in opencv)
// cvtColor(frame, frame, COLOR_RGB2BGR);
3 | No.3 Revision |
sure this should be possible !
caller need to malloc the buffer, make sure the size is big enough
assuming you know width, height, and num_channels, the data format, you can prealloc a cv::Mat:
// 8bit grayscale, CV_8UC3 for bgr data, CV_16U for 16bit gray
Mat frame(height, width, CV_8UC1);
long iBuffSize = frame.total() * frame.elemSize(); // pls check if it fits !
// acquire image, using Mat::data ptr (uchar as well):
auto res = ASIGetVideoData(iCameraID, frame.data, lBuffSize, iWaitms);
// IF it is a 3 channel img, AND it is in RGB order (look it up),
// you *might* need to convert to BGR (preferred channel order in opencv)
// cvtColor(frame, frame, COLOR_RGB2BGR);
4 | No.4 Revision |
sure this should be possible !
caller need to malloc the buffer, make sure the size is big enough
assuming you know width, height, and the data format, you can prealloc a cv::Mat:
// 8bit grayscale, CV_8UC3 for bgr data, CV_16U for 16bit gray
Mat frame(height, width, CV_8UC1);
long iBuffSize = frame.total() * frame.elemSize(); // pls check if it fits !
// acquire image, using Mat::data ptr (uchar as well):
auto res = ASIGetVideoData(iCameraID, frame.data, lBuffSize, iWaitms);
// IF it is a 3 channel img, AND it is in RGB order (look it up),
// you *might* need to convert to BGR (preferred channel order in opencv)
// cvtColor(frame, //cvtColor(frame, frame, COLOR_RGB2BGR);
5 | No.5 Revision |
sure this should be possible !
caller need to malloc the buffer, make sure the size is big enough
assuming you know width, height, and the data format, you can prealloc a cv::Mat:cv::Mat
(it's also a refcounted smartptr, so you don't have to worry about freeing the memory):
// 8bit grayscale, CV_8UC3 for bgr data, CV_16U for 16bit gray
Mat frame(height, width, CV_8UC1);
long iBuffSize = frame.total() * frame.elemSize(); // pls check if it fits !
// acquire image, using Mat::data ptr (uchar as well):
auto res = ASIGetVideoData(iCameraID, frame.data, lBuffSize, iWaitms);
// IF it is a 3 channel img, AND it is in RGB order (look it up),
// you *might* need to convert to BGR (preferred channel order in opencv)
//cvtColor(frame, frame, COLOR_RGB2BGR);
6 | No.6 Revision |
sure this should be possible !
caller need to malloc the buffer, make sure the size is big enough
assuming you know width, height, and the data format, you can prealloc a cv::Mat
(it's also a refcounted smartptr, so you don't have to worry about freeing the memory):
// 8bit CV_8U :8bit grayscale, CV_8UC3 for bgr data, :bgr, CV_16U for 16bit :16bit gray
Mat frame(height, width, CV_8UC1);
long iBuffSize = frame.total() * frame.elemSize(); // pls check if it fits !
// acquire image, using Mat::data ptr (uchar as well):
auto res = ASIGetVideoData(iCameraID, frame.data, lBuffSize, iWaitms);
// IF it is a 3 channel img, AND it is in RGB order (look it up),
// you *might* need to convert to BGR (preferred channel order in opencv)
//cvtColor(frame, frame, COLOR_RGB2BGR);