From 54089499516e81a6a2d261129451f79324a74a83 Mon Sep 17 00:00:00 2001 From: Markus Heck Date: Fri, 9 Sep 2022 15:27:11 +0200 Subject: [PATCH] fix typo and simplify example (grayscale template) --- .../generalized_hough_ballard_guil.markdown | 2 +- .../objectDetection/generalizedHoughTransform.cpp | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/tutorials/objdetect/generalized_hough_ballard_guil/generalized_hough_ballard_guil.markdown b/doc/tutorials/objdetect/generalized_hough_ballard_guil/generalized_hough_ballard_guil.markdown index b6f1479172..c5dc2590af 100644 --- a/doc/tutorials/objdetect/generalized_hough_ballard_guil/generalized_hough_ballard_guil.markdown +++ b/doc/tutorials/objdetect/generalized_hough_ballard_guil/generalized_hough_ballard_guil.markdown @@ -8,7 +8,7 @@ Object detection with Generalized Ballard and Guil Hough Transform {#tutorial_ge Goal ---- -In this tutorial you will lern how to: +In this tutorial you will learn how to: - Use @ref cv::GeneralizedHoughBallard and @ref cv::GeneralizedHoughGuil to detect an object diff --git a/samples/cpp/tutorial_code/objectDetection/generalizedHoughTransform.cpp b/samples/cpp/tutorial_code/objectDetection/generalizedHoughTransform.cpp index 2630dc1f6e..dca52b1339 100644 --- a/samples/cpp/tutorial_code/objectDetection/generalizedHoughTransform.cpp +++ b/samples/cpp/tutorial_code/objectDetection/generalizedHoughTransform.cpp @@ -12,14 +12,12 @@ using namespace std; int main() { //! [generalized-hough-transform-load-and-setup] -// load source images +// load source image and grayscale template Mat image = imread("images/generalized_hough_mini_image.jpg"); - Mat imgTemplate = imread("images/generalized_hough_mini_template.jpg"); + Mat templ = imread("images/generalized_hough_mini_template.jpg", IMREAD_GRAYSCALE); -// create grayscale image and template - Mat templ = Mat(imgTemplate.rows, imgTemplate.cols, CV_8UC1); +// create grayscale image Mat grayImage; - cvtColor(imgTemplate, templ, COLOR_RGB2GRAY); cvtColor(image, grayImage, COLOR_RGB2GRAY); // create variable for location, scale and rotation of detected templates