Hi folks
I’m working on SDK for insta360 camera.
this is the repository for the sdk
The provided sdk has a live stream mode that create and write the stream into a h.h264 file.
This is the function responsible to write the data into a file:
void OnVideoData(const uint8_t* data, size_t size, int64_t timestamp, uint8_t streamType, int stream_index = 0) override {}
My question is about how to display those images stored into the pointer ‘data’ .
I tried
void OnVideoData(const uint8_t* data, size_t size, int64_t timestamp, uint8_t streamType, int stream_index = 0) override {
// Create a cv::Mat object from the data pointer
cv::Mat encodedImage(1, size, CV_8UC1, const_cast<uint8_t*>(data));
imgDecoded = imdecode(encodedImage,IMREAD_ANYCOLOR);
cv::imshow("Decoded Image", imgDecoded);
cv::waitKey(1);
}
but got the error terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.2.0) ../modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'
any one could give me a hint about how display those frames.
I would like to use pure OpenCV. However, I’m open to use FFmpeg, but I just have a zero experience with FFmpeg.
thakyou