pyfusion.HIS 的原始碼

import cv2
import numpy as np
from .utils import histMatch

[文件]def HIS(src, pan): """Using HIS method to fusion the image The `source` image should not be upsampled :param src: `source` image, the image should be BGR color space :param pan: Panchromatic image, the image should be grayscale :return: fusion image :rtype: `numpy.ndarray` """ # upsamply the image img_bgr = cv2.resize(src, tuple(reversed(pan.shape))) # convert the color space img_HLS = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2HLS) # histogram match dst_pan = histMatch(pan, img_HLS[:,:,1]) # merge the new image img_fusion_HLS = cv2.merge((img_HLS[:,:,0], dst_pan, img_HLS[:,:,2])) # convert color space img_fusion_BGR = cv2.cvtColor(img_fusion_HLS, cv2.COLOR_HLS2BGR) return img_fusion_BGR