TLIB documentation
 

tlChain.h

Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////////////
00002 //
00003 //  This file is part of the TLIB computer vision library.
00004 //  Copyright (C) 2003-2008 Sebastien Grange
00005 //  Copyright (C) 2003-2007 VRAI Group, EPFL
00006 //  All rights reserved.
00007 // 
00008 //  This library is free software; you can redistribute it and/or modify
00009 //  it under the terms of the GNU General Public License("GPL") version 2
00010 //  as published by the Free Software Foundation.
00011 // 
00012 //  <http://www.tuyphon.com/tlib>
00013 //
00014 /////////////////////////////////////////////////////////////////////////////////
00015 
00016 
00017 #ifndef __TLCHAIN_H__
00018 #define __TLCHAIN_H__
00019 
00020 
00021 #include "tlVision.h"
00022 
00023 
00024 // corner extraction defaults
00025 #define TL_CHAIN_CORNER_DMIN           7
00026 #define TL_CHAIN_CORNER_DMAX           9
00027 #define TL_CHAIN_CORNER_ALPHAMAX     150
00028 
00029 
00030 #ifndef NO_DOC
00031 // chained list elements
00032 typedef struct lpoint{
00033   int     index;
00034   double  curvature;
00035   tlPoint *point;
00036   lpoint  *next;
00037   lpoint  *prev;
00038 } lpoint;
00039 
00040 // internal data struct for chain extraction
00041 typedef struct {
00042   tlPixel *data;
00043   int width;
00044   int height;
00045   int x;
00046   int y;
00047   int x1; 
00048   int x2; 
00049   int y1; 
00050   int y2; 
00051   int connex;
00052 } _tl_extraction_data;
00053 
00054 #endif
00055 
00056 
00057 // class declaration
00058 class tlChain
00059 {
00060 private:
00061   int    length;
00062   int    closed;
00063   int    connex;
00064   lpoint *current;
00065   lpoint *start;
00066   lpoint *end;
00067 
00068   // internal chained list element creation
00069   struct lpoint *newPoint (tlPoint *point);
00070   struct lpoint *newPoint (int x, int y);
00071 
00072   // internal chain extraction recursion
00073   int extractPoint (_tl_extraction_data *exdat);
00074 
00075 public:
00076 
00077   // constructors
00078   tlChain  ();
00079   tlChain  (tlPoint *start);
00080   tlChain  (int startx, int starty);
00081   virtual ~tlChain ();
00082 
00083   // data management
00084   int getLength  () { return length;  }
00085   int isClosed   () { return closed;  }
00086   int getConnex  () { return connex;  }
00087   
00088   tlPoint *getStart   () { return start->point; }
00089   tlPoint *getEnd     () { return end->point;   }
00090   tlPoint *getPoint   (int index);
00091 
00092   // chain management
00093   int reset ();
00094   int clear ();
00095   int filter (int radius);
00096   int close ();
00097 
00098   // point management
00099   int isIn    (tlPoint *point);
00100   int isIn    (int x, int y);
00101   int add     (tlPoint *point);
00102   int add     (int x, int y);
00103   int insert  (int index, tlPoint *point);
00104   int insert  (int index, int x, int y);
00105   int remove  (int index);
00106   int remove  (tlPoint *point);
00107   int remove  (int x, int y);
00108 
00109   // chain construction
00110   int extract      (tlImage *image, tlPoint *point, int connex = TL_CONNEX_8);
00111   int extract      (tlImage *image, int x, int y, int connex = TL_CONNEX_8);
00112   int extract      (tlImage *image, tlPoint *point, tlRect *rect, int connex = TL_CONNEX_8);
00113   int extract      (tlImage *image, int x, int y, tlRect *rect, int connex = TL_CONNEX_8);
00114   int blindExtract (tlImage *image, tlPoint *point, int connex = TL_CONNEX_8);
00115   int blindExtract (tlImage *image, int x, int y, int connex = TL_CONNEX_8);
00116   int blindExtract (tlImage *image, tlPoint *point, tlRect *rect, int connex = TL_CONNEX_8);
00117   int blindExtract (tlImage *image, int x, int y, tlRect *rect, int connex = TL_CONNEX_8);
00118   int extract      (tlMask *mask,   tlPoint *point, int connex = TL_CONNEX_8);
00119   int extract      (tlMask *mask,   int x, int y, int connex = TL_CONNEX_8);
00120   int extract      (tlMask *mask,   tlPoint *point, tlRect *rect, int connex = TL_CONNEX_8);
00121   int extract      (tlMask *mask,   int x, int y, tlRect *rect, int connex = TL_CONNEX_8);
00122   int blindExtract (tlMask *mask,   tlPoint *point, int connex = TL_CONNEX_8);
00123   int blindExtract (tlMask *mask,   int x, int y, int connex = TL_CONNEX_8);
00124   int blindExtract (tlMask *mask,   tlPoint *point, tlRect *rect, int connex = TL_CONNEX_8);
00125   int blindExtract (tlMask *mask,   int x, int y, tlRect *rect, int connex = TL_CONNEX_8);
00126 
00127   // corner detection
00128   int corners (tlChain *corners);
00129   int corners (int res, int alphaMax, tlChain *corners);
00130   int corners (int dmin, int dmax, int alphaMax, tlChain *corners);
00131 };
00132 
00133 
00134 #endif


TLIB documentation - generated on 7 May 2008
Please address any questions to seb@tuyphon.com
(C) 2001-2008 - S. Grange
(C) 2001-2007 - VRAI Group, EPFL
All Rights Reserved.