00001 /* 00002 Copyright 2005, 2006 Computer Vision Lab, 00003 Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland. 00004 All rights reserved. 00005 00006 This file is part of BazAR. 00007 00008 BazAR is free software; you can redistribute it and/or modify it under the 00009 terms of the GNU General Public License as published by the Free Software 00010 Foundation; either version 2 of the License, or (at your option) any later 00011 version. 00012 00013 BazAR is distributed in the hope that it will be useful, but WITHOUT ANY 00014 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 00015 PARTICULAR PURPOSE. See the GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License along with 00018 BazAR; if not, write to the Free Software Foundation, Inc., 51 Franklin 00019 Street, Fifth Floor, Boston, MA 02110-1301, USA 00020 */ 00021 #ifndef KEYPOINT_H 00022 #define KEYPOINT_H 00023 00024 #ifndef SKIP_OPENCV 00025 #include <cv.h> 00026 #endif 00027 00028 /* Feature points detection 00029 */ 00031 00035 class keypoint 00036 { 00037 public: 00038 keypoint(void) { u=-1; v=-1; scale=0; id=-1; } 00039 keypoint(float u, float v, float scale) { this->u = u; this->v = v; this->scale = scale; id=-1; } 00040 keypoint(const keypoint & p) { u = p.u; v = p.v; scale = p.scale; score = p.score; id=p.id; } 00041 virtual ~keypoint() {} 00042 00043 keypoint & operator =(const keypoint &p) { u = p.u; v = p.v; scale = p.scale; score = p.score; id=p.id; return *this; } 00044 00046 float u, v; 00047 float u_undist, v_undist; 00048 00049 int scale; 00050 float score; 00051 00052 int class_index; 00053 float class_score; 00054 00055 float fr_u(void) { int s = int(scale); int K = 1 << s; return K * u; } 00056 float fr_v(void) { int s = int(scale); int K = 1 << s; return K * v; } 00058 00060 float orientation ; 00061 00063 00064 float meanI, sigmaI; 00065 keypoint * potential_correspondent; 00066 float match_score; 00067 int i_bucket, j_bucket; 00068 00069 int index; // used to locate the keypoint in the keypoint array after matching. 00071 00072 int id; 00073 00074 }; 00075 00076 #ifndef SKIP_OPENCV 00077 00084 inline CvPoint mcvPoint(keypoint & p) 00085 { 00086 int s = int(p.scale); 00087 int K = 1 << s; 00088 return cvPoint(int(K * p.u + 0.5), int(K * p.v + 0.5)); 00089 } 00090 #endif 00091 00092 #endif // KEYPOINT_H