VisionServer  v2.1.1-1-g21dc5465
FRC vision library
extensions.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <type_traits>
5
6#include "opencv2/opencv.hpp"
7
8
9namespace vs2 {
10
11enum class BGR {
12 BLUE = 0,
13 GREEN = 1,
14 RED = 2
15};
16
17template<typename t = uint16_t>
18inline t operator~(BGR v) {
19 static_assert(std::is_arithmetic<t>::value, "Template paramter (t) must be arithmetic type.");
20 return static_cast<t>(v);
21}
22
23inline static std::array<std::array<uint16_t, 2>, 3> weights_map{
24 std::array<uint16_t, 2>{~BGR::GREEN, ~BGR::RED}, // blue
25 std::array<uint16_t, 2>{~BGR::BLUE, ~BGR::RED}, // green
26 std::array<uint16_t, 2>{~BGR::BLUE, ~BGR::GREEN}, // red
27};
28
29
30
31} // namespace vs2
32
33
34inline static const std::array<std::array<cv::Scalar, 3>, 3> markup_map{
35 std::array<cv::Scalar, 3>{cv::Scalar(255, 0, 0), cv::Scalar(255, 127, 0), cv::Scalar(255, 255, 0)}, //blue
36 std::array<cv::Scalar, 3>{cv::Scalar(0, 255, 0), cv::Scalar(0, 255, 127), cv::Scalar(0, 255, 255)}, //green
37 std::array<cv::Scalar, 3>{cv::Scalar(0, 0, 255), cv::Scalar(127, 0, 255), cv::Scalar(255, 0, 255)}, //red
38};
static const std::array< std::array< cv::Scalar, 3 >, 3 > markup_map
Definition: extensions.h:34
Definition: extensions.h:9
t operator~(BGR v)
Definition: extensions.h:18
static std::array< std::array< uint16_t, 2 >, 3 > weights_map
Definition: extensions.h:23