[myimage] double max frame width, allow setting data using PylonImage
This commit is contained in:
parent
e394c346ed
commit
03e5cd70c7
10
myimage.cpp
10
myimage.cpp
@ -21,6 +21,16 @@ bool MyImage::setFrame(Pylon::CGrabResultPtr ptr) {
|
|||||||
return valid;
|
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() {
|
int MyImage::width() {
|
||||||
return static_cast<int>(img_width);
|
return static_cast<int>(img_width);
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,14 @@ public:
|
|||||||
void* data();
|
void* data();
|
||||||
time_t timestamp();
|
time_t timestamp();
|
||||||
bool setFrame(Pylon::CGrabResultPtr ptr);
|
bool setFrame(Pylon::CGrabResultPtr ptr);
|
||||||
|
bool setFrame(Pylon::CPylonImage &img);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t img_width = 0;
|
uint32_t img_width = 0;
|
||||||
uint32_t img_height = 0;
|
uint32_t img_height = 0;
|
||||||
int64_t img_index = 0;
|
int64_t img_index = 0;
|
||||||
time_t img_timestamp;
|
time_t img_timestamp;
|
||||||
static const int max_width = 2048;
|
static const int max_width = 4096;
|
||||||
static const int max_height = 1536;
|
static const int max_height = 1536;
|
||||||
char buffer[max_width * max_height];
|
char buffer[max_width * max_height];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user