#include "myimage.h" #include MyImage::MyImage() {} MyImage::MyImage(Pylon::CGrabResultPtr ptr) { setFrame(ptr); } bool MyImage::setFrame(Pylon::CGrabResultPtr ptr) { bool valid = ptr.IsValid() && ptr->GetWidth() <= max_width && ptr->GetHeight() <= max_height; if (valid) { img_index = ptr->GetID(); img_width = ptr->GetWidth(); img_height = ptr->GetHeight(); memcpy(&buffer, ptr->GetBuffer(), ptr->GetImageSize()); auto t = std::chrono::system_clock::now(); timestamp = std::chrono::system_clock::to_time_t(t); } return valid; } int MyImage::width() { return static_cast(img_width); } int MyImage::height() { return static_cast(img_height); } int MyImage::size() { return static_cast(img_width * img_height); } int64_t MyImage::index() { return img_index; } void *MyImage::data() { return &buffer; }