From: Alexander Reshetnikov Date: Wed, 28 Mar 2012 16:14:36 +0000 (+0000) Subject: changed icvSetVideoSize function (ticket #1067) X-Git-Tag: accepted/2.0/20130307.220821~947 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2a68228b667b70f9dd8a06a14945f5ac0b737fd4;p=profile%2Fivi%2Fopencv.git changed icvSetVideoSize function (ticket #1067) --- diff --git a/modules/highgui/src/cap_v4l.cpp b/modules/highgui/src/cap_v4l.cpp index cf3ef89..5f9e111 100644 --- a/modules/highgui/src/cap_v4l.cpp +++ b/modules/highgui/src/cap_v4l.cpp @@ -2427,15 +2427,22 @@ static int icvSetVideoSize( CvCaptureCAM_V4L* capture, int w, int h) { if (V4L2_SUPPORT == 1) { - CLEAR (capture->crop); - capture->crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - capture->crop.c.left = 0; - capture->crop.c.top = 0; - capture->crop.c.height = h*24; - capture->crop.c.width = w*24; - - /* set the crop area, but don't exit if the device don't support croping */ - xioctl (capture->deviceHandle, VIDIOC_S_CROP, &capture->crop); + CLEAR (capture->cropcap); + capture->cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + if (xioctl (capture->deviceHandle, VIDIOC_CROPCAP, &capture->cropcap) < 0) { + fprintf(stderr, "HIGHGUI ERROR: V4L/V4L2: VIDIOC_CROPCAP\n"); + } else { + + CLEAR (capture->crop); + capture->crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + capture->crop.c= capture->cropcap.defrect; + + /* set the crop area, but don't exit if the device don't support croping */ + if (xioctl (capture->deviceHandle, VIDIOC_S_CROP, &capture->crop) < 0) { + fprintf(stderr, "HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP\n"); + } + } CLEAR (capture->form); capture->form.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;