void qr_frame::loop(Mat &raw, Mat &out)
{
if (boxload_requested || show_raw_img)
{
//printf("loop\n");
try
{
if (false == inputVideo.isOpened())
{
//std::cout << "try open \n";
inputVideo.open(camera_id);
}
if (inputVideo.isOpened() && inputVideo.grab())
{
//std::cout << "open ennn \n";
inputVideo.retrieve(raw);
//std::cout<<raw.size()<<endl;
if (raw.size().height > 1)
{
if (raw.channels() > 1)
cvtColor(raw, raw, CV_BGR2GRAY);
raw.copyTo(out);
seeMarker(out);
}
}
else
{
//printf("releas\n");
inputVideo.release();
}
} catch (cv::Exception& e)
{
printf("catch %s\n", e.what());
}
}
else
{
if (inputVideo.isOpened())
{
//std::cout << "release \n";
inputVideo.release();
}
}
}