1 | initial version |
My question still remains, but what I guess you are looking for is
Mat image_BGR, image_HSV; imread("/path/to/image", IMREAD_COLOR); cvtColor(image_BGR, image_HSV, COLOR_BGR2HSV); vector<mat> channels; split(image_HSV, channels); Mat S_channel = channels[1].clone(); // do some processing on the S channel here and store it back in S_channel // Make a 3 channel image again exactly like the modified S-channel looking Mat merged(image_HSV.rows, image_HSV.cols, CV_8UC3); Mat in[] = { S_channel, S_channel, S_channel }; int from_to[] = { 0,0, 1,1, 2,2 }; mixChannels( in, 3, &merged, 1, from_to, 3 );
Good luck!
2 | No.2 Revision |
My question still remains, but what I guess you are looking for is
Mat image_BGR, image_HSV;
imread("/path/to/image", IMREAD_COLOR);
cvtColor(image_BGR, image_HSV, COLOR_BGR2HSV);
Good luck!