Check for valid lane

This commit is contained in:
Tim Zeuner 2023-01-05 10:39:48 +01:00
parent 7175b68abe
commit ff7634e0b0
5 changed files with 31 additions and 8 deletions

View File

@ -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;
}

View File

@ -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);
};

View File

@ -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);

View File

@ -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;

View File

@ -18,6 +18,7 @@ using namespace cv;
struct LFR_Result
{
bool validLane;
cv::Mat rawImage;
cv::Mat processedImage;
FrameData data;