summaryrefslogtreecommitdiff
path: root/2005/i/robert
diff options
context:
space:
mode:
authorgaillaro2005-04-16 15:34:46 +0000
committergaillaro2005-04-16 15:34:46 +0000
commit5dd3d052aa51b2ed192e2ceacb54bec480aac959 (patch)
tree8cc0c8f71853c9c3568cc99f9ddfa56fbce9740d /2005/i/robert
parentb37a11a2f303519ffb59e96dd9a853b1945df45b (diff)
ajout de la fonction setAdapative
Diffstat (limited to '2005/i/robert')
-rw-r--r--2005/i/robert/src/video4linux/test_video4linux.cc1
-rw-r--r--2005/i/robert/src/video4linux/video4linux.cc12
-rw-r--r--2005/i/robert/src/video4linux/video4linux.hh4
3 files changed, 17 insertions, 0 deletions
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 <camera>", 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);