Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

opencv split vs mixChannels

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?

opencv split vs mixChannels

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?