Split 4-channel .tif UAV image to separate files according to the channel

  1. check img.shape
    you probably loaded the image without IMREAD_UNCHANGED, which means OpenCV automatically converts it to (some type of) BGR, losing the extra channel
    it may still reorder the channels. I don’t know exactly how it’ll behave. check the docs and/or run the function and check the results to be sure.

  2. you’re using python. you can also use numpy means:
    (ch1, ch2, ch3, ch4) = np.transpose(img, axes=(2,0,1))

1 Like