From b99ff19620941c24714ecd4016c1a9877fecdc6f Mon Sep 17 00:00:00 2001 From: Jan Grewe Date: Fri, 8 Mar 2024 16:10:25 +0100 Subject: [PATCH] properly use new ringbuffer methods --- pylonrecorder.cpp | 10 ++++------ pylonwrapper.cpp | 11 ++++++----- writer.cpp | 5 ++--- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/pylonrecorder.cpp b/pylonrecorder.cpp index 8706b88..298cfbc 100644 --- a/pylonrecorder.cpp +++ b/pylonrecorder.cpp @@ -751,7 +751,7 @@ void PylonRecorder::startRecording() { stopRequest = false; pressureTimer->start(50); - frameTimer->start(50); + frameTimer->start(100); labelTimer->start(650); updateActions(); } @@ -806,12 +806,10 @@ void PylonRecorder::displayActivity() { void PylonRecorder::displaySingleFrame() { MyImage *img; - // if (dryRunCheckBox->isChecked()) - // img = buffer->pop(); - // else { - img = buffer->readLast(); - // } + size_t fc = 0; + img = buffer->readLast(fc); if (img != nullptr){ + std::cerr << "display, last frame count " << fc << std::endl; QImage qimg(static_cast(img->data()), img->width(), img->height(), QImage::Format::Format_Grayscale8); setImage(qimg); }else { diff --git a/pylonwrapper.cpp b/pylonwrapper.cpp index 9992fd1..9684f66 100644 --- a/pylonwrapper.cpp +++ b/pylonwrapper.cpp @@ -127,13 +127,14 @@ bool PylonWrapper::gain(double gain_db) { ImageSettings PylonWrapper::getImageSettings() { ImageSettings settings; if (valid) { + Pylon::CEnumParameter pixelFormat( camera->GetNodeMap(), "PixelFormat" ); + Pylon::CPixelTypeMapper pixelTypeMapper( &pixelFormat ); + Pylon::EPixelType pixelType = pixelTypeMapper.GetPylonPixelTypeFromNodeValue( pixelFormat.GetIntValue() ); Pylon::CIntegerParameter width( camera->GetNodeMap(), "Width"); Pylon::CIntegerParameter height( camera->GetNodeMap(), "Height"); - Pylon::CEnumParameter pixelFormat( camera->GetNodeMap(), "PixelFormat"); - Pylon::CPixelTypeMapper pixelTypeMapper(&pixelFormat); - settings.pixelType = pixelTypeMapper.GetPylonPixelTypeFromNodeValue(pixelFormat.GetIntValue()); - settings.width = width.GetValue(); - settings.height = height.GetValue(); + settings.pixelType = pixelType; + settings.width = (uint32_t)width.GetValue(); + settings.height = (uint32_t)height.GetValue(); settings.orientation = Pylon::EImageOrientation::ImageOrientation_TopDown; } return settings; diff --git a/writer.cpp b/writer.cpp index a35cc0f..e937c15 100644 --- a/writer.cpp +++ b/writer.cpp @@ -92,10 +92,9 @@ void Writer::run() { nix::NDSize chunk_shape(1, chunksize); while ((!stop_request || buffer->bufferLoad() > 0) && !stopNow) { if (buffer->bufferLoad() > 0 ) { - MyImage *img = buffer->pop(); + size_t framecount = 0; + MyImage *img = buffer->read(framecount); if (img != nullptr) { - auto start = high_resolution_clock::now(); - // framecount += 1; if (videoSpecs.format == VideoFormat::raw) { myFile.write((char*)img->data(), img->size()); } else {