I have a color that I want to convert to a different color space. Is it possible to use cvtColor
on a cv::Vec3f
directly without creating a 1x1 cv::Mat
and populating it with that pixel, using cvtColor
on the cv::Mat
, then getting the only pixel out of the output? I have tried the following, but it doesn't seem to like getting passed a vector.
Any suggestions?
#include #include int main(int, char*[]) { cv::Vec3f hsv; hsv[0] = .9; hsv[1] = .8; hsv[2] = .7; std::cout
I also tried this, but get a different error:
#include #include int main(int, char*[]) { cv::Mat_<:vec3f> hsv(cv::Vec3f(0.7, 0.7, 0.8)); std::cout bgr; cvtColor(hsv, bgr, CV_HSV2BGR); // OpenCV Error: Assertion failed (!fixedType() || ((Mat*)obj)->type() == mtype) in create std::cout