Ask Your Question
0

Color Conversion to YCgCo [closed]

asked 2017-09-25 07:05:10 -0600

VxW gravatar image

Hi@all,

I would like to convert my RGB image to YCgCo, which is not included in OpenCV.

Is it possible to define my own Colorspace in OpenCV or what is the most efficient way to do such a conversion, respektively

Thanks

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by VxW
close date 2017-09-25 07:59:38.080739

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-09-25 07:44:32 -0600

berak gravatar image

no, unfortunately you cannot define your own colorspace.

an efficient way to do so will be quite advanced, just look at imgproc/src/color.cpp, to get an impression.

i can only offer an "easy to use" solution with transform

Mat bgr = ... // input
Mat ycgco;    // output
Mat_<float> m(3,3);  // values taken from wikipedia
m << .25, .5,  .25,
    -.25, .5, -.25,
     .5,   0, -.5;

transform(bgr, ycgco, m);
edit flag offensive delete link more

Comments

thanks a lot for the fast answer

VxW gravatar imageVxW ( 2017-09-25 07:59:15 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-09-25 07:05:10 -0600

Seen: 215 times

Last updated: Sep 25 '17