我在尝试从 cv::Mat 转换为 gpu::Mat 时遇到问题。我正在使用 VS2012 Win7 x64。
这是代码:
#include "opencv2/imgproc/imgproc.hpp"
#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
#include <opencv2\gpu\gpu.hpp>
#include "cv.h"
#include "cxcore.h"
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
using namespace cv;
using namespace cv::gpu;
int main () {
Mat src = cv::imread("pic1.jpg");
gpu::GpuMat d_src, d_dst;
d_src.upload(src);
gpu::bilateralFilter(d_src,d_dst, -1, 50, 7 );
gpu::Canny(d_dst, d_dst, 35, 200, 3);
Mat dst(d_dst);
imwrite("out.jpg", dst);
return 0;
}
我使用了很多包含,因为在同一个文件中我声明了其他函数。
这是我包含的 lib 文件:
opencv_core246d.lib
opencv_imgproc246d.lib
opencv_highgui246d.lib
opencv_ml246d.lib
opencv_video246d.lib
opencv_features2d246d.lib
opencv_calib3d246d.lib
opencv_objdetect246d.lib
opencv_contrib246d.lib
opencv_legacy246d.lib
opencv_flann246d.lib
opencv_nonfree246d.lib
opencv_photo246d.lib
opencv_stitching246d.lib
opencv_superres246d.lib
opencv_ts246d.lib
这是我尝试编译时得到的
First-chance exception at 0x000007FEFDD29E5D in CVtest.exe: Microsoft C++ exception: cv::Exception at memory location 0x000000000025F8D0.
First-chance exception at 0x000007FEFDD29E5D in CVtest.exe: Microsoft C++ exception: cv::Exception at memory location 0x000000000025F8D0.
Unhandled exception at at 0x000007FEFDD29E5D in CVtest.exe: Microsoft C++ exception: cv::Exception at memory location 0x000000000025F8D0.
The program '[6592] CVtest.exe' has exited with code -1073741510 (0xc000013a).
每当我尝试在 Mat 和 gpuMat 之间切换时,它都会显示。
我该如何解决这个问题?