[myimage] expose frame timestamps

This commit is contained in:
Jan Grewe 2020-06-10 10:48:26 +02:00
parent e4a2c2856a
commit efe357e8ea
2 changed files with 6 additions and 2 deletions

View File

@ -16,7 +16,7 @@ bool MyImage::setFrame(Pylon::CGrabResultPtr ptr) {
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);
img_timestamp = std::chrono::system_clock::to_time_t(t);
}
return valid;
}
@ -41,3 +41,6 @@ void *MyImage::data() {
return &buffer;
}
time_t MyImage::timestamp() {
return img_timestamp;
}

View File

@ -14,13 +14,14 @@ public:
int size();
int64_t index();
void* data();
time_t timestamp();
bool setFrame(Pylon::CGrabResultPtr ptr);
private:
uint32_t img_width = 0;
uint32_t img_height = 0;
int64_t img_index = 0;
time_t timestamp;
time_t img_timestamp;
static const int max_width = 2048;
static const int max_height = 1536;
char buffer[max_width * max_height];