support setting detector gain

This commit is contained in:
Jan Grewe 2020-11-20 09:58:59 +01:00
parent d6cae80e5e
commit b3605aa88a
3 changed files with 14 additions and 3 deletions

View File

@ -8,6 +8,7 @@ void Grabber::run() {
if (camera->isOpen()) {
camera->frameRate(static_cast<uint>(framerate));
camera->exposureTime(exposure);
camera->gain(gain);
Pylon::CGrabResultPtr frame;
Pylon::CInstantCamera *cam = camera->getCamera();
cam->StartGrabbing();

View File

@ -23,12 +23,16 @@ public:
return exposure;
}
double currentGain() {
return gain;
}
private:
bool stop_request = false;
PylonWrapper *camera;
ImageBuffer *buffer;
int framerate;
double exposure;
double exposure, gain;
public slots:
void requestStop() {
@ -40,7 +44,9 @@ public slots:
void setExposureTime(double newExposureTime) {
exposure = newExposureTime;
}
void setGain(double gain_db) {
gain = gain_db;
}
signals:
void terminated();
};

View File

@ -502,11 +502,13 @@ void PylonRecorder::disconnectCamera() {
void PylonRecorder::startRecording() {
std::string filename = createFilename();
fileLabel->setText(QString::fromStdString(filename));
ImageSettings settings = pylon->getImageSettings();
VideoSpecs specs;
specs.fps = framerateSpinner->value();
specs.filename = filename;
specs.exposureTime = static_cast<double>(exposureSpinner->value());
ImageSettings settings = pylon->getImageSettings();
specs.detectorGain = static_cast<double>(gainSpinner->value());
specs.width = static_cast<uint32_t>(settings.width);
specs.height= static_cast<uint32_t>(settings.height);
specs.pixelType = settings.pixelType;
@ -520,6 +522,8 @@ void PylonRecorder::startRecording() {
grabber->setFrameRate(framerateSpinner->value());
if (exposureSpinner->value() != int(grabber->currentExposureTime()))
grabber->setExposureTime(static_cast<double>(exposureSpinner->value()));
if (gainSpinner->value() != int(grabber->currentGain()))
grabber->setGain(static_cast<double>(gainSpinner->value()));
writer->setVideoSpecs(specs);
buffer->clear();
grabber->start();