【问题标题】:Image height is halved after transformation from VideoCapture to Mat object从 VideoCapture 转换为 Mat 对象后,图像高度减半
【发布时间】:2018-11-08 14:21:17
【问题描述】:

我做的操作很简单:

我读取了一个尺寸为 1280x720 的 .avi 文件,将一帧视频存储到一个 Mat 对象并显示它。

下面是部分代码:

VideoCapture capL;
capL.open("F:/renderoutput/cube/left.avi");
Mat frameL;
cout << capL.get(CAP_PROP_FRAME_WIDTH) << ", " << capL.get(CAP_PROP_FRAME_HEIGHT) << endl;

for (;;)
{
    capL.read(frameL);
    cout << frameL.size() << endl;
    if (frameL.empty())
        break;

    imshow("Output", frameL);
    waitKey(200);
}
......

但是capL和frameL的尺寸不一样,前者为1280x720,后者为1280x360。为什么会这样?我在 Visual Studio 中使用 OpenCV 3.3.1 已经有很长一段时间了,有一天这发生了。

【问题讨论】:

    标签: c++ image visual-studio opencv


    【解决方案1】:

    视频很可能是隔行扫描的。所以你在每一帧中只有一半的高度。

    【讨论】:

      猜你喜欢
      • 2017-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-27
      • 2020-09-15
      • 2015-01-21
      • 2015-09-23
      • 2015-02-17
      相关资源
      最近更新 更多