cyberalaska / include / cyberalaska / bullcolor.h @ master
History  View  Annotate  Download (1.19 KB)
1 
/**


2 
Adds a color gradient based angle detection scheme to the bullseye detector.

3 

4 
Dr. Orion Sky Lawlor, lawlor@alaska.edu, 20131106 (Public Domain)

5 
*/

6 
#ifndef __CYBERALASKA__BULLCOLOR_H

7 
#define __CYBERALASKA__BULLCOLOR_H

8  
9 
#include "../rasterCV/bullseye.h" 
10 
#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 
inline double atan2_deg(cyberalaska::vec3 &dir) { 
15 
return atan2(dir.y,dir.x)*180.0/M_PI; 
16 
} 
17  
18 
/**

19 
Extracts additional data from around a previously detected bullseye.

20 
*/

21 
class bullcolor : public bullseyeInfo { 
22 
public:

23 
cyberalaska::vec3 pixel; ///< pixel location of robot center (with z==0)

24 
float radius; ///< Estimate of bullseye radius (pixels) 
25  
26 
cv::Scalar color; ///< Wholebullseye average color

27  
28 
cyberalaska::vec3 dir; ///< Cameracoordinates direction vector (unit length)

29 
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  
32 
/**

33 
Extract color data around this bullseye, and use it to estimate position

34 
*/

35 
bullcolor(const bullseyeInfo &bi,cv::Mat &rgbImage);

36 
}; 
37  
38  
39 
#endif

40 