segment_map.hh
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2010
4  * Mayte Lázaro, Alejandro R. Mosteo
5  *
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 
23 #ifndef SEG_MAP_H_
24 #define SEG_MAP_H_
25 
26 #include <vector>
27 #include "transf.hh"
28 
30 {
31 public:
32  SegmentMap();
33  SegmentMap(string filename);
34  virtual ~SegmentMap();
35 
36  void AddSegment(double x1, double y1, double x2, double y2);
37 
38  bool IsEmpty(void) const;
39 
40  int NumSegments(void) const;
41 
42  Transf segments(int i) const;
43  double lengths(int i) const;
44 
45 private:
46  vector<Transf> segments_;
47  vector<double> lengths_;
48 };
49 
50 #endif /* SEG_MAP_H_ */
#define PLAYER_WARN1(msg, a)
Error message macros.
Definition: error.h:90
uint32_t blobs_count
The number of blobs.
Definition: player_interfaces.h:1103
Data: detected blobs (PLAYER_BLOBFINDER_DATA_BLOBS)
Definition: player_interfaces.h:1096
uint32_t color
A descriptive color for the blob (useful for gui's).
Definition: player_interfaces.h:1074
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:159
uint32_t right
Bounding box for the blob [pixels].
Definition: player_interfaces.h:1084
uint32_t height
The image dimensions.
Definition: player_interfaces.h:1101
uint32_t left
Bounding box for the blob [pixels].
Definition: player_interfaces.h:1082
Generic message header.
Definition: player.h:161
virtual int MainSetup(void)
Sets up the resources needed by the driver thread.
Definition: driver.h:658
uint32_t compression
Image compression; PLAYER_CAMERA_COMPRESS_RAW indicates no compression.
Definition: player_interfaces.h:2966
#define PLAYER_WARN5(msg, a, b, c, d, e)
Error message macros.
Definition: error.h:94
virtual void MainQuit(void)
Cleanup method for driver thread (called when main exits)
Definition: driver.h:664
uint32_t width
Image dimensions [pixels].
Definition: player_interfaces.h:2953
uint32_t bottom
Bounding box for the blob [pixels].
Definition: player_interfaces.h:1088
Encapsulates a device (i.e., a driver bound to an interface)
Definition: device.h:74
#define PLAYER_BLOBFINDER_DATA_BLOBS
Structure describing a single blob.
Definition: player_interfaces.h:1055
uint32_t fdiv
Some images (such as disparity maps) use scaled pixel values; for these images, fdiv specifies the sc...
Definition: player_interfaces.h:2963
virtual void Main(void)=0
Main method for driver thread.
const char * ReadTupleString(int section, const char *name, int index, const char *value)
Read a string from a tuple field.
uint32_t image_count
Size of image data as stored in image buffer (bytes)
Definition: player_interfaces.h:2968
int ReadInt(int section, const char *name, int value)
Read an integer value.
uint32_t y
The blob centroid [pixels].
Definition: player_interfaces.h:1080
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:95
float range
Range to the blob center [meters].
Definition: player_interfaces.h:1090
uint32_t area
The blob area [pixels].
Definition: player_interfaces.h:1076
#define PLAYER_WARN2(msg, a, b)
Error message macros.
Definition: error.h:91
#define PLAYER_CAMERA_DATA_STATE
Data subtype: state.
Definition: player_interfaces.h:2922
uint8_t * image
Compressed image data (byte-aligned, row major order).
Definition: player_interfaces.h:2972
uint32_t id
Blob id.
Definition: player_interfaces.h:1071
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
static bool MatchDeviceAddress(player_devaddr_t addr1, player_devaddr_t addr2)
Compare two addresses.
Definition: device.h:201
Integer property class.
Definition: property.h:114
int ReadDeviceAddr(player_devaddr_t *addr, int section, const char *name, int code, int index, const char *key)
Read a device id.
Data: state (PLAYER_CAMERA_DATA_STATE)
Definition: player_interfaces.h:2950
uint32_t top
Bounding box for the blob [pixels].
Definition: player_interfaces.h:1086
int GetTupleCount(int section, const char *name)
Get the number of values in a tuple.
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
uint32_t format
Image format (must be compatible with depth).
Definition: player_interfaces.h:2959
#define PLAYER_ERROR1(msg, a)
Error message macros.
Definition: error.h:82
uint32_t width
The image dimensions.
Definition: player_interfaces.h:1099
#define PLAYER_CAMERA_COMPRESS_RAW
Compression method: raw.
Definition: player_interfaces.h:2945
#define PLAYER_ERROR(msg)
Error message macros.
Definition: error.h:81
Base class for drivers which oeprate with a thread.
Definition: driver.h:552
#define PLAYER_CAMERA_FORMAT_MONO8
Image format : 8-bit monochrome.
Definition: player_interfaces.h:2936
player_blobfinder_blob_t * blobs
The list of blobs.
Definition: player_interfaces.h:1105
double timestamp
Time associated with message contents (seconds since epoch)
Definition: player.h:170
#define PLAYER_WARN(msg)
Warning message macros.
Definition: error.h:89
Base class for all drivers.
Definition: driver.h:108
Structure describing a single blob.
Definition: player_interfaces.h:1068
#define PLAYER_WARN4(msg, a, b, c, d)
Error message macros.
Definition: error.h:93
uint32_t x
The blob centroid [pixels].
Definition: player_interfaces.h:1078
uint32_t height
Image dimensions [pixels].
Definition: player_interfaces.h:2955
Definition: transf.hh:36
Definition: segment_map.hh:29
#define PLAYER_CAMERA_COMPRESS_JPEG
Compression method: jpeg.
Definition: player_interfaces.h:2947
uint32_t bpp
Image bits-per-pixel (8, 16, 24, 32).
Definition: player_interfaces.h:2957