From 27ca72fe18ce0638a7e64eb13b3c71df09ce71f6 Mon Sep 17 00:00:00 2001 From: Martin Miller Date: Tue, 31 Aug 2021 22:23:46 -0400 Subject: Changes so that I can build in 2021 Needed to use the cv namespace for some defines when building with the default opencv4 development library provided with Fedora --- src/main.cpp | 1 + src/vision.cpp | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f1bcd30..1c91692 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -419,6 +419,7 @@ parseLine(char *line, message *data) fprintf(stderr, "Message type %s is unknown, quitting.\n", msg_type); exit(1); } + return 0; } /* diff --git a/src/vision.cpp b/src/vision.cpp index 0f2b4f9..8cdd3bc 100644 --- a/src/vision.cpp +++ b/src/vision.cpp @@ -47,10 +47,10 @@ Vision::open ( const char *fn, const Camera &cam ) fprintf(stderr, "Could not read %s.\n", fn); exit(1); } - cv::cvtColor(bayered, unbayered, CV_BayerBG2BGR ,3); + cv::cvtColor(bayered, unbayered, cv::COLOR_BayerBG2BGR ,3); cv::undistort( unbayered, undistorted, cam.K(1), cam.d(1)); undistorted.convertTo(original, CV_32FC3); - cv::cvtColor(original, gray, CV_BGR2GRAY); + cv::cvtColor(original, gray, cv::COLOR_BGR2GRAY); display = undistorted.clone(); return ; } /* ----- end of method Vision::open ----- */ @@ -259,9 +259,9 @@ Vision::measure ( const Camera &cam, const measurement_t &zin, measurement_t &zo Mat result; result.create( sr.cols-zin.patch.cols+1, sr.rows-zin.patch.rows+1, CV_32FC1 ); if (zin.z_type==MONO) { - matchTemplate( sr, zin.patch, result, CV_TM_CCOEFF_NORMED); + matchTemplate( sr, zin.patch, result, cv::TM_CCOEFF_NORMED); } else { - matchTemplate( sr, zin.refpatch, result, CV_TM_CCOEFF_NORMED); + matchTemplate( sr, zin.refpatch, result, cv::TM_CCOEFF_NORMED); } // Mask the ellipse around the result. @@ -291,7 +291,6 @@ Vision::measure ( const Camera &cam, const measurement_t &zin, measurement_t &zo } zout.xcorrmax = maxval; - /* Mat sr8, patch8, rpatch8; sr.convertTo(sr8, CV_8UC1); zin.patch.convertTo(patch8, CV_8UC1); @@ -307,8 +306,7 @@ Vision::measure ( const Camera &cam, const measurement_t &zin, measurement_t &zo cv::imshow("mask", mask); cv::imshow("display2", display); cerr << maxval << endl; - cv::waitKey(0); - */ + cv::waitKey(1); } else { zout.xcorrmax = -1.; } -- cgit v1.1