我用stereoBM计算深景图 总是出现系统报错 求各位大神看看是什么原因 有什么解决办法
程式如下:
#include "opencv2/core/core.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
//#include "opencv2/contrib/contrib.hpp"
#include <stdio.h>
#include <string.h>
using namespace cv;
using namespace std;
int main(int argc, char* argv[])
{
cv::Mat leftimg = cv::imread("left1.jpg");
cv::Mat rightimg = cv::imread("right1.jpg");
cv::Size imagesize = leftimg.size();
cv::Mat g1, g2, disp, disp8;
cv::cvtColor(leftimg, g1, cv::COLOR_BGR2GRAY);
cv::cvtColor(rightimg, g2, cv::COLOR_BGR2GRAY);
StereoBM *sbm = StereoBM::create(16, 2);
sbm->setDisp12MaxDiff(1);
sbm->setSpeckleRange(8);
sbm->setSpeckleWindowSize(0);
sbm->setUniquenessRatio(0);
sbm->setTextureThreshold(507);
sbm->setMinDisparity(-39);
sbm->setPreFilterCap(61);
sbm->setPreFilterSize(5);
sbm->compute(g1, g2, disp);
normalize(disp, disp8, 0, 255, CV_MINMAX, CV_8U);
cv::imshow("left", leftimg);
cv::imshow("right", rightimg);
cv::imshow("disp", disp8);
waitKey(0);
return(0);
}
报错提示如下图
谢谢了
程式如下:
#include "opencv2/core/core.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
//#include "opencv2/contrib/contrib.hpp"
#include <stdio.h>
#include <string.h>
using namespace cv;
using namespace std;
int main(int argc, char* argv[])
{
cv::Mat leftimg = cv::imread("left1.jpg");
cv::Mat rightimg = cv::imread("right1.jpg");
cv::Size imagesize = leftimg.size();
cv::Mat g1, g2, disp, disp8;
cv::cvtColor(leftimg, g1, cv::COLOR_BGR2GRAY);
cv::cvtColor(rightimg, g2, cv::COLOR_BGR2GRAY);
StereoBM *sbm = StereoBM::create(16, 2);
sbm->setDisp12MaxDiff(1);
sbm->setSpeckleRange(8);
sbm->setSpeckleWindowSize(0);
sbm->setUniquenessRatio(0);
sbm->setTextureThreshold(507);
sbm->setMinDisparity(-39);
sbm->setPreFilterCap(61);
sbm->setPreFilterSize(5);
sbm->compute(g1, g2, disp);
normalize(disp, disp8, 0, 255, CV_MINMAX, CV_8U);
cv::imshow("left", leftimg);
cv::imshow("right", rightimg);
cv::imshow("disp", disp8);
waitKey(0);
return(0);
}
报错提示如下图
谢谢了