latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 2000, 2001, 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 Digital Image/Signal Processing Library 00026 * file .......: ltiOpticalFlowLK.h 00027 * authors ....: Bernd Mussmann, SUat Akyol 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 5.9.2000 00030 * revisions ..: $Id: ltiOpticalFlowLK.h,v 1.5 2006/02/08 11:35:16 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_OPTICAL_FLOW_LK_H_ 00034 #define _LTI_OPTICAL_FLOW_LK_H_ 00035 00036 // include files which are needed in this header!! 00037 00038 #include "ltiGradientKernels.h" 00039 #include "ltiGaussKernels.h" 00040 #include "ltiConvolution.h" 00041 #include "ltiImage.h" 00042 #include "ltiMatrix.h" 00043 #include "ltiEigenSystem.h" 00044 00045 // include parent class 00046 #include "ltiTransform.h" 00047 00048 namespace lti { 00049 /** 00050 * This class computes the optical flow between two consecutive images 00051 * according to the gradient based method of Lucas+Kanade. Optical flow 00052 * is determined by the velocity components u, v, which are searched to 00053 * complete the optical flow equation: 00054 * 00055 * I(x+u*delta_t, y+v*delta_t, t+delta_t) = I(x,y,t) + e 00056 * 00057 * I=intensity function, t=timeindex, x/y=coordinates, e=error 00058 * 00059 * Theory and Algorithm: 00060 * "Performance of Optical Flow Techniques", Barron+Fleet+Beauchemin, 00061 * IEEE CVPR, 1992. 00062 * "An iterative image registration technique with ...", Lucas+Kanade, 00063 * DARPA IU Workshop, 1981. 00064 */ 00065 class opticalFlowLK : public transform { 00066 public: 00067 /** 00068 * the parameters for the class opticalFlowLK 00069 */ 00070 class parameters : public transform::parameters { 00071 public: 00072 /** 00073 * default constructor 00074 */ 00075 parameters(); 00076 00077 /** 00078 * copy constructor 00079 * @param other the parameters object to be copied 00080 */ 00081 parameters(const parameters& other); 00082 00083 /** 00084 * destructor 00085 */ 00086 ~parameters(); 00087 00088 /** 00089 * returns name of this type 00090 */ 00091 const char* getTypeName() const; 00092 00093 /** 00094 * copy the contents of a parameters object 00095 * @param other the parameters object to be copied 00096 * @return a reference to this parameters object 00097 */ 00098 parameters& copy(const parameters& other); 00099 00100 /** 00101 * returns a pointer to a clone of the parameters 00102 */ 00103 virtual functor::parameters* clone() const; 00104 00105 /** 00106 * This is the size of the kernel for computing spatial derivatives. 00107 * kernelSize = 3,4,5 (default = 3) 00108 */ 00109 int kernelSize; 00110 00111 /** 00112 * This is the width and height of the square correlation window. 00113 * windowEdgeSize = 2,3,... (default = 7) 00114 */ 00115 int windowEdgeSize; 00116 }; 00117 00118 /** 00119 * default constructor 00120 */ 00121 opticalFlowLK(); 00122 00123 /** 00124 * copy constructor 00125 * @param other the object to be copied 00126 */ 00127 opticalFlowLK(const opticalFlowLK& other); 00128 00129 /** 00130 * destructor 00131 */ 00132 virtual ~opticalFlowLK(); 00133 00134 /** 00135 * returns the name of this type ("opticalFlowLK") 00136 */ 00137 virtual const char* getTypeName() const; 00138 00139 /** 00140 * operates on the given parameter. 00141 * @param at_t channel with the source data at time index t. 00142 * The x-component of the result (u) will be left here too. 00143 * @param at_delta_t channel with the source data at time index t+delta_t. 00144 * The y-component of the result (v) will be left here too. 00145 */ 00146 void apply(channel& at_t,channel& at_delta_t) const; 00147 00148 /** 00149 * operates on a copy of the given parameters. 00150 * @param at_t channel with the source data at time index t. 00151 * @param at_delta_t channel with the source data at time index t+delta_t. 00152 * @param u is the x-component of the resulting optical flow. 00153 * @param v is the y-component of the resulting optical flow. 00154 */ 00155 void apply(const channel& at_t, 00156 const channel& at_delta_t, 00157 channel& u, 00158 channel& v) const; 00159 00160 /** 00161 * copy data of "other" functor. 00162 * @param other the functor to be copied 00163 * @return a reference to this functor object 00164 */ 00165 opticalFlowLK& copy(const opticalFlowLK& other); 00166 00167 /** 00168 * returns a pointer to a clone of this functor. 00169 */ 00170 virtual functor* clone() const; 00171 00172 /** 00173 * returns used parameters 00174 */ 00175 const parameters& getParameters() const; 00176 }; 00177 } 00178 00179 #endif