Пример #1
0
	AsyncTarget_Cairo(etl::handle<synfig::Target_Cairo> warm_target):
	warm_target(warm_target)
	{
		set_avoid_time_sync(warm_target->get_avoid_time_sync());
		set_canvas(warm_target->get_canvas());
		set_quality(warm_target->get_quality());
		set_remove_alpha(warm_target->get_remove_alpha());
		set_rend_desc(&warm_target->rend_desc());
		alive_flag=true;
#ifndef GLIB_DISPATCHER_BROKEN
		ready_connection=frame_ready_signal.connect(sigc::mem_fun(*this,&AsyncTarget_Cairo::frame_ready));
#endif
	}
Пример #2
0
	AsyncTarget_Scanline(etl::handle<synfig::Target_Scanline> warm_target):
		warm_target(warm_target)
	{
		set_avoid_time_sync(warm_target->get_avoid_time_sync());
		set_canvas(warm_target->get_canvas());
		set_quality(warm_target->get_quality());
		set_remove_alpha(warm_target->get_remove_alpha());
		set_threads(warm_target->get_threads());
		set_rend_desc(&warm_target->rend_desc());
		alive_flag=true;
#ifndef GLIB_DISPATCHER_BROKEN
		ready_connection=frame_ready_signal.connect(sigc::mem_fun(*this,&AsyncTarget_Scanline::frame_ready));
#endif
		surface.set_wh(warm_target->rend_desc().get_w(),warm_target->rend_desc().get_h());
	}
Пример #3
0
	AsyncTarget_Cairo_Tile(etl::handle<synfig::Target_Cairo_Tile> warm_target):
	warm_target(warm_target)
	{
		set_avoid_time_sync(warm_target->get_avoid_time_sync());
		set_tile_w(warm_target->get_tile_w());
		set_tile_h(warm_target->get_tile_h());
		set_canvas(warm_target->get_canvas());
		set_quality(warm_target->get_quality());
		set_alpha_mode(warm_target->get_alpha_mode());
		set_threads(warm_target->get_threads());
		set_clipping(warm_target->get_clipping());
		set_rend_desc(&warm_target->rend_desc());
		alive_flag=true;
#ifndef GLIB_DISPATCHER_BROKEN
		ready_connection=tile_ready_signal.connect(sigc::mem_fun(*this,&AsyncTarget_Cairo_Tile::tile_ready));
#endif
	}
Пример #4
0
void thread_worker() {
    threadRun = true;

    int k;
    //char key;
    int cameraId[2] = {1,0};
    VideoCapture inputCapture[2];
    {
    Glib::Threads::Mutex::Lock lock (theMutex);
    for (k = 0; k < 2; ++k)
    {
        inputCapture[k].open(cameraId[k]);
        if (!inputCapture[k].isOpened()) {
            cerr << "Inexistent input: " << cameraId[k];
            return;
        }
    }
    }
    while (threadRun) {
        // TODO skip processing on some frames
        Glib::usleep(50000);
        {
        Glib::Threads::Mutex::Lock lock (theMutex);

        for( k = 0; k < 2; k++ )
        {
            inputCapture[k].grab();
        }
        for( k = 0; k < 2; k++ )
        {
            Mat aux;
            inputCapture[k].retrieve(data.view[k]);
            remap(data.view[k], aux, data.map[k][0], data.map[k][1], INTER_LINEAR);
            data.view[k]=aux;
        }

        cvtColor(data.view[0], data.viewDisplay[0], CV_BGR2RGB);
        data.pix_left = Gdk::Pixbuf::create_from_data(
            data.viewDisplay[0].data,
            Gdk::COLORSPACE_RGB,
            false,
            8,
            data.viewDisplay[0].cols,
            data.viewDisplay[0].rows,
            data.viewDisplay[0].step
        );
        cvtColor(data.view[1], data.viewDisplay[1], CV_BGR2RGB);
        data.pix_right = Gdk::Pixbuf::create_from_data(
            data.viewDisplay[1].data,
            Gdk::COLORSPACE_RGB,
            false,
            8,
            data.viewDisplay[1].cols,
            data.viewDisplay[1].rows,
            data.viewDisplay[1].step
        );

        computeStereoBM();
        data.pix_depth = Gdk::Pixbuf::create_from_data(
            data.imageDepthDisplay.data,
            Gdk::COLORSPACE_RGB,
            false,
            8,
            data.imageDepthDisplay.cols,
            data.imageDepthDisplay.rows,
            data.imageDepthDisplay.step
        );

        }
        theDispatcher.emit();
    }
}