I have tried to convert peak::ipl::Image to cv::Mat but dont find a method.
This proyect is implemented with C++.
while(true){
// Get buffer from device's DataStream. Wait 5000 ms. The buffer is automatically locked until it is queued again.
const auto buffer = dataStream->WaitForFinishedBuffer(5000);
const auto image = peak::ipl::Image(peak::BufferTo<peak::ipl::Image>(buffer));
const auto imageProcessed = image.ConvertTo(peak::ipl::PixelFormatName::BGRa8,peak::ipl::ConversionMode::Fast);
//Convert
//cv::Mat imageMat = imageProcessed???
// Queue buffer again
dataStream->QueueBuffer(buffer);
}
IDS peak provie a example for QImage but it's unuse to me.
I'v tried pass image.Data() to constructor method, but ilp::Image work with uint8_t* and opencv with uchar*.
I know that QImage work well but I dont want include it only to catch the images and then convert it to Mat.
Also, I'v search for a method to convert ids buffer to cv::Mat directly, but nothing appears.
To specify the total size of the Mat matrix, one should multiply newImage.total() by newImage.elemSize(). If the image is to be transformed into peak::ipl::PixelFormatName::BGRa8, the created image (cv::Mat) should have sizes four times larger than the original buffer.
Furthermore, one can first create the ipl::Image and then pass the data to the Mat constructor: