Reputation: 1469
Happy new year.
I'm working on a project which I want to do now is to make a big black window and in order to put in the middle the capturing video. I have captured the video already with its window and now I want to create a new window but bigger than the first one and I want to put in the middle of this window the captured frame video.
Now my problem is that I'm getting the same size of the first window that I made which I want a window has bigger size than the captured frame, so let's suppose a captured a frame and around it a black space. My aim is to make a new one which is bigger and the background is black and in the middle the captured frame?
This is what I'm doing, here is the code
cvNamedWindow("stabilized image", CV_WINDOW_AUTOSIZE );
IplImage* image = cvCreateImage(cvSize(900,650),IPL_DEPTH_8U,3);
cvZero( image );
image=cvCloneImage(frame);
cvShowImage("stabilized image", image );
Upvotes: 1
Views: 12423
Reputation: 17265
You should cvCopy()
your captured frame into (the center of) your black frame.
Set a ROI of the same size as your source frame positioned in the center of your black frame, and cvCopy()
into it.
Upvotes: 2
Reputation: 1892
A window created with cvNamedWindow will have the size of the image when you set CV_WINDOW_AUTOSIZE.
To resize it you have to do it with:
cvResizeWindow(const char* name, int width, int height)
So this should make it:
cvNamedWindow("stabilized image", CV_WINDOW_AUTOSIZE );
IplImage* image = cvCreateImage(cvSize(900,650),IPL_DEPTH_8U,3);
cvZero( image );
image=cvCloneImage(frame);
cvShowImage("stabilized image", image );
cvResizeWindow("stabilized image", 1024, 768);
Check also:
Upvotes: 1