@@ -6,4 +6,14 @@ IntersectionHandler::IntersectionHandler(/* args */) | |||
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; | |||
} |
@@ -1,11 +1,14 @@ | |||
#pragma once | |||
#include <utils.h> | |||
class IntersectionHandler | |||
{ | |||
private: | |||
/* data */ | |||
public: | |||
IntersectionHandler(/* args */); | |||
~IntersectionHandler(); | |||
const bool foundLane(const FrameData& data); | |||
const bool foundIntersection(const FrameData& data); | |||
}; |
@@ -40,9 +40,16 @@ int main(void) | |||
double delta = static_cast<double>(deltaMs) / 1000.0; | |||
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; | |||
} | |||
}, &mutex); |
@@ -68,10 +68,12 @@ void LFR::createThread() | |||
processing.filterReflections(data); | |||
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.processedImage = processedImage; | |||
result.data = data; |
@@ -18,6 +18,7 @@ using namespace cv; | |||
struct LFR_Result | |||
{ | |||
bool validLane; | |||
cv::Mat rawImage; | |||
cv::Mat processedImage; | |||
FrameData data; |