Statistics
| Branch: | Revision:

cyberalaska / include / cyberalaska / bullcolor.h @ master

History | View | Annotate | Download (1.19 KB)

1 c4b5e65c Dr. Orion Lawlor
/**
2
Adds a color gradient based angle detection scheme to the bullseye detector.
3

4
Dr. Orion Sky Lawlor, lawlor@alaska.edu, 2013-11-06 (Public Domain)
5
*/
6
#ifndef __CYBERALASKA__BULLCOLOR_H
7
#define __CYBERALASKA__BULLCOLOR_H
8
9 baed3a36 Dr. Orion Lawlor
#include "../rasterCV/bullseye.h"
10 3ef13d7e Dr. Orion Lawlor
#include "../cyberalaska/vec3.h"
11
12
// Silly utility function: like atan2, but takes a vector and returns degrees.
13
//   The vector (1,0,0) is 0.0 degrees.
14 d7c73a63 Mike Moss
inline double atan2_deg(cyberalaska::vec3 &dir) {
15 3ef13d7e Dr. Orion Lawlor
        return atan2(dir.y,dir.x)*180.0/M_PI;
16
}
17 c4b5e65c Dr. Orion Lawlor
18
/**
19
  Extracts additional data from around a previously detected bulls-eye.
20
*/
21 727dbd54 Dr. Orion Lawlor
class bullcolor : public bullseyeInfo {
22 c4b5e65c Dr. Orion Lawlor
public:
23 3ef13d7e Dr. Orion Lawlor
        cyberalaska::vec3 pixel; ///< pixel location of robot center (with z==0)
24 c4b5e65c Dr. Orion Lawlor
        float radius; ///< Estimate of bullseye radius (pixels)
25 d7c73a63 Mike Moss
26 c4b5e65c Dr. Orion Lawlor
        cv::Scalar color; ///< Whole-bullseye average color
27 d7c73a63 Mike Moss
28 3ef13d7e Dr. Orion Lawlor
        cyberalaska::vec3 dir; ///< Camera-coordinates direction vector (unit length)
29 c4b5e65c Dr. Orion Lawlor
        float angle; ///< 2D angle, as +-180 degrees (along camera's x axis -> 0.0 degrees)
30
        float confidence; ///< Confidence in our angle estimate (arbitrary units, 1.0 is decent)
31 d7c73a63 Mike Moss
32
        /**
33 c4b5e65c Dr. Orion Lawlor
         Extract color data around this bullseye, and use it to estimate position
34
        */
35 727dbd54 Dr. Orion Lawlor
        bullcolor(const bullseyeInfo &bi,cv::Mat &rgbImage);
36 c4b5e65c Dr. Orion Lawlor
};
37
38
39
#endif