summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/vision/image.cc
diff options
context:
space:
mode:
authorschodet2003-05-05 18:34:25 +0000
committerschodet2003-05-05 18:34:25 +0000
commit356a80697a3268aae77681b055e5e835aa2d1a71 (patch)
treea6b29b19760e77be6889401e437efc311a3b4919 /2003/i/buzz/src/vision/image.cc
parent631d7502c6cdee8aceb95de8bf9526b3b1dd421e (diff)
Add: Support de la camera.
Sub: size_thresholds.
Diffstat (limited to '2003/i/buzz/src/vision/image.cc')
-rw-r--r--2003/i/buzz/src/vision/image.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/2003/i/buzz/src/vision/image.cc b/2003/i/buzz/src/vision/image.cc
index f868587..159d5ef 100644
--- a/2003/i/buzz/src/vision/image.cc
+++ b/2003/i/buzz/src/vision/image.cc
@@ -15,9 +15,8 @@ extern "C" {
#define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b))
-// Constructeur.
-Image::Image (const char *filename, Thresholds *thresholds,
- SizeThresholds *sizeThresholds)
+// Constructeurs.
+Image::Image (const char *filename, const Thresholds *thresholds)
{
pixel **img;
pixel *p;
@@ -68,7 +67,20 @@ Image::Image (const char *filename, Thresholds *thresholds,
// Initalisation
m_groups = 0;
m_thresholds = thresholds;
- m_sizeThresholds = sizeThresholds;
+}
+
+Image::Image (const Camera &camera, const Thresholds *thresholds)
+{
+ // Allocate memory...
+ camera.getSize (m_width, m_height);
+ m_image = new unsigned char [m_width * m_height * 3];
+ // Lit l'image.
+ camera.read (m_image);
+ // Alloue de la memoire pour les zones.
+ m_zones = new unsigned char [m_width * m_height];
+ // Initalisation
+ m_groups = 0;
+ m_thresholds = thresholds;
}
// Destructeur
@@ -233,7 +245,7 @@ Image::groupFilter (void)
{
g2 = *g;
// Trouve le type de palet.
- g2->type = m_sizeThresholds->findType (g2->w, g2->h);
+ g2->type = 1; // TODO : trouver le type du palet.
// Vire les groupes qu'on ne voix pas en entier ou d'une taille bizare.
if (g2->type == 0
|| g2->x <= 0 || g2->x + g2->w >= m_width