當前位置: 首頁>>代碼示例>>Python>>正文


Python cv2.CV_8UC3屬性代碼示例

本文整理匯總了Python中cv2.CV_8UC3屬性的典型用法代碼示例。如果您正苦於以下問題:Python cv2.CV_8UC3屬性的具體用法?Python cv2.CV_8UC3怎麽用?Python cv2.CV_8UC3使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在cv2的用法示例。


在下文中一共展示了cv2.CV_8UC3屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: renderEnvLuminosityNoise

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_8UC3 [as 別名]
def renderEnvLuminosityNoise(self, origin_image, noise_var=0.1, in_RGB=False, out_RGB=False):
        """
        render the different environment luminosity
        """
        # variate luminosity and color
        origin_image_LAB = cv2.cvtColor(
            origin_image, cv2.COLOR_RGB2LAB if in_RGB else cv2.COLOR_BGR2LAB, cv2.CV_32F)
        origin_image_LAB[:, :, 0] = origin_image_LAB[:,
                                                     :, 0] * (np.random.randn() * noise_var + 1.0)
        origin_image_LAB[:, :, 1] = origin_image_LAB[:,
                                                     :, 1] * (np.random.randn() * noise_var + 1.0)
        origin_image_LAB[:, :, 2] = origin_image_LAB[:,
                                                     :, 2] * (np.random.randn() * noise_var + 1.0)
        out_image = cv2.cvtColor(
            origin_image_LAB, cv2.COLOR_LAB2RGB if out_RGB else cv2.COLOR_LAB2BGR, cv2.CV_8UC3)
        return out_image 
開發者ID:araffin,項目名稱:robotics-rl-srl,代碼行數:18,代碼來源:omnirobot_simulator_server.py

示例2: __init__

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_8UC3 [as 別名]
def __init__(self, path, queueSize=128):
        # initialize the file video stream along with the boolean
        # used to indicate if the thread should be stopped or not
        self.stream = cv2.VideoCapture(path)
        self.stopped = False
        self.count = 0

        # initialize the queue used to store frames read from
        # the video file
        self.Q = Queue(maxsize=queueSize)

        # We need some info from the file first. See more at:
        # https://docs.opencv.org/4.1.0/d4/d15/group__videoio__flags__base.html#gaeb8dd9c89c10a5c63c139bf7c4f5704d
        self.width = int(self.stream.get(cv2.CAP_PROP_FRAME_WIDTH))
        self.height = int(self.stream.get(cv2.CAP_PROP_FRAME_HEIGHT))

        # since this version uses UMat to store the images to
        # we need to initialize them beforehand
        self.frames = [0] * queueSize
        for ii in range(queueSize):
            self.frames[ii] = cv2.UMat(self.height, self.width, cv2.CV_8UC3) 
開發者ID:Kjue,項目名稱:python-opencv-gpu-video,代碼行數:23,代碼來源:UMatFileVideoStream.py

示例3: watershed

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_8UC3 [as 別名]
def watershed(self):
        m = self.markers.copy()
        cv2.watershed(self.img, m)
        overlay = self.colors[np.maximum(m, 0)]
        vis = cv2.addWeighted(self.img, 0.5, overlay, 0.5, 0.0, dtype=cv2.CV_8UC3)
        cv2.imshow('watershed', vis) 
開發者ID:makelove,項目名稱:OpenCV-Python-Tutorial,代碼行數:8,代碼來源:watershed.py

示例4: process

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_8UC3 [as 別名]
def process(img, filters):
    accum = np.zeros_like(img)
    for kern in filters:
        fimg = cv2.filter2D(img, cv2.CV_8UC3, kern)
        np.maximum(accum, fimg, accum)
    return accum 
開發者ID:makelove,項目名稱:OpenCV-Python-Tutorial,代碼行數:8,代碼來源:gabor_threads.py

示例5: process_threaded

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_8UC3 [as 別名]
def process_threaded(img, filters, threadn = 8):
    accum = np.zeros_like(img)
    def f(kern):
        return cv2.filter2D(img, cv2.CV_8UC3, kern)
    pool = ThreadPool(processes=threadn)
    for fimg in pool.imap_unordered(f, filters):
        np.maximum(accum, fimg, accum)
    return accum 
開發者ID:makelove,項目名稱:OpenCV-Python-Tutorial,代碼行數:10,代碼來源:gabor_threads.py

示例6: read

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_8UC3 [as 別名]
def read(self, dst=None):
        w, h = self.frame_size

        if self.bg is None:
            buf = np.zeros((h, w, 3), np.uint8)
        else:
            buf = self.bg.copy()

        self.render(buf)

        if self.noise > 0.0:
            noise = np.zeros((h, w, 3), np.int8)
            cv2.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)
            buf = cv2.add(buf, noise, dtype=cv2.CV_8UC3)
        return True, buf 
開發者ID:makelove,項目名稱:OpenCV-Python-Tutorial,代碼行數:17,代碼來源:video.py

示例7: read

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_8UC3 [as 別名]
def read(self, dst=None):
        w, h = self.frame_size

        if self.bg is None:
            buf = np.zeros((h, w, 3), np.uint8)
        else:
            buf = self.bg.copy()

        self.render(buf)

        if self.noise > 0.0:
            noise = np.zeros((h, w, 3), np.int8)
            cv2.randn(noise, np.zeros(3), np.ones(3) * 255 * self.noise)
            buf = cv2.add(buf, noise, dtype=cv2.CV_8UC3)
        return True, buf 
開發者ID:mengli,項目名稱:MachineLearning,代碼行數:17,代碼來源:video.py

示例8: read

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_8UC3 [as 別名]
def read(self, dst=None):
        w, h = self.frame_size

        if self.bg is None:
            buf = np.zeros((h, w, 3), np.uint8)
        else:
            buf = self.bg.copy()

        self.render(buf)

        if self.noise > 0.0:
            noise = np.zeros((h, w, 3), np.int8)
            cv.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)
            buf = cv.add(buf, noise, dtype=cv.CV_8UC3)
        return True, buf 
開發者ID:thunil,項目名稱:TecoGAN,代碼行數:17,代碼來源:video.py


注:本文中的cv2.CV_8UC3屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。