From 11a5e7804229871f3aaf05563ef79cfd43ccd077 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 31 Oct 2011 12:39:06 +0000 Subject: [PATCH] fixed gpu samples build --- samples/gpu/hog.cpp | 2 +- samples/gpu/morfology.cpp | 14 ++++++++++++-- samples/gpu/stereo_match.cpp | 12 ++++++------ samples/gpu/surf_keypoint_matcher.cpp | 4 ++-- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/samples/gpu/hog.cpp b/samples/gpu/hog.cpp index 5c9f1c23da..87dbd72dd7 100644 --- a/samples/gpu/hog.cpp +++ b/samples/gpu/hog.cpp @@ -312,7 +312,7 @@ void App::run() hogWorkBegin(); if (use_gpu) { - gpu_img = img; + gpu_img.upload(img); gpu_hog.detectMultiScale(gpu_img, found, hit_threshold, win_stride, Size(0, 0), scale, gr_threshold); } diff --git a/samples/gpu/morfology.cpp b/samples/gpu/morfology.cpp index ded2ddfa76..871266100e 100644 --- a/samples/gpu/morfology.cpp +++ b/samples/gpu/morfology.cpp @@ -61,8 +61,18 @@ void ErodeDilate(int, void*) int main( int argc, char** argv ) { char* filename = argc == 2 ? argv[1] : (char*)"baboon.jpg"; - if(string(argv[1]) == "--help" || (src = imread(filename,1)).data == 0) - return help(), -1; + if (string(argv[1]) == "--help") + { + help(); + return -1; + } + + src.upload(imread(filename, 1)); + if (src.empty()) + { + help(); + return -1; + } help(); diff --git a/samples/gpu/stereo_match.cpp b/samples/gpu/stereo_match.cpp index 251645ec9f..1dce494cdf 100644 --- a/samples/gpu/stereo_match.cpp +++ b/samples/gpu/stereo_match.cpp @@ -162,8 +162,8 @@ void App::run() if (right_src.empty()) throw runtime_error("can't open file \"" + p.right + "\""); cvtColor(left_src, left, CV_BGR2GRAY); cvtColor(right_src, right, CV_BGR2GRAY); - d_left = left; - d_right = right; + d_left.upload(left); + d_right.upload(right); imshow("left", left); imshow("right", right); @@ -193,8 +193,8 @@ void App::run() cvtColor(left_src, left, CV_BGR2GRAY); cvtColor(right_src, right, CV_BGR2GRAY); cout << "image_channels: " << left.channels() << endl; - d_left = left; - d_right = right; + d_left.upload(left); + d_right.upload(right); imshow("left", left); imshow("right", right); } @@ -262,8 +262,8 @@ void App::handleKey(char key) cvtColor(left_src, left, CV_BGR2GRAY); cvtColor(right_src, right, CV_BGR2GRAY); } - d_left = left; - d_right = right; + d_left.upload(left); + d_right.upload(right); cout << "image_channels: " << left.channels() << endl; imshow("left", left); imshow("right", right); diff --git a/samples/gpu/surf_keypoint_matcher.cpp b/samples/gpu/surf_keypoint_matcher.cpp index f9c5f40ce4..b020408f63 100644 --- a/samples/gpu/surf_keypoint_matcher.cpp +++ b/samples/gpu/surf_keypoint_matcher.cpp @@ -28,12 +28,12 @@ int main(int argc, char* argv[]) { if (string(argv[i]) == "--left") { - img1 = imread(argv[++i], CV_LOAD_IMAGE_GRAYSCALE); + img1.upload(imread(argv[++i], CV_LOAD_IMAGE_GRAYSCALE)); CV_Assert(!img1.empty()); } else if (string(argv[i]) == "--right") { - img2 = imread(argv[++i], CV_LOAD_IMAGE_GRAYSCALE); + img2.upload(imread(argv[++i], CV_LOAD_IMAGE_GRAYSCALE)); CV_Assert(!img2.empty()); } else if (string(argv[i]) == "--help")