Split and Merge two separate images (one BGR, one IR only)

Hello all,

Having an issue with dealing with splitting two images at same time.

Goal: import two images, split them both into 3 bands each, and then merge 2 bands from one image and one band from the other into a single image.

Essentially I built a camera with two lenses… one is a normal RGB, one has a very specific narrow IR band filter. I want to make false color images, so I want to merge say the G and B bands with one of the bands from the IR image. I built it this way because I need to change it to UV filter sometimes and I also need the IR only image separately.

The lenses are offset, but I’ve got that under control to be close enough to being the same. Images will be of same size so no worries on that either. Just looking to import two images, split them both into 3 bands each, and then merge 2 bands from one image and one band from the other into a single image.

Thanks!

well there’s cv::split and cv::merge, but if you use python, numpy has much more convenient methods (slicing, and the np.stack family of functions)