elif input.nChannels == 3:
# Change the order of channels from BGR to RGB
rgb = cv.cvCreateImage(cv.cvSize(input.width, input.height), input.depth, 3)
cv.cvCvtColor(input, rgb, cv.CV_BGR2RGB)
array_1d = numpy.fromstring(rgb.imageData, dtype=ipl2dtype[key])
elif input.nChannels == 3:
# Change the order of channels from BGR to RGB
rgb = cv.cvCreateImage(cv.cvSize(input.width, input.height), input.depth, 3)
cv.cvCvtColor(input, rgb, cv.CV_BGR2RGB)
array_1d = numpy.fromstring(rgb.imageData, dtype=ipl2dtype[key])