fixed concept based issues
This commit is contained in:
parent
8c413c5adb
commit
96dc6f448a
@ -11,11 +11,11 @@
|
||||
Ruler::Ruler(UI *ui, int *lastKey) {
|
||||
Ruler::ui = ui;
|
||||
Ruler::lastKey = lastKey;
|
||||
focalLength = estimateFocalLength();
|
||||
focalLength = estimateFocalLength(HFOV);
|
||||
}
|
||||
|
||||
void Ruler::update(cv::Rect rect) {
|
||||
focalLength = estimateFocalLength();
|
||||
focalLength = estimateFocalLength(HFOV);
|
||||
distance = estimateDistance(rect);
|
||||
inputUpdate();
|
||||
updateUI();
|
||||
@ -27,11 +27,11 @@ float Ruler::estimateFocalLength(int HFOV) {
|
||||
|
||||
void Ruler::updateUI() {
|
||||
if (inputtingVal) {
|
||||
cv::putText(*(ui->drawnFrame()), ("Given width: " << widthInCM), confTextPos, cv::FONT_HERSHEY_DUPLEX, 0.7, textFontColor + 50);
|
||||
cv::putText(*(ui->drawnFrame()), ("Given width: " + std::to_string(widthInCM)), confTextPos, cv::FONT_HERSHEY_DUPLEX, 0.7, textFontColor, 2);
|
||||
} else {
|
||||
cv::putText(*(ui->drawnFrame()), ("Given width: " << widthInCM), confTextPos, cv::FONT_HERSHEY_DUPLEX, 0.7, textFontColor);
|
||||
cv::putText(*(ui->drawnFrame()), ("Given width: " + std::to_string(widthInCM)), confTextPos, cv::FONT_HERSHEY_DUPLEX, 0.7, textFontColor);
|
||||
}
|
||||
cv::putText(*(ui->drawnFrame()), ("distance: " << distance << "cm"), distanceTextPos, cv::FONT_HERSHEY_DUPLEX, 0.7, textFontColor);
|
||||
cv::putText(*(ui->drawnFrame()), ("distance: " + std::to_string(distance) + "cm"), distanceTextPos, cv::FONT_HERSHEY_DUPLEX, 0.7, textFontColor);
|
||||
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ void Ruler::inputUpdate() {
|
||||
numBuild.push_back(val);
|
||||
}
|
||||
std::string numString{numBuild.begin(), numBuild.end()};
|
||||
numString >> widthInCM;
|
||||
widthInCM = std::stod(numString);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef RECTANGLE_RULER_H_
|
||||
#define RECTANGLE_RULER_H_
|
||||
#include "../UI.h"
|
||||
#include "../UIListener.hpp";
|
||||
#include "../UIListener.hpp"
|
||||
|
||||
class Ruler: public UIListener {
|
||||
cv::Point distanceTextPos {5, 60};
|
||||
@ -26,7 +26,7 @@ class Ruler: public UIListener {
|
||||
|
||||
public:
|
||||
Ruler(UI *ui, int *lastKey);
|
||||
float estimateFocalLength(int HFOV = Ruler::HFOV);
|
||||
float estimateFocalLength(int HFOV);
|
||||
int estimateDistance(cv::Rect rect);
|
||||
void update(cv::Rect rect);
|
||||
void componentSetup();
|
||||
|
@ -20,7 +20,7 @@ BoundTracker tracker { lastKey, ui };
|
||||
cv::Point statusTextPos {5, 15};
|
||||
cv::Scalar textFontColor { 20, 20, 20};
|
||||
cv::Scalar rectangleBoundColor { 255, 0, 0 };
|
||||
|
||||
cv::Rect subject;
|
||||
unsigned frameCount = 0;
|
||||
void run() {
|
||||
switch (state) {
|
||||
@ -63,6 +63,7 @@ void run() {
|
||||
scaledSearchArea.y = std::min(scaledSearchArea.y, ui->getHeight()-scaledSearchArea.height -1);
|
||||
|
||||
ca.analyze(scaledSearchArea);
|
||||
|
||||
ca.convertContoursToBounds();
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user