last update 20 Sep 2009 |
00001 /* 00002 * Copyright (C) 2007 00003 * Pablo Alvarado 00004 * 00005 * This file is part of the Computer Vision and Robotics Library (CVR-Lib) 00006 * 00007 * The CVR-Lib is free software; you can redistribute it and/or 00008 * modify it under the terms of the BSD License. 00009 * 00010 * All rights reserved. 00011 * 00012 * Redistribution and use in source and binary forms, with or without 00013 * modification, are permitted provided that the following conditions are met: 00014 * 00015 * 1. Redistributions of source code must retain the above copyright notice, 00016 * this list of conditions and the following disclaimer. 00017 * 00018 * 2. Redistributions in binary form must reproduce the above copyright notice, 00019 * this list of conditions and the following disclaimer in the documentation 00020 * and/or other materials provided with the distribution. 00021 * 00022 * 3. Neither the name of the authors nor the names of its contributors may be 00023 * used to endorse or promote products derived from this software without 00024 * specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00027 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00029 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00030 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00031 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00032 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00033 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00034 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00035 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00036 * POSSIBILITY OF SUCH DAMAGE. 00037 */ 00038 00039 /** 00040 * \file cvrLocationDetection.h 00041 * Contains the abstract class cvr::locationDetection, which 00042 * is the parent class of all local detection classes. 00043 * 00044 * \author Pablo Alvarado 00045 * \date 13.12.2007 00046 * 00047 * revisions ..: $Id: cvrLocationDetection.h,v 1.1 2007/12/19 02:54:36 alvarado Exp $ 00048 */ 00049 00050 #ifndef _CVR_LOCATION_DETECTION_H_ 00051 #define _CVR_LOCATION_DETECTION_H_ 00052 00053 #include "cvrChannel.h" 00054 #include "cvrLocation.h" 00055 #include "cvrChannel8.h" 00056 #include "cvrList.h" 00057 #include "cvrBoundaryType.h" 00058 #include "cvrFunctor.h" 00059 00060 namespace cvr { 00061 00062 /** 00063 * Abstract class locationDetection 00064 * 00065 * The location detection abstract class is the parent class of all location 00066 * detectors in the CVR-Lib. 00067 * 00068 * @see locationDetection::parameters. 00069 * 00070 * @ingroup gFeatureExtr 00071 */ 00072 class locationDetection : public functor { 00073 public: 00074 /** 00075 * The parameters for the class locationDetection 00076 */ 00077 class parameters : public functor::parameters { 00078 public: 00079 /** 00080 * Default constructor 00081 */ 00082 parameters(); 00083 00084 /** 00085 * Copy constructor 00086 * @param other the parameters object to be copied 00087 */ 00088 parameters(const parameters& other); 00089 00090 /** 00091 * Destructor 00092 */ 00093 ~parameters(); 00094 00095 /** 00096 * Copy the contents of a parameters object 00097 * @param other the parameters object to be copied 00098 * @return a reference to this parameters object 00099 */ 00100 parameters& copy(const parameters& other); 00101 00102 /** 00103 * Copy the contents of a parameters object 00104 * @param other the parameters object to be copied 00105 * @return a reference to this parameters object 00106 */ 00107 parameters& operator=(const parameters& other); 00108 00109 /** 00110 * Returns the complete name of the parameters class. 00111 */ 00112 virtual const std::string& name() const; 00113 00114 /** 00115 * Returns a pointer to a clone of the parameters. 00116 */ 00117 virtual parameters* clone() const; 00118 00119 /** 00120 * Returns a pointer to a new instance of the parameters. 00121 */ 00122 virtual parameters* newInstance() const; 00123 00124 /** 00125 * Write the parameters in the given ioHandler 00126 * @param handler the ioHandler to be used 00127 * @param complete if true (the default) the enclosing begin/end will 00128 * be also written, otherwise only the data block will be written. 00129 * @return true if write was successful 00130 */ 00131 virtual bool write(ioHandler& handler,const bool complete=true) const; 00132 00133 /** 00134 * Read the parameters from the given ioHandler 00135 * @param handler the ioHandler to be used 00136 * @param complete if true (the default) the enclosing begin/end will 00137 * be also written, otherwise only the data block will be written. 00138 * @return true if write was successful 00139 */ 00140 virtual bool read(ioHandler& handler,const bool complete=true); 00141 00142 // ------------------------------------------------ 00143 // the parameters 00144 // ------------------------------------------------ 00145 00146 /** 00147 * Boundary Type 00148 * 00149 * Specify how to consider the regions outside the given image. 00150 * 00151 * Default value: Constant 00152 */ 00153 eBoundaryType boundaryType; 00154 }; 00155 00156 /** 00157 * Default constructor 00158 */ 00159 locationDetection(); 00160 00161 /** 00162 * Copy constructor 00163 * @param other the object to be copied 00164 */ 00165 locationDetection(const locationDetection& other); 00166 00167 /** 00168 * Destructor 00169 */ 00170 virtual ~locationDetection(); 00171 00172 /** 00173 * Compute the locations based on the determinant of the "fast Hessian" 00174 * matrix. 00175 * 00176 * @param src channel8 with the source image. 00177 * @param locs lists of detected locations. 00178 * 00179 * @return true if apply successful or false otherwise. 00180 */ 00181 virtual bool apply(const channel8& src, list<location>& locs) const = 0; 00182 00183 /** 00184 * Compute the locations based on the determinant of the "fast Hessian" 00185 * matrix. 00186 * 00187 * @param src channel8 with the source image. 00188 * @param locs lists of detected locations. 00189 * 00190 * @return true if apply successful or false otherwise. 00191 */ 00192 virtual bool apply(const channel& src, list<location>& locs) const = 0; 00193 00194 /** 00195 * Compute the locations based on the determinant of the "fast Hessian" 00196 * matrix. 00197 * 00198 * This method provides numLocs = locs.size() directly. The reason is 00199 * simple: speed. The size() method needs to count the elements, and 00200 * this is usually done in the process. 00201 * 00202 * @param src channel8 with the source image. 00203 * @param locs lists of detected locations. 00204 * @param numLocs number of locations detected. 00205 * 00206 * @return true if apply successful or false otherwise. 00207 */ 00208 virtual bool apply(const channel8& src, 00209 list<location>& locs, 00210 int& numLocs) const = 0; 00211 00212 /** 00213 * Compute the locations based on the determinant of the "fast Hessian" 00214 * matrix. 00215 * 00216 * This method provides numLocs = locs.size() directly. The reason is 00217 * simple: speed. The size() method needs to count the elements, and 00218 * this is usually done in the process. 00219 * 00220 * @param src channel8 with the source image. 00221 * @param locs lists of detected locations. 00222 * @param numLocs number of locations detected. 00223 * 00224 * @return true if apply successful or false otherwise. 00225 */ 00226 virtual bool apply(const channel& src, 00227 list<location>& locs, 00228 int& numLocs) const = 0; 00229 00230 /** 00231 * Returns the complete name of the functor class 00232 */ 00233 virtual const std::string& name() const = 0; 00234 00235 /** 00236 * Returns a pointer to a clone of this functor. 00237 */ 00238 virtual locationDetection* clone() const = 0; 00239 00240 /** 00241 * Returns a pointer to a new instance of this functor. 00242 */ 00243 virtual locationDetection* newInstance() const = 0; 00244 00245 /** 00246 * Copy member 00247 */ 00248 locationDetection& copy(const locationDetection& other); 00249 00250 /** 00251 * Alias for copy member 00252 */ 00253 locationDetection& operator=(const locationDetection& other); 00254 00255 /** 00256 * Returns used parameters 00257 */ 00258 const parameters& getParameters() const; 00259 }; 00260 } 00261 00262 #endif 00263