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]; };