Change lighting length to be based on when cameras report finished
Fix viewer handling when cammeras are available
This commit is contained in:
@ -6,9 +6,9 @@ Version=1.0
|
|||||||
# The name of the application
|
# The name of the application
|
||||||
Name=Lubricant Thickness Detector
|
Name=Lubricant Thickness Detector
|
||||||
# A comment which can/will be used as a tooltip
|
# A comment which can/will be used as a tooltip
|
||||||
Comment=MAClient -sd 0 -t 30
|
Comment=MAClient
|
||||||
# The executable of the application, possibly with arguments.
|
# The executable of the application, possibly with arguments.
|
||||||
Exec=MAClient
|
Exec=MAClient -sd 0 -t 30
|
||||||
# The name of the icon that will be used to display this entry
|
# The name of the icon that will be used to display this entry
|
||||||
Icon=MAClient
|
Icon=MAClient
|
||||||
# Describes whether this application needs to be run in a terminal or not
|
# Describes whether this application needs to be run in a terminal or not
|
||||||
|
@ -157,13 +157,20 @@ void Cameras::trigger()
|
|||||||
if(serial_)
|
if(serial_)
|
||||||
{
|
{
|
||||||
if(captureingCamera == 0)
|
if(captureingCamera == 0)
|
||||||
lightFor(lighting_, exposrueTime_*1.5*cameras_.size());
|
{
|
||||||
|
lightFor(lighting_, 10000);
|
||||||
|
qDebug()<<__func__<<"started";
|
||||||
|
std::this_thread::sleep_for(std::chrono::microseconds(static_cast<long>(exposrueTime_)));
|
||||||
|
}
|
||||||
cameras_[captureingCamera]->cam()->trigger();
|
cameras_[captureingCamera]->cam()->trigger();
|
||||||
++captureingCamera;
|
++captureingCamera;
|
||||||
if(captureingCamera < cameras_.size())
|
if(captureingCamera < cameras_.size())
|
||||||
QTimer::singleShot(exposrueTime_*1000, this, &Cameras::trigger);
|
QTimer::singleShot(exposrueTime_*1000, this, &Cameras::trigger);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
captureingCamera = 0;
|
captureingCamera = 0;
|
||||||
|
qDebug()<<__func__<<"finished";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -271,6 +278,7 @@ void Cameras::imageRecived(Camera::Image img)
|
|||||||
|
|
||||||
if(images_.size() == cameras_.size())
|
if(images_.size() == cameras_.size())
|
||||||
{
|
{
|
||||||
|
lightOff();
|
||||||
cameraFailureTimer.stop();
|
cameraFailureTimer.stop();
|
||||||
newImages(images_);
|
newImages(images_);
|
||||||
images_.clear();
|
images_.clear();
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <opencv2/highgui.hpp>
|
#include <opencv2/highgui.hpp>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
ImagePipeline::ImagePipeline(Cameras* cameras, bool simpleStichingAlg, QObject *parent):
|
ImagePipeline::ImagePipeline(Cameras* cameras, bool simpleStichingAlg, QObject *parent):
|
||||||
QObject(parent), cameras_(cameras), simpleStichingAlg_(simpleStichingAlg)
|
QObject(parent), cameras_(cameras), simpleStichingAlg_(simpleStichingAlg)
|
||||||
@ -43,6 +44,19 @@ void ImagePipeline::applyDarkMap(cv::Mat& image, const cv::Mat& darkmap)
|
|||||||
image = subtracted;
|
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)
|
cv::Mat ImagePipeline::process(const Profile profile, std::vector<Camera::Image> images, bool simpleStichingAlg)
|
||||||
{
|
{
|
||||||
qDebug()<<__func__<<"got"<<images.size()<<"images";
|
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)
|
if(profile.calcurve.data)
|
||||||
applyCurve(output, profile.calcurve);
|
applyCurve(output, profile.calcurve);
|
||||||
|
|
||||||
|
sanityCheckMap(output);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -23,6 +23,7 @@ private:
|
|||||||
|
|
||||||
static cv::Mat process(const Profile profile, std::vector<Camera::Image> images, bool simpleStich);
|
static cv::Mat process(const Profile profile, std::vector<Camera::Image> images, bool simpleStich);
|
||||||
static void applyDarkMap(cv::Mat& image, const cv::Mat &darkmap);
|
static void applyDarkMap(cv::Mat& image, const cv::Mat &darkmap);
|
||||||
|
static void sanityCheckMap(cv::Mat& mat);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
@ -122,6 +122,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
MainWindow w(parser.isSet(viewerOption));
|
MainWindow w(parser.isSet(viewerOption));
|
||||||
|
|
||||||
|
if(!parser.isSet(viewerOption))
|
||||||
|
{
|
||||||
QObject::connect(&cameras, &Cameras::cameraAdded, &w, &MainWindow::addCamera);
|
QObject::connect(&cameras, &Cameras::cameraAdded, &w, &MainWindow::addCamera);
|
||||||
QObject::connect(&cameras, &Cameras::cameraRemoved, &w, &MainWindow::removeCamera);
|
QObject::connect(&cameras, &Cameras::cameraRemoved, &w, &MainWindow::removeCamera);
|
||||||
QObject::connect(&cameras, &Cameras::enableCapture, &w, &MainWindow::enableCapture);
|
QObject::connect(&cameras, &Cameras::enableCapture, &w, &MainWindow::enableCapture);
|
||||||
@ -157,6 +159,7 @@ int main(int argc, char *argv[])
|
|||||||
});
|
});
|
||||||
|
|
||||||
cameras.load(settings);
|
cameras.load(settings);
|
||||||
|
}
|
||||||
|
|
||||||
splash.hide();
|
splash.hide();
|
||||||
w.show();
|
w.show();
|
||||||
@ -184,6 +187,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
ret = a.exec();
|
ret = a.exec();
|
||||||
|
|
||||||
|
if(!parser.isSet(viewerOption))
|
||||||
cameras.store(settings);
|
cameras.store(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
0
src/regessioncalculator.cpp
Executable file → Normal file
0
src/regessioncalculator.cpp
Executable file → Normal file
0
src/regessioncalculator.h
Executable file → Normal file
0
src/regessioncalculator.h
Executable file → Normal file
0
src/ui/aboutdiag.cpp
Executable file → Normal file
0
src/ui/aboutdiag.cpp
Executable file → Normal file
0
src/ui/aboutdiag.h
Executable file → Normal file
0
src/ui/aboutdiag.h
Executable file → Normal file
0
src/ui/aboutdiag.ui
Executable file → Normal file
0
src/ui/aboutdiag.ui
Executable file → Normal file
@ -186,6 +186,7 @@ void CvImageViewer::convertImage(cv::Mat image)
|
|||||||
void CvImageViewer::setImage(Camera::Image img)
|
void CvImageViewer::setImage(Camera::Image img)
|
||||||
{
|
{
|
||||||
origImage_=img.mat;
|
origImage_=img.mat;
|
||||||
|
clamp_ = std::numeric_limits<double>::max();
|
||||||
qDebug()<<"viwer got"<<image_.rows<<'x'<<image_.cols<<" type "<<image_.type()<<"image from camera"<<img.cameraId;
|
qDebug()<<"viwer got"<<image_.rows<<'x'<<image_.cols<<" type "<<image_.type()<<"image from camera"<<img.cameraId;
|
||||||
convertImage(img.mat);
|
convertImage(img.mat);
|
||||||
update();
|
update();
|
||||||
|
0
src/ui/plot.cpp
Executable file → Normal file
0
src/ui/plot.cpp
Executable file → Normal file
0
src/ui/plot.h
Executable file → Normal file
0
src/ui/plot.h
Executable file → Normal file
0
src/ui/regressiondiag.cpp
Executable file → Normal file
0
src/ui/regressiondiag.cpp
Executable file → Normal file
0
src/ui/regressiondiag.h
Executable file → Normal file
0
src/ui/regressiondiag.h
Executable file → Normal file
0
src/ui/regressiondiag.ui
Executable file → Normal file
0
src/ui/regressiondiag.ui
Executable file → Normal file
0
src/ui/statisticsdialog.cpp
Executable file → Normal file
0
src/ui/statisticsdialog.cpp
Executable file → Normal file
0
src/ui/statisticsdialog.h
Executable file → Normal file
0
src/ui/statisticsdialog.h
Executable file → Normal file
0
src/ui/statisticsdialog.ui
Executable file → Normal file
0
src/ui/statisticsdialog.ui
Executable file → Normal file
0
src/utilites.cpp
Executable file → Normal file
0
src/utilites.cpp
Executable file → Normal file
0
src/utilites.h
Executable file → Normal file
0
src/utilites.h
Executable file → Normal file
Reference in New Issue
Block a user