opencv split vs mixChannels

asked 2014-10-21 21:31:39 -0500

tidy gravatar image

updated 2017-08-22 14:14:39 -0500

To separate hue channel from HSV image, here is the code using the mixChannels function:

/// Transform it to HSV
cvtColor( src, hsv, CV_BGR2HSV );

/// Use only the Hue value
hue.create( hsv.size(), hsv.depth() );
int ch[] = { 0, 0 };
mixChannels( &hsv, 1, &hue, 1, ch, 1 );

But I know split function can also do this:

vector<Mat> chs;
split(hsv, chs);
Mat hue = chs[0];

Is that OK? If these are the same, I think split method is more clean. Am I right?

edit retag flag offensive close merge delete