Changeset 346 in flair-src for trunk/lib/FlairSensorActuator
- Timestamp:
- Feb 10, 2020, 5:18:14 PM (5 years ago)
- Location:
- trunk/lib/FlairSensorActuator/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/V4LCamera.cpp
r340 r346 33 33 #define DEFAULT_V4L_BUFFERS 4 34 34 35 #define CHANNEL_NUMBER 136 35 #define CLEAR(x) memset (&(x), 0, sizeof (x)) 37 36 #define DEFAULT_V4L_WIDTH 640 38 37 #define DEFAULT_V4L_HEIGHT 480 39 #define CV_CAP_PROP_POS_MSEC 040 #define CV_CAP_PROP_POS_FRAMES 141 #define CV_CAP_PROP_POS_AVI_RATIO 242 #define CV_CAP_PROP_FRAME_WIDTH 343 #define CV_CAP_PROP_FRAME_HEIGHT 444 #define CV_CAP_PROP_FPS 545 #define CV_CAP_PROP_FOURCC 646 #define CV_CAP_PROP_FRAME_COUNT 738 //#define CV_CAP_PROP_POS_MSEC 0 39 //#define CV_CAP_PROP_POS_FRAMES 1 40 //#define CV_CAP_PROP_POS_AVI_RATIO 2 41 //#define CV_CAP_PROP_FRAME_WIDTH 3 42 //#define CV_CAP_PROP_FRAME_HEIGHT 4 43 //#define CV_CAP_PROP_FPS 5 44 //#define CV_CAP_PROP_FOURCC 6 45 //#define CV_CAP_PROP_FRAME_COUNT 7 47 46 #define CV_CAP_PROP_FORMAT 8 48 47 #define CV_CAP_PROP_MODE 9 … … 52 51 #define CV_CAP_PROP_HUE 13 53 52 #define CV_CAP_PROP_GAIN 14 54 #define CV_CAP_PROP_CONVERT_RGB 1553 //#define CV_CAP_PROP_CONVERT_RGB 15 55 54 #define CV_CAP_PROP_SHARPNESS 16 56 55 #define CV_CAP_PROP_EXPOSURE 17 … … 58 57 #define CV_CAP_PROP_AWB 19 59 58 60 #define HAVE_CAMV4L261 62 59 using std::string; 63 60 using namespace flair::core; … … 67 64 namespace sensor { 68 65 69 V4LCamera::V4LCamera(string name, 70 uint8_t camera_index, uint16_t width, uint16_t height, 66 V4LCamera::V4LCamera(string name,uint8_t camera_index, uint16_t width, uint16_t height, 71 67 Image::Type::Format format, uint8_t priority) 72 68 : Thread(getFrameworkManager(), name, priority), 73 69 Camera(name, width, height, format) { 74 70 75 string deviceName="/dev/video"+std::to_string(camera_index); 76 device = open(deviceName.c_str(), O_RDWR | O_NONBLOCK); 77 if (device == -1) { 78 Thread::Err("Cannot open %s\n",deviceName.c_str()); 79 } else { 80 Printf("V4LCamera %s, opened %s\n",name.c_str(),deviceName.c_str()); 81 } 82 83 /* w/o memset some parts arent initialized - AKA: Fill it with zeros so it is clean */ 84 memset(&capture,0,sizeof(CvCaptureCAM_V4L)); 85 /* Present the routines needed for V4L funtionality. They are inserted as part of 86 the standard set of cv calls promoting transparency. "Vector Table" insertion. */ 87 capture.FirstCapture = 1; 88 capture.deviceHandle = device; 89 90 PALETTE_YUYV = 0; 91 PALETTE_UYVY= 0; 92 93 n_buffers = 0; 94 if (_capture_V4L2 (&capture) == -1) { 95 Thread::Err("_capture_V4L2 failed\n"); 96 } 97 98 if (icvSetPropertyCAM_V4L(&capture, CV_CAP_PROP_FRAME_WIDTH, width)<0) 99 Thread::Err("cvSetCaptureProperty error\n"); 100 if (icvSetPropertyCAM_V4L(&capture, CV_CAP_PROP_FRAME_HEIGHT, height)<0) 101 Thread::Err("cvSetCaptureProperty error\n"); 102 103 if (format == Image::Type::Format::UYVY) { 104 if (icvSetPropertyCAM_V4L(&capture, CV_CAP_PROP_FORMAT, V4L2_PIX_FMT_UYVY)<0) 105 Thread::Err("cvSetCaptureProperty error\n"); 71 string deviceName="/dev/video"+std::to_string(camera_index); 72 device = open(deviceName.c_str(), O_RDWR | O_NONBLOCK); 73 if (device == -1) { 74 Thread::Err("Cannot open %s\n",deviceName.c_str()); 75 } else { 76 Printf("V4LCamera %s, opened %s\n",name.c_str(),deviceName.c_str()); 77 } 78 79 /* w/o memset some parts arent initialized - AKA: Fill it with zeros so it is clean */ 80 memset(&capture,0,sizeof(CvCaptureCAM_V4L)); 81 capture.FirstCapture = 1; 82 PALETTE_YUYV = 0; 83 PALETTE_UYVY= 0; 84 n_buffers = 0; 85 86 if(init(width,height) == -1) { 87 Thread::Err("initialisation failed\n"); 88 } 89 90 if(format == Image::Type::Format::UYVY) { 91 if (setV4LProperty(CV_CAP_PROP_FORMAT, V4L2_PIX_FMT_UYVY)<0) 92 Thread::Err("set capture property error\n"); 106 93 } else if (format == Image::Type::Format::YUYV) { 107 if ( icvSetPropertyCAM_V4L(&capture,CV_CAP_PROP_FORMAT, V4L2_PIX_FMT_YUYV) <94 if (setV4LProperty(CV_CAP_PROP_FORMAT, V4L2_PIX_FMT_YUYV) < 108 95 0) 109 Thread::Err(" cvSetCaptureProperty error\n");96 Thread::Err("set capture property error\n"); 110 97 } else { 111 98 Thread::Err("format not supported\n"); 112 99 } 113 // ground station 114 gain = new DoubleSpinBox(GetGroupBox()->NewRow(), "gain:", 0, 1, 0.1); 115 exposure = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "exposure:", 0,1, 0.1); 116 bright = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "bright:", 0, 1, 0.1); 117 contrast = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "contrast:", 0,1, 0.1); 118 hue = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "hue:", 0, 1, 0.1); 119 sharpness = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "sharpness:", 0, 1, 0.1); 120 sat = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "saturation:", 0, 1,0.1); 121 autogain = new CheckBox(GetGroupBox()->NewRow(), "autogain:"); 122 autoexposure = new CheckBox(GetGroupBox()->LastRowLastCol(), "autoexposure:"); 123 awb = new CheckBox(GetGroupBox()->LastRowLastCol(), "awb:"); 124 fps = new Label(GetGroupBox()->NewRow(), "fps"); 125 126 hasProblems=false; 100 101 // ground station 102 gain = new DoubleSpinBox(GetGroupBox()->NewRow(), "gain:", 0, 1, 0.1); 103 exposure = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "exposure:", 0,1, 0.1); 104 bright = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "bright:", 0, 1, 0.1); 105 contrast = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "contrast:", 0,1, 0.1); 106 hue = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "hue:", 0, 1, 0.1); 107 sharpness = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "sharpness:", 0, 1, 0.1); 108 sat = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "saturation:", 0, 1,0.1); 109 autogain = new CheckBox(GetGroupBox()->NewRow(), "autogain:"); 110 autoexposure = new CheckBox(GetGroupBox()->LastRowLastCol(), "autoexposure:"); 111 awb = new CheckBox(GetGroupBox()->LastRowLastCol(), "awb:"); 112 fps = new Label(GetGroupBox()->NewRow(), "fps"); 113 114 hasProblems=false; 127 115 } 128 116 129 117 V4LCamera::~V4LCamera() { 130 118 for (int n_buffers = 0; n_buffers < nbBuffers; n_buffers++) { 131 119 //FreeFunction((char*)buffers[n_buffers].start); 132 } 133 SafeStop(); 134 Join(); 135 } 136 int V4LCamera::icvSetPropertyCAM_V4L( CvCaptureCAM_V4L* capture, 137 int property_id, double value ){ 138 static int width = 0, height = 0; 139 int retval; 140 141 /* initialization */ 142 retval = 0; 143 144 /* two subsequent calls setting WIDTH and HEIGHT will change 145 the video size */ 146 /* the first one will return an error, though. */ 147 148 switch (property_id) { 149 case CV_CAP_PROP_FRAME_WIDTH: 150 width = value; 151 if(width !=0 && height != 0) { 152 retval = icvSetVideoSize( capture, width, height); 153 width = height = 0; 154 } 155 break; 156 case CV_CAP_PROP_FRAME_HEIGHT: 157 height = value; 158 if(width !=0 && height != 0) { 159 retval = icvSetVideoSize( capture, width, height); 160 width = height = 0; 161 } 162 break; 120 } 121 SafeStop(); 122 Join(); 123 } 124 125 int V4LCamera::init(int width, int height) { 126 CLEAR (capture.cap); 127 if(-1 == xioctl(device, VIDIOC_QUERYCAP, &capture.cap)) { 128 return -1; 129 } else { 130 CLEAR (capture.capability); 131 capture.capability.type = capture.cap.capabilities; 132 133 /* Query channels number */ 134 if (-1 == xioctl(device, VIDIOC_G_INPUT, &capture.capability.channels)) { 135 return -1; 136 } 137 } 138 139 /* Init V4L2 control variables */ 140 capture.v4l2_brightness = 0; 141 capture.v4l2_contrast = 0; 142 capture.v4l2_saturation = 0; 143 capture.v4l2_hue = 0; 144 capture.v4l2_gain = 0; 145 capture.v4l2_sharpness = 0; 146 capture.v4l2_exposure = 0; 147 capture.v4l2_autogain = 0; 148 capture.v4l2_awb = 0; 149 150 capture.v4l2_brightness_min = 0; 151 capture.v4l2_contrast_min = 0; 152 capture.v4l2_saturation_min = 0; 153 capture.v4l2_hue_min = 0; 154 capture.v4l2_gain_min = 0; 155 capture.v4l2_sharpness_min = 0; 156 capture.v4l2_exposure_min = 0; 157 capture.v4l2_autogain_min = 0; 158 capture.v4l2_awb_min = 0; 159 160 capture.v4l2_brightness_max = 0; 161 capture.v4l2_contrast_max = 0; 162 capture.v4l2_saturation_max = 0; 163 capture.v4l2_hue_max = 0; 164 capture.v4l2_gain_max = 0; 165 capture.v4l2_sharpness_max = 0; 166 capture.v4l2_exposure_max = 0; 167 capture.v4l2_autogain_max = 0; 168 capture.v4l2_awb_max = 0; 169 170 if ((capture.cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) { 171 Thread::Err("device is unable to capture video memory.\n"); 172 return -1; 173 } 174 175 /* Find Window info */ 176 CLEAR (capture.form); 177 capture.form.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 178 179 if (-1 == xioctl (device, VIDIOC_G_FMT, &capture.form)) { 180 Thread::Err("Could not obtain specifics of capture window.\n"); 181 return -1; 182 } 183 184 if (autosetup_capture_mode_v4l2(&capture) == -1) { 185 return -1; 186 } 187 188 icvSetVideoSize(&capture, width, height); 189 190 unsigned int min; 191 192 /* Buggy driver paranoia. */ 193 min = capture.form.fmt.pix.width * 2; 194 if (capture.form.fmt.pix.bytesperline < min) { 195 capture.form.fmt.pix.bytesperline = min; 196 } 197 198 min = capture.form.fmt.pix.bytesperline * capture.form.fmt.pix.height; 199 if (capture.form.fmt.pix.sizeimage < min) { 200 capture.form.fmt.pix.sizeimage = min; 201 } 202 203 return 1; 204 } 205 206 int V4LCamera::setV4LProperty(int property_id, double value){ 207 int retval=0; 208 switch (property_id) { 163 209 case CV_CAP_PROP_FORMAT: 164 165 capture->form.fmt.pix.pixelformat = (unsigned long)value; 166 retval == xioctl (capture->deviceHandle, VIDIOC_S_FMT, &capture->form); 167 if ((unsigned long)value != capture->form.fmt.pix.pixelformat) 168 retval=-1; 169 170 171 PALETTE_YUYV = 0; 172 PALETTE_UYVY= 0; 173 174 175 if ((unsigned long)value== V4L2_PIX_FMT_YUYV) 176 { 177 PALETTE_YUYV = 1; 178 } 179 if ((unsigned long)value== V4L2_PIX_FMT_UYVY) 180 { 181 PALETTE_UYVY = 1; 182 } 183 184 185 break; 186 case CV_CAP_PROP_BRIGHTNESS: 187 case CV_CAP_PROP_CONTRAST: 188 case CV_CAP_PROP_SATURATION: 189 case CV_CAP_PROP_HUE: 190 case CV_CAP_PROP_GAIN: 191 case CV_CAP_PROP_SHARPNESS: 192 case CV_CAP_PROP_EXPOSURE: 193 case CV_CAP_PROP_AUTOGAIN: 194 case CV_CAP_PROP_AWB: 195 retval = icvSetControl(capture, property_id, value); 196 break; 210 capture.form.fmt.pix.pixelformat = (unsigned long)value; 211 retval == xioctl(device, VIDIOC_S_FMT, &capture.form); 212 if ((unsigned long)value != capture.form.fmt.pix.pixelformat) { 213 retval=-1; 214 } 215 PALETTE_YUYV = 0; 216 PALETTE_UYVY= 0; 217 if((unsigned long)value== V4L2_PIX_FMT_YUYV) { 218 PALETTE_YUYV = 1; 219 } 220 if((unsigned long)value== V4L2_PIX_FMT_UYVY) { 221 PALETTE_UYVY = 1; 222 } 223 break; 197 224 default: 198 fprintf(stderr, 199 "HIGHGUI ERROR: V4L: setting property #%d is not supported\n", 200 property_id); 201 } 202 203 /* return the the status */ 204 return retval; 205 } 206 int V4LCamera::icvSetControl (CvCaptureCAM_V4L* capture, 207 int property_id, double value) { 225 Thread::Warn("setting property #%d is not supported\n",property_id); 226 } 227 228 return retval; 229 } 230 231 int V4LCamera::icvSetControl(CvCaptureCAM_V4L* capture,int property_id, double value) { 208 232 209 233 /* limitation of the input value */ … … 260 284 261 285 /* get the min and max values */ 262 if (-1 == xioctl (capture->deviceHandle, 263 VIDIOC_G_CTRL, &capture->control)) { 286 if (-1 == xioctl (device,VIDIOC_G_CTRL, &capture->control)) { 264 287 // perror ("VIDIOC_G_CTRL for getting min/max values"); 265 288 return -1; … … 351 374 352 375 /* The driver may clamp the value or return ERANGE, ignored here */ 353 if (-1 == xioctl (capture->deviceHandle, 354 VIDIOC_S_CTRL, &capture->control) && errno != ERANGE) { 376 if (-1 == xioctl (device,VIDIOC_S_CTRL, &capture->control) && errno != ERANGE) { 355 377 perror ("VIDIOC_S_CTRL"); 356 378 return -1; … … 361 383 362 384 } 363 int V4LCamera::_capture_V4L2 (CvCaptureCAM_V4L *capture) 364 { 365 int detect_v4l2 = 0; 366 367 detect_v4l2 = try_init_v4l2(capture); 368 369 if (detect_v4l2 != 1) { 370 /* init of the v4l2 device is not OK */ 371 return -1; 372 } 373 374 /* Init V4L2 control variables */ 375 capture->v4l2_brightness = 0; 376 capture->v4l2_contrast = 0; 377 capture->v4l2_saturation = 0; 378 capture->v4l2_hue = 0; 379 capture->v4l2_gain = 0; 380 capture->v4l2_sharpness = 0; 381 capture->v4l2_exposure = 0; 382 capture->v4l2_autogain = 0; 383 capture->v4l2_awb = 0; 384 385 capture->v4l2_brightness_min = 0; 386 capture->v4l2_contrast_min = 0; 387 capture->v4l2_saturation_min = 0; 388 capture->v4l2_hue_min = 0; 389 capture->v4l2_gain_min = 0; 390 capture->v4l2_sharpness_min = 0; 391 capture->v4l2_exposure_min = 0; 392 capture->v4l2_autogain_min = 0; 393 capture->v4l2_awb_min = 0; 394 395 capture->v4l2_brightness_max = 0; 396 capture->v4l2_contrast_max = 0; 397 capture->v4l2_saturation_max = 0; 398 capture->v4l2_hue_max = 0; 399 capture->v4l2_gain_max = 0; 400 capture->v4l2_sharpness_max = 0; 401 capture->v4l2_exposure_max = 0; 402 capture->v4l2_autogain_max = 0; 403 capture->v4l2_awb_max = 0; 404 405 406 if ((capture->cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) { 407 /* Nope. */ 408 fprintf( stderr, "HIGHGUI ERROR: V4L2: device is unable to capture video memory.\n"); 409 410 return -1; 411 } 412 413 414 415 /* Find Window info */ 416 CLEAR (capture->form); 417 capture->form.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 418 419 if (-1 == xioctl (capture->deviceHandle, VIDIOC_G_FMT, &capture->form)) { 420 fprintf( stderr, "HIGHGUI ERROR: V4L2: Could not obtain specifics of capture window.\n\n"); 421 422 return -1; 423 } 424 425 426 427 if (autosetup_capture_mode_v4l2(capture) == -1) 428 return -1; 429 430 icvSetVideoSize(capture, DEFAULT_V4L_WIDTH, DEFAULT_V4L_HEIGHT); 431 432 unsigned int min; 433 434 /* Buggy driver paranoia. */ 435 min = capture->form.fmt.pix.width * 2; 436 437 if (capture->form.fmt.pix.bytesperline < min) 438 capture->form.fmt.pix.bytesperline = min; 439 440 min = capture->form.fmt.pix.bytesperline * capture->form.fmt.pix.height; 441 442 if (capture->form.fmt.pix.sizeimage < min) 443 capture->form.fmt.pix.sizeimage = min; 444 445 return 1; 446 } 385 386 447 387 int V4LCamera::icvSetVideoSize( CvCaptureCAM_V4L* capture, int w, int h) { 448 388 … … 457 397 458 398 /* set the crop area, but don't exit if the device don't support croping */ 459 xioctl ( capture->deviceHandle, VIDIOC_S_CROP, &capture->crop);399 xioctl (device, VIDIOC_S_CROP, &capture->crop); 460 400 461 401 CLEAR (capture->form); … … 463 403 464 404 /* read the current setting, mainly to retreive the pixelformat information */ 465 xioctl ( capture->deviceHandle, VIDIOC_G_FMT, &capture->form);405 xioctl (device, VIDIOC_G_FMT, &capture->form); 466 406 467 407 /* set the values we want to change */ … … 478 418 * don't allow changing the size, and we will get the real size 479 419 * later */ 480 xioctl ( capture->deviceHandle, VIDIOC_S_FMT, &capture->form);420 xioctl (device, VIDIOC_S_FMT, &capture->form); 481 421 482 422 /* try to set framerate to 30 fps */ … … 486 426 setfps.parm.capture.timeperframe.numerator = 1; 487 427 setfps.parm.capture.timeperframe.denominator = 30; 488 xioctl ( capture->deviceHandle, VIDIOC_S_PARM, &setfps);428 xioctl (device, VIDIOC_S_PARM, &setfps); 489 429 490 430 /* we need to re-initialize some things, like buffers, because the size has … … 493 433 494 434 /* Get window info again, to get the real value */ 495 if (-1 == xioctl ( capture->deviceHandle, VIDIOC_G_FMT, &capture->form))435 if (-1 == xioctl (device, VIDIOC_G_FMT, &capture->form)) 496 436 { 497 437 fprintf(stderr, "HIGHGUI ERROR: V4L/V4L2: Could not obtain specifics of capture window.\n\n"); … … 520 460 capture->form.fmt.pix.height = DEFAULT_V4L_HEIGHT; 521 461 522 if (-1 == xioctl ( capture->deviceHandle, VIDIOC_S_FMT, &capture->form))462 if (-1 == xioctl (device, VIDIOC_S_FMT, &capture->form)) 523 463 return -1; 524 464 … … 545 485 } 546 486 547 548 549 int V4LCamera::try_init_v4l2(CvCaptureCAM_V4L* capture)550 {551 552 // if detect = -1 then unable to open device553 // if detect = 0 then detected nothing554 // if detect = 1 then V4L2 device555 int detect = 0;556 557 558 if (detect == 0)559 {560 CLEAR (capture->cap);561 if (-1 == xioctl (capture->deviceHandle, VIDIOC_QUERYCAP, &capture->cap))562 {563 detect = 0;564 565 566 }567 else568 {569 CLEAR (capture->capability);570 capture->capability.type = capture->cap.capabilities;571 572 /* Query channels number */573 if (-1 != xioctl (capture->deviceHandle, VIDIOC_G_INPUT, &capture->capability.channels))574 {575 detect = 1;576 }577 }578 }579 580 return detect;581 582 }583 487 /* 584 488 V4LCamera::V4LCamera(string name, … … 776 680 capture->req.memory = V4L2_MEMORY_MMAP; 777 681 778 if (-1 == xioctl ( capture->deviceHandle, VIDIOC_REQBUFS, &capture->req))682 if (-1 == xioctl (device, VIDIOC_REQBUFS, &capture->req)) 779 683 { 780 684 if (EINVAL == errno) … … 816 720 buf.index = n_buffers; 817 721 818 if (-1 == xioctl ( capture->deviceHandle, VIDIOC_QUERYBUF, &buf)) {722 if (-1 == xioctl (device, VIDIOC_QUERYBUF, &buf)) { 819 723 perror ("VIDIOC_QUERYBUF"); 820 724 … … 830 734 PROT_READ | PROT_WRITE /* required */, 831 735 MAP_SHARED /* recommended */, 832 capture->deviceHandle, buf.m.offset);736 device, buf.m.offset); 833 737 834 738 if (MAP_FAILED == capture->buffers[n_buffers].start) { … … 880 784 buf.index = (unsigned long)capture->bufferIndex; 881 785 882 if (-1 == xioctl ( capture->deviceHandle, VIDIOC_QBUF, &buf)) {786 if (-1 == xioctl (device, VIDIOC_QBUF, &buf)) { 883 787 perror ("VIDIOC_QBUF"); 884 788 return 0; … … 888 792 /* enable the streaming */ 889 793 capture->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 890 if (-1 == xioctl ( capture->deviceHandle, VIDIOC_STREAMON,794 if (-1 == xioctl (device, VIDIOC_STREAMON, 891 795 &capture->type)) { 892 796 /* error enabling the stream */ … … 922 826 923 827 FD_ZERO (&fds); 924 FD_SET ( capture->deviceHandle, &fds);828 FD_SET (device, &fds); 925 829 926 830 /* Timeout. */ … … 928 832 tv.tv_usec = 0; 929 833 930 r = select ( capture->deviceHandle+1, &fds, NULL, NULL, &tv);834 r = select (device+1, &fds, NULL, NULL, &tv); 931 835 932 836 if (-1 == r) { … … 957 861 buf.memory = V4L2_MEMORY_MMAP; 958 862 959 if (-1 == xioctl ( capture->deviceHandle, VIDIOC_DQBUF, &buf)) {863 if (-1 == xioctl (device, VIDIOC_DQBUF, &buf)) { 960 864 switch (errno) { 961 865 case EAGAIN: … … 982 886 983 887 984 if (-1 == xioctl ( capture->deviceHandle, VIDIOC_QBUF, &buf))888 if (-1 == xioctl (device, VIDIOC_QBUF, &buf)) 985 889 perror ("VIDIOC_QBUF"); 986 890 -
trunk/lib/FlairSensorActuator/src/V4LCamera.h
r340 r346 22 22 23 23 namespace flair { 24 namespace core {25 class Image;26 }27 namespace gui {28 class DoubleSpinBox;29 class CheckBox;30 class Label;31 }24 namespace core { 25 class Image; 26 } 27 namespace gui { 28 class DoubleSpinBox; 29 class CheckBox; 30 class Label; 31 } 32 32 } 33 33 … … 166 166 typedef struct CvCaptureCAM_V4L 167 167 { 168 int deviceHandle;168 //int deviceHandle; 169 169 int bufferIndex; 170 170 int FirstCapture; … … 209 209 210 210 CvCaptureCAM_V4L capture; 211 int _capture_V4L2 (CvCaptureCAM_V4L *capture); 212 int try_init_v4l2(CvCaptureCAM_V4L* capture); 211 int init(int width, int height); 213 212 int autosetup_capture_mode_v4l2(CvCaptureCAM_V4L* capture); 214 213 int icvSetVideoSize( CvCaptureCAM_V4L* capture, int w, int h); 215 214 int try_palette_v4l2(CvCaptureCAM_V4L* capture, unsigned long colorspace); 216 215 int PALETTE_YUYV,PALETTE_UYVY; 217 int icvSetPropertyCAM_V4L( CvCaptureCAM_V4L* capture,int property_id, double value );216 int setV4LProperty(int property_id, double value ); 218 217 int icvSetControl (CvCaptureCAM_V4L* capture,int property_id, double value) ; 219 218 int cvGrabFrame(CvCaptureCAM_V4L* capture);
Note:
See TracChangeset
for help on using the changeset viewer.