orientation.h
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2000 Brian Gerkey et al
4  * gerkey@usc.edu
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  */
21 
22 /******************************************************
23  * orientation - header
24  *
25  * Description
26  * estimate orientation of the ground object
27  *
28  ******************************************************
29  */
30 
31 #ifndef __ORIENTATION__H_
32 #define __ORIENTATION__H_
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
39 #include <stdio.h>
40 #include <math.h>
41 #include <opencv2/opencv.hpp>
42 
43 
44 //Estimate the length between two points (cvpoint)
45 double length(CvPoint *pnt1, CvPoint *pnt2);
46 
47 //estimate direction of line
48 int deltaline(CvPoint *pnt1, CvPoint *pnt2, char ch);
49 
50 //estimate total difference between two lines (using delta x and delta y of
51 //the the two points of a line)
52 int difference(CvPoint *pnt1, CvPoint *pnt2, CvPoint *pnt3, CvPoint *pnt4, char ch);
53 
54 //put length values of lines into array
55 void fillarray(CvSeq *result);
56 
57 //sort array
58 void sortarray();
59 
60 //return centre point of two points
61 CvPoint centralpoint(CvPoint pnt1, CvPoint pnt2);
62 
63 //Get the central point between the two parallel lines
64 CvPoint getcentralpoint(IplImage *image, CvSeq *res);
65 
66 //pnt1 is center of mass of object, pnt2 is found central point
67 //between parallel lines
68 float getorientation(CvPoint pnt1, CvPoint pnt2);
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif /* __ORIENTATION__H_ */
uint32_t data_count
Size of data as stored in buffer (bytes)
Definition: player_interfaces.h:3447
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:159
Generic message header.
Definition: player.h:161
virtual int MainSetup(void)
Sets up the resources needed by the driver thread.
Definition: driver.h:658
virtual void MainQuit(void)
Cleanup method for driver thread (called when main exits)
Definition: driver.h:664
Encapsulates a device (i.e., a driver bound to an interface)
Definition: device.h:74
const char * ReadString(int section, const char *name, const char *value)
Read a string value.
virtual void Main(void)=0
Main method for driver thread.
int ReadInt(int section, const char *name, int value)
Read an integer value.
#define PLAYER_OPAQUE_DATA_STATE
Data subtype: generic state.
Definition: player_interfaces.h:3429
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:95
Definition: camera.h:149
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
#define PLAYER_MSGTYPE_REQ
A request message.
Definition: player.h:106
int ReadDeviceAddr(player_devaddr_t *addr, int section, const char *name, int code, int index, const char *key)
Read a device id.
Class for loading configuration file information.
Definition: configfile.h:196
A device address.
Definition: player.h:145
An autopointer for the message queue.
Definition: message.h:73
#define PLAYER_OPAQUE_REQ_DATA
Req subtype: generic request.
Definition: player_interfaces.h:3435
#define PLAYER_ERROR(msg)
Error message macros.
Definition: error.h:81
Base class for drivers which oeprate with a thread.
Definition: driver.h:552
Reference-counted message objects.
Definition: message.h:132
#define PLAYER_WARN(msg)
Warning message macros.
Definition: error.h:89
#define PLAYER_MSGTYPE_CMD
A command message.
Definition: player.h:99
#define PLAYER_OPAQUE_CMD_DATA
Cmd subtype: generic command.
Definition: player_interfaces.h:3432
data
Definition: player_interfaces.h:3444
Base class for all drivers.
Definition: driver.h:108
#define PLAYER_MSGQUEUE_DEFAULT_MAXLEN
Default maximum length for a message queue.
Definition: player.h:76
uint8_t * data
The data we will be sending.
Definition: player_interfaces.h:3449