Exemplo n.º 1
0
static int
k4w2_v4l2_stop(k4w2_t ctx)
{
    k4w2_v4l2 * v4l2 = (k4w2_v4l2 *)ctx;
    CHANNEL ch;

    if (0== v4l2->thread)
	return K4W2_ERROR;

    v4l2->shutdown = 1;
    THREAD_JOIN(v4l2->thread);
    v4l2->thread = 0;

    for (ch = ctx->begin; ch <= ctx->end; ++ch) {
	stop_camera(&v4l2->cam[ch]);
    }
    return K4W2_SUCCESS;
}
void VideoInput::run()
{
    _init = false;
    _stop = false;

    bool success = start_camera();

    _init = true;
    
    if (!success)
    {
        return;
    }

    int error = 0;
    int max_error = 10;
    int warmup = 10000;
    QTime timer;
    timer.start();
    while(_video_capture && !_stop && error<max_error)
    {
        IplImage * frame = cvQueryFrame(_video_capture);
        if (frame)
        {   //ok
            error = 0;
            emit new_image(cv::Mat(frame));
        }
        else
        {   //error
            if (timer.elapsed()>warmup) {error++;}
        }
    }

    //clean up
    stop_camera();
    QApplication::processEvents();
}
Exemplo n.º 3
0
VideoInput::~VideoInput()
{
    stop_camera();
}
Exemplo n.º 4
0
VideoInput::~VideoInput()
{
    stop_camera(true);
}
Exemplo n.º 5
0
VideoToGet::~VideoToGet()
{
    stop_camera();
}