properly use new ringbuffer methods

This commit is contained in:
Jan Grewe 2024-03-08 16:10:25 +01:00
parent cb9867eec0
commit b99ff19620
3 changed files with 12 additions and 14 deletions

View File

@ -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<uchar *>(img->data()), img->width(), img->height(), QImage::Format::Format_Grayscale8);
setImage(qimg);
}else {

View File

@ -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;

View File

@ -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 {