Does opencv have a constexpr vector or matrix container?

Viewed 38

I would like to do something like this for example:

constexpr std::array<cv::Vec3b, 6> COLORS {
    cv::Vec3b(0, 255, 0), // green
    cv::Vec3b(255, 0, 0), // blue
    cv::Vec3b(0, 0, 255), // red
    cv::Vec3b(0, 255, 255), // yellow
    cv::Vec3b(255, 0, 255), // magenta
    cv::Vec3b(255, 255, 0) // cyan
}

However, cv::Vec3b cannot be made constexpr, is there support for constexpr containers in opencv? Or another way around this?

Compiler error:

error: the type ‘const std::vector<cv::Vec<unsigned char, 3> >’ of ‘constexpr’ variable ‘COLORS’ is not literal
 };

Thank you

0 Answers
Related