Ask Your Question
0

frame size adjustment

asked 2014-01-09 02:15:01 -0500

metind gravatar image

Dear All, I have 2 cams and want to process frames then show them on single window. 1. Each could be same resolution(axb). 2. From first cam,i will get a/2 frame size and then from second cam i will get a/2 frame size. 3. These 2 half frames will be combined and showed on a window.

Is it possible and how?

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2014-01-09 18:12:37 -0500

JAyThaRevo gravatar image
edit flag offensive delete link more
0

answered 2014-01-09 09:18:26 -0500

Maik Angermann gravatar image

You can set a ROI (region of interest) to mark the area in the source image to be copied. Set the roi in the destination image and copy the image. Once you have set a roi, the certain part of the image will be treated as whole Image.

So your code could be something like: [code] *IplImage img1, img2; cvSetImageROI(img2, cvRect(0,320,640,320); cvSetImageROI(img1, cvRect(0,320,640,320); cvcopy(img1,img2); cvReleaseROI(img2); cvReleaseROI(img1);

[/code] You need to tell the source image the roi in order to copy the part you want to copy and you need to tell the destination a roi in order to copy the certain part of the image into the specific half of your image

Hope that helps

Maik

edit flag offensive delete link more
1

answered 2014-01-09 03:53:28 -0500

Nghia gravatar image

Do you mean two images side by side? If so you can do:

// Assume you have img1, img2
Mat big(img1.rows, img1.cols*2, img1.type());

img1.copyTo(big(Range::all(), Range(0, img1.cols)));
img2.copyTo(big(Range::all(), Range(img1.cols, big.cols)));
edit flag offensive delete link more

Comments

I mean , i have 2 cams and gets video.All is 640480 resolution. I will capture first cam frame and then save it as 320240 (half part left side),then capture second cam frame and save it as 320240 (half part right side) and will combine these 2 left and rgiht part to obtain 640480 new frame.

metind gravatar imagemetind ( 2014-01-09 04:18:10 -0500 )edit

You can't take two 320x240 and make a 640x480 out of it. If you put them next to each other you will have 640x240 or above each other you'll end up with 320x480. Lol, you need to explain in a better way what you want.

JAyThaRevo gravatar imageJAyThaRevo ( 2014-01-09 18:14:53 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-01-09 02:15:01 -0500

Seen: 246 times

Last updated: Jan 09 '14