Change lighting length to be based on when cameras report finished

Fix viewer handling when cammeras are available
This commit is contained in:
uvos 2021-07-19 11:12:23 +02:00
parent 65cdc7b78f
commit a9f263b22d
21 changed files with 67 additions and 36 deletions

View file

@ -7,6 +7,7 @@
#include <QDebug>
#include <algorithm>
#include <opencv2/highgui.hpp>
#include <math.h>
ImagePipeline::ImagePipeline(Cameras* cameras, bool simpleStichingAlg, QObject *parent):
QObject(parent), cameras_(cameras), simpleStichingAlg_(simpleStichingAlg)
@ -43,6 +44,19 @@ void ImagePipeline::applyDarkMap(cv::Mat& image, const cv::Mat& darkmap)
image = subtracted;
}
void ImagePipeline::sanityCheckMap(cv::Mat& mat)
{
for(int y = 0; y < mat.rows; y++)
{
float* col = mat.ptr<float>(y);
for(int x = 0; x < mat.cols; ++x)
{
if(isnan(col[x]) || isinf(col[x]))
col[x] = 0.5;
}
}
}
cv::Mat ImagePipeline::process(const Profile profile, std::vector<Camera::Image> images, bool simpleStichingAlg)
{
qDebug()<<__func__<<"got"<<images.size()<<"images";
@ -136,6 +150,9 @@ cv::Mat ImagePipeline::process(const Profile profile, std::vector<Camera::Image>
if(profile.calcurve.data)
applyCurve(output, profile.calcurve);
sanityCheckMap(output);
return output;
}
else