change stiching method
add camera temperature readout
This commit is contained in:
parent
ea3b870c0a
commit
48a04fdf79
10 changed files with 128 additions and 24 deletions
|
|
@ -9,7 +9,9 @@
|
|||
Cameras::Cameras(uvosled* led): led_(led)
|
||||
{
|
||||
ledTimer.setSingleShot(true);
|
||||
cameraFailureTimer.setSingleShot(true);
|
||||
connect(&ledTimer, &QTimer::timeout, this, &Cameras::lightOff);
|
||||
connect(&cameraFailureTimer, &QTimer::timeout, this, &Cameras::reloadCameras);
|
||||
}
|
||||
|
||||
Cameras::~Cameras()
|
||||
|
|
@ -29,6 +31,11 @@ bool Cameras::setCameras(const std::vector<cam::Camera::Description>& descriptio
|
|||
return ret;
|
||||
}
|
||||
|
||||
void Cameras::reloadCameras()
|
||||
{
|
||||
setCameras(getCameras());
|
||||
}
|
||||
|
||||
|
||||
void Cameras::clear()
|
||||
{
|
||||
|
|
@ -70,6 +77,9 @@ bool Cameras::addCamera(const cam::Camera::Description& desc)
|
|||
return false;
|
||||
}
|
||||
|
||||
enableCapture(false);
|
||||
blockCaptureId_ = cameras_.back()->id();
|
||||
|
||||
cameras_.back()->cam()->setExposureTime(exposrueTime_);
|
||||
|
||||
if(desc.getVendor().find("Photonfocus") != std::string::npos)
|
||||
|
|
@ -80,11 +90,11 @@ bool Cameras::addCamera(const cam::Camera::Description& desc)
|
|||
camera->cam()->setAcquisitionMode(cam::Camera::MODE_FREE);
|
||||
camera->cam()->setFrameRate(10);
|
||||
camera->cam()->startAcquisition();
|
||||
struct timespec tv = {0, 200000000};
|
||||
nanosleep(&tv, nullptr);
|
||||
std::this_thread::sleep_for (std::chrono::milliseconds(200));
|
||||
camera->cam()->stopAcquisition();
|
||||
cameras_.pop_back();
|
||||
camera = nullptr;
|
||||
std::this_thread::sleep_for (std::chrono::milliseconds(200));
|
||||
cameras_.push_back(std::shared_ptr<Camera>(new Camera(desc)));
|
||||
if(!cameras_.back()->cam()->isOpen())
|
||||
{
|
||||
|
|
@ -112,6 +122,8 @@ void Cameras::finishAddCamera(std::shared_ptr<Camera> camera)
|
|||
camera->cam()->setTriggerMode(cam::Camera::TRIGGER_SOFTWARE);
|
||||
setFree(free_);
|
||||
connect(camera.get(), &Camera::newImage, this, &Cameras::imageRecived);
|
||||
if(blockCaptureId_ == camera->id())
|
||||
enableCapture(true);
|
||||
qDebug()<<"Using camera"<<camera->id();
|
||||
}
|
||||
|
||||
|
|
@ -229,8 +241,12 @@ void Cameras::imageRecived(Camera::Image img)
|
|||
|
||||
qDebug()<<"Recived"<<images_.size()<<"of"<<cameras_.size()<<"images";
|
||||
|
||||
if(images_.size() == 1)
|
||||
cameraFailureTimer.start(exposrueTime_*1000+1000);
|
||||
|
||||
if(images_.size() == cameras_.size())
|
||||
{
|
||||
cameraFailureTimer.stop();
|
||||
newImages(images_);
|
||||
images_.clear();
|
||||
}
|
||||
|
|
@ -238,6 +254,24 @@ void Cameras::imageRecived(Camera::Image img)
|
|||
}
|
||||
}
|
||||
|
||||
double Cameras::getMeanTemp()
|
||||
{
|
||||
double mean = 0;
|
||||
bool failure = false;
|
||||
for(auto& camera : cameras_)
|
||||
{
|
||||
double temp;
|
||||
if(camera->cam()->getTemperature(temp))
|
||||
mean+=temp;
|
||||
else
|
||||
failure = true;
|
||||
}
|
||||
if(!failure)
|
||||
return mean/cameras_.size();
|
||||
else
|
||||
return NAN;
|
||||
}
|
||||
|
||||
void Cameras::setSetup(const std::vector<CameraSetup>& setups)
|
||||
{
|
||||
for(auto& camera : cameras_)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue