【发布时间】:2017-04-18 22:03:48
【问题描述】:
我无法运行这个简单的代码。我正在尝试计算 2 张图片之间的光流。
请查看附件图片
OpenCV 错误:断言失败 (prev0.size() == next0.size() && prev0.channels() == next0.channels() && prev0.channels() == 1 && pyrScale_
#include <Windows.h>
#include "opencv2\highgui.hpp"
#include "opencv2\imgproc.hpp"
#include "opencv2\objdetect\objdetect.hpp"
#include "opencv2/video/tracking.hpp"
#include <vector>
#include <stdio.h>
#include <Windows.h>
#include <iostream>
using namespace std;
using namespace cv;
// Display the results of the matches
//
int main(int argc, char* argv[])
{
cv::Mat img1 = cv::imread(argv[1], cv::IMREAD_GRAYSCALE);
cv::Mat img2 = cv::imread(argv[2], cv::IMREAD_GRAYSCALE);
cv::Mat res;
cv::calcOpticalFlowFarneback(img1,img2,img1,.4,1,12,2,8,1.2, 0);
cv:imshow("cat", res);
cv::waitKey(0);
}
【问题讨论】:
标签: c++ visual-studio opencv opticalflow