Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

How to use templatematching cuda 7.5 and opencv 3.1

$
0
0
Hi, I try to use template matching in c++ but it doesn't work. when I use this program, an error occur ![image description](/upfiles/14752421676842828.png) /***********************************************/ #include "opencv2/highgui/highgui.hpp" //#include "opencv2/imgproc/imgproc.hpp" #include "opencv2/cudaimgproc.hpp" #include #include using namespace std; using namespace cv; /// Global Variables Mat img; Mat templ; Mat result; Mat img2; //cuda::GpuMat img; cuda::GpuMat templ; cuda::GpuMat result; cuda::GpuMat img2; char* image_window = "Source Image"; char* result_window = "Result window"; int match_method; int max_Trackbar = 5; /// Function Headers void MatchingMethod(int, void*); /** @function main */ int main(int argc, char** argv) { /// Load image and template img = imread("../data/lena.jpg"); templ = imread("../data/eye.jpg"); /// Create windows namedWindow(image_window, CV_WINDOW_AUTOSIZE); namedWindow(result_window, CV_WINDOW_AUTOSIZE); imshow(image_window, img); //cuda::TemplateMatching *b; cv::Ptr b; b = cuda::createTemplateMatching(CV_32F, CV_TM_CCORR);// , Size(0, 0)); b->match(img_Gpu, templ_Gpu, result_Gpu);//<--- this line create a bug //double minVal; double maxVal; Point minLoc; Point maxLoc; //Point matchLoc; //minMaxLoc(result, &minVal, &maxVal, &minLoc, &maxLoc, Mat()); //rectangle(result, matchLoc, Point(matchLoc.x + templ.cols, matchLoc.y + templ.rows), Scalar::all(0), 2, 8, 0); imshow(result_window, img); waitKey(0); return 0; } Can you help me? thank you CONF-->GTX980M 16G RAM W10 VS2013

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>