From 12c1f17a0ad09d7ad5bfac26b483391bb21bfc40 Mon Sep 17 00:00:00 2001 From: Seb James Date: Tue, 8 Jun 2021 22:56:59 +0100 Subject: [PATCH] Corrects vertical text positioning when a scaleFactor has been used --- src/DM.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/DM.h b/src/DM.h index fcca305..2c9781a 100644 --- a/src/DM.h +++ b/src/DM.h @@ -1474,31 +1474,31 @@ class DM // Float font size based on image size (frame width)? float fwidth = (float)cf->frame.cols; float fontsz = fwidth / 1727.0f; - putText (*pImg, ss.str(), cv::Point(xh,30), cv::FONT_HERSHEY_SIMPLEX, fontsz, SF_BLACK, 1, cv::LINE_AA); + putText (*pImg, ss.str(), cv::Point(xh,30*_this->scaleFactor), cv::FONT_HERSHEY_SIMPLEX, fontsz, SF_BLACK, 1, cv::LINE_AA); std::stringstream ss2; ss2.precision(3); ss2 << " Signal range: " << cf->frame_signal_maxmin.second << "," << cf->frame_signal_maxmin.first << " (using blur offset: " << _this->bgBlurSubtractionOffset << ")"; - putText (*sImg, ss2.str(), cv::Point(xh,30), cv::FONT_HERSHEY_SIMPLEX, fontsz, SF_WHITE, 1, cv::LINE_AA); + putText (*sImg, ss2.str(), cv::Point(xh,30*_this->scaleFactor), cv::FONT_HERSHEY_SIMPLEX, fontsz, SF_WHITE, 1, cv::LINE_AA); if (_this->clearAllPending == true) { std::stringstream ss3; ss3 << "Clear curves on ALL frames? (press 'C' to confirm, 'Esc' to cancel)"; - putText (*pImg, ss3.str(), cv::Point(xh,80), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_BLACK, 1, cv::LINE_AA); - putText (*sImg, ss3.str(), cv::Point(xh,80), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_WHITE, 1, cv::LINE_AA); + putText (*pImg, ss3.str(), cv::Point(xh,80*_this->scaleFactor), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_BLACK, 1, cv::LINE_AA); + putText (*sImg, ss3.str(), cv::Point(xh,80*_this->scaleFactor), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_WHITE, 1, cv::LINE_AA); } else if (_this->exportPending == true) { std::stringstream ss3; ss3 << "Export data? (press key again to confirm, 'Esc' to cancel)"; - putText (*pImg, ss3.str(), cv::Point(xh,80), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_BLACK, 1, cv::LINE_AA); - putText (*sImg, ss3.str(), cv::Point(xh,80), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_WHITE, 1, cv::LINE_AA); + putText (*pImg, ss3.str(), cv::Point(xh,80*_this->scaleFactor), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_BLACK, 1, cv::LINE_AA); + putText (*sImg, ss3.str(), cv::Point(xh,80*_this->scaleFactor), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_WHITE, 1, cv::LINE_AA); } else if (_this->importPending == true) { std::stringstream ss3; ss3 << "IMPORT data? (press key again to confirm, 'Esc' to cancel)"; - putText (*pImg, ss3.str(), cv::Point(xh,80), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_BLACK, 1, cv::LINE_AA); - putText (*sImg, ss3.str(), cv::Point(xh,80), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_WHITE, 1, cv::LINE_AA); + putText (*pImg, ss3.str(), cv::Point(xh,80*_this->scaleFactor), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_BLACK, 1, cv::LINE_AA); + putText (*sImg, ss3.str(), cv::Point(xh,80*_this->scaleFactor), cv::FONT_HERSHEY_SIMPLEX, 1.2*fontsz, SF_WHITE, 1, cv::LINE_AA); } // h for help @@ -1511,8 +1511,8 @@ class DM << "mm[x=" << cf->layer_x << ", y=" << (x/cf->pixels_per_mm) << ", z=" << (y/cf->pixels_per_mm) << "]"; putText (*pImg, css.str(), cv::Point(xh,cf->frame.rows-20), cv::FONT_HERSHEY_SIMPLEX, fontsz/2.0f, SF_BLACK, 1, cv::LINE_AA); - int yh = 90; - int yinc = 40; + int yh = 90 * _this->scaleFactor; + int yinc = 40 * _this->scaleFactor; if (_this->flags.test(AppShowHelp)) { putText (*pImg, std::string("Use the sliders to control the bin parameters"), cv::Point(xh,yh), cv::FONT_HERSHEY_SIMPLEX, fontsz, SF_BLACK, 1, cv::LINE_AA);