Ask Your Question

syntax for zooming a video

asked 2013-03-28 09:43:01 -0500

abikala gravatar image

Hi sir, When i select an area in video that part should be zoomed... would u please help me with a syntax

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2013-03-28 10:40:28 -0500

berak gravatar image

i'm using this:

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;

bool down   = false;
bool hasRoi = false;
Point tl,br;
Rect  roi;

void onmouse( int evnt, int x, int y, int d, void *p )
    if ( evnt==4 )   
        if ( tl.x<br.x+5)
        down = false; 
    if ( evnt==1 )   { tl = Point(x,y); down = true; }
    if ( d==1 )      { br = Point(x,y); }
int main(int argc, char *argv[]) 
    VideoCapture cap("../HHParticleFilter/recording_mask.avi"); 
        Mat imag, show;
        cap >> imag;

        if ( roi.area()>=32 ) 
            show = imag;

        if ( down )

        int k = waitKey(40);
        if ( k==27  ) break;
        if ( k==' ' ) roi.x=roi.y=roi.height=roi.width=0; // revert to original

    return 0;
edit flag offensive delete link more

answered 2013-03-28 10:22:57 -0500

Actually superresolution is only interesting if you want to improve the resolution. I guess playing around with the region of interest parameter will get you much further.

Dynamically changing the region of interest on a frame, by hitting buttons, would result in a sort of zoom like function.

Go ahead and try!

edit flag offensive delete link more

answered 2013-03-28 09:47:56 -0500

Look at SuperResolution functionalities, or super_resolution.cpp samples in GPU directory if it's what you want.

Otherwise, I think you should implement a zoom yourself (google computer vision paper to find right algorithms).

edit flag offensive delete link more

Question Tools


Asked: 2013-03-28 09:43:01 -0500

Seen: 2,582 times

Last updated: Mar 28 '13