From 5dd3d052aa51b2ed192e2ceacb54bec480aac959 Mon Sep 17 00:00:00 2001 From: gaillaro Date: Sat, 16 Apr 2005 15:34:46 +0000 Subject: ajout de la fonction setAdapative --- 2005/i/robert/src/video4linux/test_video4linux.cc | 1 + 2005/i/robert/src/video4linux/video4linux.cc | 12 ++++++++++++ 2005/i/robert/src/video4linux/video4linux.hh | 4 ++++ 3 files changed, 17 insertions(+) (limited to '2005/i/robert') diff --git a/2005/i/robert/src/video4linux/test_video4linux.cc b/2005/i/robert/src/video4linux/test_video4linux.cc index 6373407..73e1620 100644 --- a/2005/i/robert/src/video4linux/test_video4linux.cc +++ b/2005/i/robert/src/video4linux/test_video4linux.cc @@ -64,6 +64,7 @@ main (int argc, char **argv) int w, h; vid.getParam (w, h, pf); std::cout << w << ' ' << h << std::endl; + vid.setAdaptive (0); int s; s = Image::getBufSize (w, h, pf); uint8_t *buf = new uint8_t[s]; diff --git a/2005/i/robert/src/video4linux/video4linux.cc b/2005/i/robert/src/video4linux/video4linux.cc index 406012f..3c20004 100644 --- a/2005/i/robert/src/video4linux/video4linux.cc +++ b/2005/i/robert/src/video4linux/video4linux.cc @@ -110,6 +110,18 @@ Video4Linux::read (uint8_t *buf, unsigned size) munmap (map, bufSize_); } +/// Active/désactive la calibration automatique de la luminosité +void +Video4Linux::setAdaptive (int a) +{ + if (fd_ != -1) + { + if (ioctl(fd_, VIDIOCQCSADAPTIVE, &a) != 0) + throw errno_exception ("dev ", errno); + } +} + + /// Calibre la caméra. void Video4Linux::calibrate (void) diff --git a/2005/i/robert/src/video4linux/video4linux.hh b/2005/i/robert/src/video4linux/video4linux.hh index bce8fe6..32f382f 100644 --- a/2005/i/robert/src/video4linux/video4linux.hh +++ b/2005/i/robert/src/video4linux/video4linux.hh @@ -25,6 +25,7 @@ // // }}} #include "image/image_reader.hh" +#define VIDIOCQCSADAPTIVE _IOWR('v',227, int) /// Classe d'accés à Video4Linux. C'est un ImageReader. class Video4Linux : public ImageReader @@ -37,6 +38,7 @@ class Video4Linux : public ImageReader bool rgb_; int brightness_, contrast_; unsigned bpp_; + public: /// Constructeur. Video4Linux (const char *dev, Image::PixelFormat pixelFormat, @@ -53,6 +55,8 @@ class Video4Linux : public ImageReader void calibrate (void); /// Attend qu'une image soit disponible, retourne true si oui. bool wait (int timeout = -1); + /// Active/désactive la calibration automatique de la luminosité + void setAdaptive (int a); protected: /// Ouvre le périphérique. void open (const char *dev); -- cgit v1.2.3