Ask Your Question
0

frame size adjustment

asked Jan 9 '14

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?

Preview: (hide)

3 answers

Sort by » oldest newest most voted
1

answered Jan 9 '14

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)));
Preview: (hide)

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 (Jan 9 '14)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 (Jan 10 '14)edit
0

answered Jan 10 '14

JAyThaRevo gravatar image
Preview: (hide)
0

answered Jan 9 '14

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

Preview: (hide)

Question Tools

Stats

Asked: Jan 9 '14

Seen: 603 times

Last updated: Jan 09 '14