IntersectionHandler::~IntersectionHandler() | IntersectionHandler::~IntersectionHandler() | ||||
{ | { | ||||
} | |||||
const bool IntersectionHandler::foundLane(const FrameData& data) | |||||
{ | |||||
return data.boundingBoxes.size(); | |||||
} | |||||
const bool IntersectionHandler::foundIntersection(const FrameData& data) | |||||
{ | |||||
return data.boundingBoxes.size()>1; | |||||
} | } |
#pragma once | #pragma once | ||||
#include <utils.h> | |||||
class IntersectionHandler | class IntersectionHandler | ||||
{ | { | ||||
private: | private: | ||||
/* data */ | |||||
public: | public: | ||||
IntersectionHandler(/* args */); | IntersectionHandler(/* args */); | ||||
~IntersectionHandler(); | ~IntersectionHandler(); | ||||
const bool foundLane(const FrameData& data); | |||||
const bool foundIntersection(const FrameData& data); | |||||
}; | }; |
double delta = static_cast<double>(deltaMs) / 1000.0; | double delta = static_cast<double>(deltaMs) / 1000.0; | ||||
double frameRate = 1.0 / static_cast<double>(delta); | double frameRate = 1.0 / static_cast<double>(delta); | ||||
std::cout << "Frame rate: " << frameRate << " angle: " << result.data.angle | |||||
<< " motor 1: " << result.motorSignals[0] << " motor 2: " << result.motorSignals[1] | |||||
<< " motor 3: " << result.motorSignals[2] << " motor 4: " << result.motorSignals[3] <<std::endl; | |||||
if (result.validLane) | |||||
{ | |||||
std::cout << "Frame rate: " << frameRate << " angle: " << result.data.angle | |||||
<< " motor 1: " << result.motorSignals[0] << " motor 2: " << result.motorSignals[1] | |||||
<< " motor 3: " << result.motorSignals[2] << " motor 4: " << result.motorSignals[3] <<std::endl; | |||||
} | |||||
else | |||||
{ | |||||
std::cout << "No lane found." << std::endl;; | |||||
} | |||||
last = now; | last = now; | ||||
} | } | ||||
}, &mutex); | }, &mutex); |
processing.filterReflections(data); | processing.filterReflections(data); | ||||
processing.calcAngles(data, originalImage.cols, originalImage.rows, left); | processing.calcAngles(data, originalImage.cols, originalImage.rows, left); | ||||
controlModule.calcSpeeds(1,1, data.angle); | |||||
processedImage = provideOutput(originalImage, processedImage, data, roi); | |||||
result.validLane = intersectionHandler.foundLane(data); | |||||
if (result.validLane) | |||||
{ | |||||
controlModule.calcSpeeds(1,1, data.angle); | |||||
processedImage = provideOutput(originalImage, processedImage, data, roi); | |||||
} | |||||
result.rawImage = originalImage; | result.rawImage = originalImage; | ||||
result.processedImage = processedImage; | result.processedImage = processedImage; | ||||
result.data = data; | result.data = data; |
struct LFR_Result | struct LFR_Result | ||||
{ | { | ||||
bool validLane; | |||||
cv::Mat rawImage; | cv::Mat rawImage; | ||||
cv::Mat processedImage; | cv::Mat processedImage; | ||||
FrameData data; | FrameData data; |