From 03e5cd70c72f4396688efe76969d4e9c23d00a73 Mon Sep 17 00:00:00 2001 From: Jan Grewe Date: Tue, 12 Mar 2024 15:31:44 +0100 Subject: [PATCH] [myimage] double max frame width, allow setting data using PylonImage --- myimage.cpp | 10 ++++++++++ myimage.h | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/myimage.cpp b/myimage.cpp index d50ab77..ef4717f 100644 --- a/myimage.cpp +++ b/myimage.cpp @@ -21,6 +21,16 @@ bool MyImage::setFrame(Pylon::CGrabResultPtr ptr) { return valid; } +bool MyImage::setFrame( Pylon::CPylonImage &img) { + bool valid = img.IsValid() && img.GetWidth() <= max_width && img.GetHeight() <= max_height; + if (valid) { + img_width = img.GetWidth(); + img_height = img.GetHeight(); + memcpy(&buffer, img.GetBuffer(), img.GetImageSize()); + } + return valid; +} + int MyImage::width() { return static_cast(img_width); } diff --git a/myimage.h b/myimage.h index 7d5ea32..9a7bc59 100644 --- a/myimage.h +++ b/myimage.h @@ -16,13 +16,14 @@ public: void* data(); time_t timestamp(); bool setFrame(Pylon::CGrabResultPtr ptr); + bool setFrame(Pylon::CPylonImage &img); private: uint32_t img_width = 0; uint32_t img_height = 0; int64_t img_index = 0; time_t img_timestamp; - static const int max_width = 2048; + static const int max_width = 4096; static const int max_height = 1536; char buffer[max_width * max_height]; };