[myimage] double max frame width, allow setting data using PylonImage

This commit is contained in:
Jan Grewe 2024-03-12 15:31:44 +01:00
parent e394c346ed
commit 03e5cd70c7
2 changed files with 12 additions and 1 deletions

View File

@ -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<int>(img_width);
}

View File

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