简体   繁体   English

使用 opencv 进行图像颜色克隆

[英]Image color cloning using opencv

I was trying to clone the image color.我试图克隆图像颜色。 So far I have done with creating the mask and color it but I am getting the solid color of the image but I was expecting the output like this到目前为止,我已经完成了蒙版的创建和着色,但我得到了图像的纯色,但我期待像这样的 output

图片链接

    def colorchange(self):
        res = self.image_m_c              #Original Image
        copyimg = np.copy(res)

        r = self.t5.value()               #R,G,B Channel using slider
        g = self.t6.value()
        b = self.t7.value()

        copyimg = cv2.cvtColor(copyimg, cv2.COLOR_BGR2HSV)
        img = self.new_image              #Mask of the image


        copyimg[img!=0]=(b,g,r) #Coloring the mask

        copyimg = cv2.cvtColor(copyimg, cv2.COLOR_HSV2BGR)
        cv2.imshow("IMAGE",copyimg)

I think you can use Image Blending using Pyramids.我认为您可以使用 Pyramids 使用图像混合。 Here you can find more information about it:在这里您可以找到有关它的更多信息:

https://docs.opencv.org/master/dc/dff/tutorial_py_pyramids.html https://docs.opencv.org/master/dc/dff/tutorial_py_pyramids.html

https://theailearner.com/tag/image-blending-using-pyramids-opencv/ https://theailearner.com/tag/image-blending-using-pyramids-opencv/

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM