我正在从BlackMagic Decklink捕获卡调用帧,并尝试将其转换为
cv::Mat
.
我有这个功能,但是结果的框架如下:
当它们看起来像这样时:
传入的帧是有效的,因此它必须是我的转换。基于此问题:
Getting left and right frames with BlackMagic SDK and convert them into opencv mat
我正在使用:
bool deckLinkVideoFrameToCvMat(ComPtr<IDeckLinkVideoInputFrame> in,
cv::Mat& out)
{
void* data;
if (FAILED(in->GetBytes(&data))) {
std::cout << "Fail obtaining the data from videoFrame\n" << std::endl;
return S_FALSE;
}
cv::Mat loadedImage;
cv::Mat mat = cv::Mat(in->GetHeight(), in->GetWidth(), CV_8UC2, data, in->GetRowBytes());
cv::cvtColor(mat, loadedImage, CV_YUV2BGR_UYVY);
loadedImage.copyTo(out);
return true;
}
我哪里出错了?
编辑:删除步幅参数,如建议所示: