I think cvSplit
is what you are looking for ( docs ). You can use it, for example, to split RGB into R, G and B:
CvSize s = cvSize(src->width, src->height); int d = src->depth; IplImage* R = cvCreateImage(s, d, 1); IplImage* G = cvCreateImage(s, d, 1); IplImage* B = cvCreateImage(s, d, 1); cvSplit(src, R, G, B, null);
Please note that you need to be careful when ordering; make sure that the original image is actually ordered as R, G, B (there is a decent probability of B, G, R).
dantswain
source share