lplImage appears with a dark rectangle in the left and on the top. (Patch #1067)


Added by Denis Gottardello almost 14 years ago. Updated over 12 years ago.


Status:Done Start date:
Priority:Normal Due date:
Assignee:Alexander Reshetnikov % Done:

0%

Category:highgui-camera
Target version:2.4.0
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

On Linux if you grab something from a not jpeg camera the frame appears with a dark rectangle on the left and on the top. The problem is in the "icvSetVideoSize" function. The crop capability is not right implemented. I have modify the function to resolve the problem. See below:

 1static int icvSetVideoSize( CvCaptureCAM_V4L* capture, int w, int h) {
 2
 3#ifdef HAVE_CAMV4L2
 4
 5  if (V4L2_SUPPORT == 1)
 6  {
 7
 8    CLEAR (capture->cropcap);
 9    capture->cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
10
11    if (xioctl (capture->deviceHandle, VIDIOC_CROPCAP, &capture->cropcap) < 0) {
12        fprintf(stderr, "HIGHGUI ERROR: V4L/V4L2: VIDIOC_CROPCAP\n");
13    } else {
14
15        CLEAR (capture->crop);
16        capture->crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
17        capture->crop.c= capture->cropcap.defrect;
18
19        //http://v4l2spec.bytesex.org/spec-single/v4l2.html#CROP
20
21        /*capture->crop.c.left       = 0;
22        capture->crop.c.top        = 0;
23        capture->crop.c.height     = h*24;
24        capture->crop.c.width      = w*24;*/
25
26        /* set the crop area, but don't exit if the device don't support croping */
27        if (xioctl (capture->deviceHandle, VIDIOC_S_CROP, &capture->crop) < 0) {
28            fprintf(stderr, "HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP\n");
29        }
30
31    }
32
33    CLEAR (capture->form);
34    capture->form.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
35
36    /* read the current setting, mainly to retreive the pixelformat information */
37...

Associated revisions

Revision 2a68228b
Added by Alexander Reshetnikov almost 13 years ago

changed icvSetVideoSize function (ticket #1067)

Revision eedc032b
Added by Roman Donchenko over 11 years ago

Merge pull request #1067 from asmorkalov:android_service_readme

History

Updated by Alexander Shishkov about 13 years ago

  • Description changed from On Linux if you grab something from a not jpeg camera the frame appears with ... to On Linux if you grab something from a not jpeg camera the frame appears with ... More

Updated by Alexander Shishkov almost 13 years ago

  • Priority changed from High to Normal
  • Description changed from On Linux if you grab something from a not jpeg camera the frame appears with ... to On Linux if you grab something from a not jpeg camera the frame appears with ... More

Updated by Alexander Shishkov almost 13 years ago

  • Tracker changed from Bug to Patch
  • Target version deleted ()

Updated by Alexander Shishkov almost 13 years ago

  • Priority changed from Normal to High

Updated by Alexander Reshetnikov almost 13 years ago

Thank you for the report, Denis! It was applied in r7706

  • Status changed from Open to Done
  • Priority changed from High to Normal
  • Assignee set to Alexander Reshetnikov

Updated by Alexander Shishkov almost 13 years ago

  • Target version set to 2.4.0

Updated by Andrey Kamaev over 12 years ago

  • Category changed from highgui-images to highgui-camera

Also available in: Atom PDF