c++ - High Frame Rate Using Flycapture SDK and Qt -
i developing project based on camera application. shold retrieve frames high fps. camera model point grey chamelleon u3 serie. flycapture sdk contains 'retrievebuffer' function frames camera buffer. if use function qtimer, gets frames @ 3-4 fps. reason, should use qthread retrieve images. code here:
camera.cpp
captureframe *worker1; flycapture2::image image; worker1 = new captureframe(cam, &image); worker1->movetothread(thread1); qobject::connect(thread1, signal(started()), worker1, slot(process1())); qobject::connect(worker1, signal(finished1()), thread1, slot(quit())); qobject::connect(worker1, signal(finished1()), this, slot(startcamera2())); qobject::connect(worker1, signal(finished1()), worker1, slot(process1())); qobject::connect(worker1, signal(finished1()), worker1, slot(deletelater())); qobject::connect(thread1, signal(finished()), thread1, slot(deletelater())); thread1->start(qthread::highestpriority); /*......*/ void camera::startcamera2() { mat opencvimage = cv::mat(image.getrows(), image.getcols(), cv_8uc1, image.getdata()); qimage imgin = putimage(opencvimage); //qimage imgin = qimage((uchar*)red_band.data, red_band.cols, red_band.rows, red_band.step, qimage::format_grayscale8); imgin = imgin.scaled(ui->label_15->width(), ui->label_15->height(), qt::ignoreaspectratio, qt::smoothtransformation); ui->label_15->setpixmap(qpixmap::fromimage(imgin)); }
captureframe.cpp
captureframe::captureframe(flycapture2::camera &cam, flycapture2::image* img,qobject* parent) :qthread(parent) , cam(cam) , image(img) { } captureframe::~captureframe() { } void captureframe::process1() { cam.retrievebuffer(image); emit finished1(); }
this code runs well. displays frames @ 30 fps. however, after while, gives stackoverflow error. how can handle problem?
Comments
Post a Comment