[grabber] remove leftover code, explicitly set the image size
This commit is contained in:
parent
63dbc21df8
commit
cb1c7772e8
@ -8,6 +8,7 @@ typedef high_resolution_clock Time;
|
||||
typedef milliseconds ms;
|
||||
typedef duration<float> fsec;
|
||||
|
||||
|
||||
void DualcamGrabber::run() {
|
||||
stop_request = false;
|
||||
size_t counter = 0;
|
||||
@ -25,51 +26,31 @@ void DualcamGrabber::run() {
|
||||
Pylon::CPylonImage stitchedImage;
|
||||
std::string errorMessage = "";
|
||||
|
||||
// int ifi = 0;
|
||||
// int deviation = 0;
|
||||
// std::cerr << wrapper->frameRate(0) << "\t" << wrapper->frameRate(1) << "\t" << framerate << std::endl;
|
||||
// int desired_ifi = (1./wrapper->frameRate(0) * 1000000);
|
||||
// auto framestart = high_resolution_clock::now();
|
||||
while (cameras.IsGrabbing() && !stop_request) {
|
||||
// if (counter > 0) {
|
||||
// deviation = desired_ifi - ifi;
|
||||
// if (deviation > 0)
|
||||
// // usleep(deviation);
|
||||
// std::cerr << desired_ifi << "\t" << deviation << std::endl;
|
||||
// }
|
||||
// auto start = high_resolution_clock::now();
|
||||
MyImage *img = new MyImage();
|
||||
// auto stop1 = high_resolution_clock::now();
|
||||
auto before = high_resolution_clock::now();
|
||||
try {
|
||||
cameras[0].RetrieveResult( 5000, frame0, Pylon::TimeoutHandling_ThrowException );
|
||||
// auto stop2 = high_resolution_clock::now();
|
||||
cameras[1].RetrieveResult( 5000, frame1, Pylon::TimeoutHandling_ThrowException );
|
||||
// auto stop3 = high_resolution_clock::now();
|
||||
leftImage.AttachGrabResultBuffer( frame0 );
|
||||
rightImage.AttachGrabResultBuffer( frame1 );
|
||||
} catch(const std::exception& e) {
|
||||
qDebug() << "Grabbing frame failed! " << e.what();
|
||||
}
|
||||
auto after = high_resolution_clock::now();
|
||||
if (leftImage.IsValid() && rightImage.IsValid()) {
|
||||
try {
|
||||
StitchImage::StitchToRight(leftImage, rightImage, &stitchedImage, errorMessage);
|
||||
MyImage *img = new MyImage(stitchedImage.GetWidth(), stitchedImage.GetHeight());
|
||||
img->setFrame(stitchedImage);
|
||||
buffer->push(img);
|
||||
} catch(const std::exception& e) {
|
||||
std::cerr << e.what() << '\n';
|
||||
}
|
||||
}
|
||||
// auto stop4 = high_resolution_clock::now();
|
||||
// auto duration1 = duration_cast<microseconds>(stop1 - start);
|
||||
// auto duration2 = duration_cast<microseconds>(stop2 - stop1);
|
||||
// auto duration3 = duration_cast<microseconds>(stop3 - stop2);
|
||||
// auto duration4 = duration_cast<microseconds>(stop4 - stop3);
|
||||
// std::cerr << "framecount: " << counter << " image constr: " << duration1.count() << "\t" << " retrieve1: " << duration2.count() << "\t" << " retrieve2: " << duration3.count() << "\t" << "conversion: " << duration4.count() << std::endl;
|
||||
// ifi = duration_cast<microseconds>(stop4 - framestart).count();
|
||||
// framestart = stop4;
|
||||
// if (counter > 0) {
|
||||
// std::cerr << "frame " << counter << " inter frame interval: " << ifi << "microseconds" << std::endl;
|
||||
// }
|
||||
auto stitch = high_resolution_clock::now();
|
||||
auto grab_duration = duration_cast<microseconds>(after - before);
|
||||
auto stitch_duration = duration_cast<microseconds>(stitch - after);
|
||||
std::cerr << "framecount: " << counter << " grab_duration (us): " << grab_duration.count() << "\t" << " stitching (us): " << stitch_duration.count() << std::endl;
|
||||
counter += 1;
|
||||
}
|
||||
cameras.StopGrabbing();
|
||||
|
@ -9,11 +9,12 @@ void Grabber::run() {
|
||||
camera->frameRate(static_cast<uint>(framerate));
|
||||
camera->exposureTime(exposure);
|
||||
camera->gain(gain);
|
||||
ImageSettings settings = camera->getImageSettings();
|
||||
Pylon::CInstantCamera *cam = camera->getCamera();
|
||||
Pylon::CGrabResultPtr frame;
|
||||
cam->StartGrabbing();
|
||||
while (camera->isOpen() && !stop_request) {
|
||||
MyImage *img = new MyImage();
|
||||
MyImage *img = new MyImage(settings.width, settings.height);
|
||||
cam->RetrieveResult( 5000, frame, Pylon::TimeoutHandling_ThrowException);
|
||||
img->setFrame(frame);
|
||||
buffer->push(img);
|
||||
|
Loading…
Reference in New Issue
Block a user