LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiCalibrationBlobFeatures.h

00001 /*
00002  * Copyright (C) 2002, 2003, 2004, 2005, 2006
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  * 
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public 
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.  
00021  */ 
00022 
00023  
00024 /*--------------------------------------------------------------------
00025  * project ....: LTI-Lib: Image Processing and Computer Vision Library
00026  * file .......: ltiCalibrationBlobFeatures.h
00027  * authors ....: Dorothee Finck
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 28.11.2002
00030  * revisions ..: $Id: ltiCalibrationBlobFeatures.h,v 1.7 2006/02/07 18:33:59 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_CALIBRATION_BLOB_FEATURES_H_
00034 #define _LTI_CALIBRATION_BLOB_FEATURES_H_
00035 
00036 #include "ltiGeometricFeaturesFromMask.h"
00037 
00038 namespace lti {
00039 
00040   /**
00041    * To calibrate the camera optic feature points of an calibration
00042    * pattern must be extracted. This class extracts the center of
00043    * gravity of e.g. dark circular control points on a white
00044    * background. The control points must be placed on a rectangular
00045    * pattern, wich may be recorded under perspective distortion.
00046    *
00047    * The output is a matrix where the feature point in the i-th row
00048    * and j-th column corresponds to the control point in the i-th row
00049    * and j-th column of the calibration pattern. Because a very simple
00050    * algorithm for sorting the feature points is used, the perspective
00051    * distortion is limited in such a way that either all x-coordinates
00052    * of the points in one column must be smaller than all
00053    * x-coordinates of the points in the next column or all
00054    * y-coordinates of all points in one row respectively.
00055    */
00056   class calibrationBlobFeatures : public modifier {
00057   public:
00058     /**
00059      * the parameters for the class calibrationBlobFeatures
00060      */
00061     class parameters : public modifier::parameters {
00062     public:
00063       /**
00064        * default constructor
00065        */
00066       parameters();
00067 
00068       /**
00069        * copy constructor
00070        * @param other the parameters object to be copied
00071        */
00072       parameters(const parameters& other);
00073 
00074       /**
00075        * destructor
00076        */
00077       ~parameters();
00078 
00079       /**
00080        * returns name of this type
00081        */
00082       const char* getTypeName() const;
00083 
00084       /**
00085        * copy the contents of a parameters object
00086        * @param other the parameters object to be copied
00087        * @return a reference to this parameters object
00088        */
00089       parameters& copy(const parameters& other);
00090    
00091       /**
00092        * copy the contents of a parameters object
00093        * @param other the parameters object to be copied
00094        * @return a reference to this parameters object
00095        */
00096       parameters& operator=(const parameters& other);
00097 
00098 
00099       /**
00100        * returns a pointer to a clone of the parameters
00101        */
00102       virtual functor::parameters* clone() const;
00103 
00104       /**
00105        * write the parameters in the given ioHandler
00106        * @param handler the ioHandler to be used
00107        * @param complete if true (the default) the enclosing begin/end will
00108        *        be also written, otherwise only the data block will be written.
00109        * @return true if write was successful
00110        */
00111       virtual bool write(ioHandler& handler,const bool complete=true) const;
00112 
00113       /**
00114        * read the parameters from the given ioHandler
00115        * @param handler the ioHandler to be used
00116        * @param complete if true (the default) the enclosing begin/end will
00117        *        be also written, otherwise only the data block will be written.
00118        * @return true if write was successful
00119        */
00120       virtual bool read(ioHandler& handler,const bool complete=true);
00121 
00122 #     ifdef _LTI_MSC_6     
00123       /**
00124        * this function is required by MSVC only, as a workaround for a
00125        * very awful bug, which exists since MSVC V.4.0, and still by
00126        * V.6.0 with all bugfixes (so called "service packs") remains
00127        * there...  This method is also public due to another bug, so please
00128        * NEVER EVER call this method directly: use read() instead
00129        */
00130       bool readMS(ioHandler& handler,const bool complete=true);
00131 
00132       /**
00133        * this function is required by MSVC only, as a workaround for a
00134        * very awful bug, which exists since MSVC V.4.0, and still by
00135        * V.6.0 with all bugfixes (so called "service packs") remains
00136        * there...  This method is also public due to another bug, so please
00137        * NEVER EVER call this method directly: use write() instead
00138        */
00139       bool writeMS(ioHandler& handler,const bool complete=true) const;
00140 #     endif
00141 
00142       // ------------------------------------------------
00143       // the parameters
00144       // ------------------------------------------------
00145 
00146       /**
00147        * All pixels with a grey value below this threshold are considered
00148        * blob pixels, unless the formed object is too small.
00149        */
00150       int blobThreshold;
00151 
00152       /**
00153        * All blobs smaller than this are considered as noise and discarded.
00154        */
00155       int minimumBlobSize;
00156 
00157       /**
00158        * The number of blobs that are expected along the x- and y-axis. It is
00159        * assumed that all lines and columns of the calibration pattern contain
00160        * the same number of markers (blobs).
00161        */
00162       point numberOfBlobs;
00163       
00164       /**
00165        * If true, all x-coordinates of the points in one row must be smaller
00166        * than all x-coordinatens of the points in the next row. If false, all
00167        * y-coordinates of the points in one column must be smaller than all
00168        * y-coordinatens of the points in the next column.
00169        */
00170       bool xOrdering;
00171     };
00172 
00173     /**
00174      * default constructor
00175      */
00176     calibrationBlobFeatures();
00177 
00178     /**
00179      * Construct a functor using the given parameters
00180      */
00181     calibrationBlobFeatures(const parameters& par);
00182 
00183     /**
00184      * copy constructor
00185      * @param other the object to be copied
00186      */
00187     calibrationBlobFeatures(const calibrationBlobFeatures& other);
00188 
00189     /**
00190      * destructor
00191      */
00192     virtual ~calibrationBlobFeatures();
00193 
00194     /**
00195      * returns the name of this type ("calibrationBlobFeatures")
00196      */
00197     virtual const char* getTypeName() const;
00198 
00199     /**
00200      * Computes a matrix with all calibration features. The image will be
00201      * converted to grey-values by averaging all 3 channels.
00202      * Returns true on success and false otherwise. E.g. false is returned if
00203      * the number of expected calibration features could not be extracted.
00204      */
00205     bool apply(const image& src, matrix<point>& dest);
00206 
00207     /**
00208      * Computes a matrix with all calibration features from a grey
00209      * value image.
00210      *
00211      * @return true on success and false otherwise. E.g. false is
00212      * returned if the number of expected calibration features could
00213      * not be extracted.
00214      */
00215     bool apply(const channel8& src, matrix<point>& dest);
00216       
00217     /**
00218      * copy data of "other" functor.
00219      * @param other the functor to be copied
00220      * @return a reference to this functor object
00221      */
00222     calibrationBlobFeatures& copy(const calibrationBlobFeatures& other);
00223 
00224     /**
00225      * alias for copy member
00226      * @param other the functor to be copied
00227      * @return a reference to this functor object
00228      */
00229     calibrationBlobFeatures& operator=(const calibrationBlobFeatures& other);
00230 
00231     /**
00232      * returns a pointer to a clone of this functor.
00233      */
00234     virtual functor* clone() const;
00235 
00236     /**
00237      * returns used parameters
00238      */
00239     const parameters& getParameters() const;
00240 
00241   };
00242 }
00243 
00244 #endif

Generated on Sat Apr 10 15:25:11 2010 for LTI-Lib by Doxygen 1.6.1