orientation.h
00001 /* 00002 * Player - One Hell of a Robot Server 00003 * Copyright (C) 2000 Brian Gerkey et al 00004 * gerkey@usc.edu 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 00022 /****************************************************** 00023 * orientation - header 00024 * 00025 * Description 00026 * estimate orientation of the ground object 00027 * 00028 ****************************************************** 00029 */ 00030 00031 #ifndef __ORIENTATION__H_ 00032 #define __ORIENTATION__H_ 00033 00034 #ifdef __cplusplus 00035 extern "C" 00036 { 00037 #endif 00038 00039 #include <stdio.h> 00040 #include <math.h> 00041 #include <cv.h> 00042 00043 00044 //Estimate the length between two points (cvpoint) 00045 double length(CvPoint *pnt1, CvPoint *pnt2); 00046 00047 //estimate direction of line 00048 int deltaline(CvPoint *pnt1, CvPoint *pnt2, char ch); 00049 00050 //estimate total difference between two lines (using delta x and delta y of 00051 //the the two points of a line) 00052 int difference(CvPoint *pnt1, CvPoint *pnt2, CvPoint *pnt3, CvPoint *pnt4, char ch); 00053 00054 //put length values of lines into array 00055 void fillarray(CvSeq *result); 00056 00057 //sort array 00058 void sortarray(); 00059 00060 //return centre point of two points 00061 CvPoint centralpoint(CvPoint pnt1, CvPoint pnt2); 00062 00063 //Get the central point between the two parallel lines 00064 CvPoint getcentralpoint(IplImage *image, CvSeq *res); 00065 00066 //pnt1 is center of mass of object, pnt2 is found central point 00067 //between parallel lines 00068 float getorientation(CvPoint pnt1, CvPoint pnt2); 00069 00070 #ifdef __cplusplus 00071 } 00072 #endif 00073 00074 #endif /* __ORIENTATION__H_ */