Ask Your Question
0

set size of an window

asked 2013-03-20 17:56:36 -0600

andrempunkt gravatar image

Hi,

the following code produces a window, that is a little bit to large for my taste. How can I set the size of an window (in px or something like that)?

Hi,

the following code produces a window, that is a little bit to large for my taste. How can I set the size of an window (in px or something like that)?

Code: int main(){

VideoCapture cam("Basketball.mp4");
Mat image;
namedWindow("window");

while(1){
    cam >> image;
    imshow("window", image);
    if(waitKey(30) == 8) break;
}

}

enter code here
edit retag flag offensive close merge delete

4 answers

Sort by ยป oldest newest most voted
2

answered 2013-03-21 08:50:50 -0600

F_Michele gravatar image

You can also use resizeWindow()

edit flag offensive delete link more

Comments

I totally got the question wrong i see :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-21 11:46:54 -0600 )edit
1

answered 2013-03-21 07:35:05 -0600

berak gravatar image

you can resize it ( manually ) if you do:

namedWindow("window",CV_WINDOW_NORMAL);

the default param here is CV_WINDOW_AUTOSIZE, which does not allow resizing

on win & linux it will remember the size for that windowname, even

edit flag offensive delete link more
0

answered 2013-03-21 07:21:40 -0600

Simply put, use the functionality provided by the C++ cv::Mat class interface :)

Mat inputImage = imread(location);
Mat window = inputImage( Rect(xWindowUpperLeft, yWindowUpperLeft, widthWindow, heigthWindow) );
edit flag offensive delete link more
0

answered 2013-03-25 07:24:08 -0600

andrempunkt gravatar image

Thanks, the Parameter CV_WINDOW_NORMAL has done the trick, works fine.

Ciao, Andre

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-03-20 17:56:36 -0600

Seen: 8,494 times

Last updated: Mar 25 '13