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


Python cv2.CV_8UC1屬性代碼示例

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


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

示例1: process_output

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_8UC1 [as 別名]
def process_output(self, disparity):
        cv8uc = cv2.normalize(disparity, None, alpha=0, beta=255, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_8UC1)
        if self.args.preview:
            cv2.imshow("disparity", cv8uc)
            cv2.waitKey(0)
        cv2.imwrite(os.path.join(self.args.folder, self.args.output), cv8uc) 
開發者ID:Algomorph,項目名稱:cvcalib,代碼行數:8,代碼來源:stereo_matcher_app.py

示例2: applyKirschFilter

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_8UC1 [as 別名]
def applyKirschFilter(self):
        gray = self.curImg
        if gray.ndim > 2:
            raise Exception("illegal argument: input must be a single channel image (gray)")
        kernelG1 = np.array([[ 5,  5,  5],
                             [-3,  0, -3],
                             [-3, -3, -3]], dtype=np.float32)
        kernelG2 = np.array([[ 5,  5, -3],
                             [ 5,  0, -3],
                             [-3, -3, -3]], dtype=np.float32)
        kernelG3 = np.array([[ 5, -3, -3],
                             [ 5,  0, -3],
                             [ 5, -3, -3]], dtype=np.float32)
        kernelG4 = np.array([[-3, -3, -3],
                             [ 5,  0, -3],
                             [ 5,  5, -3]], dtype=np.float32)
        kernelG5 = np.array([[-3, -3, -3],
                             [-3,  0, -3],
                             [ 5,  5,  5]], dtype=np.float32)
        kernelG6 = np.array([[-3, -3, -3],
                             [-3,  0,  5],
                             [-3,  5,  5]], dtype=np.float32)
        kernelG7 = np.array([[-3, -3,  5],
                             [-3,  0,  5],
                             [-3, -3,  5]], dtype=np.float32)
        kernelG8 = np.array([[-3,  5,  5],
                             [-3,  0,  5],
                             [-3, -3, -3]], dtype=np.float32)
    
        g1 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG1), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
        g2 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG2), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
        g3 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG3), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
        g4 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG4), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
        g5 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG5), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
        g6 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG6), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
        g7 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG7), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
        g8 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG8), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
        magn = cv2.max(g1, cv2.max(g2, cv2.max(g3, cv2.max(g4, cv2.max(g5, cv2.max(g6, cv2.max(g7, g8)))))))
        self.curImg = magn 
開發者ID:ebdulrasheed,項目名稱:Diabetic-Retinopathy-Feature-Extraction-using-Fundus-Images,代碼行數:41,代碼來源:BloodVessels.py

示例3: float_img_to_display

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_8UC1 [as 別名]
def float_img_to_display(_img):
        img = _img
        max_value = 1000
        rows, cols = img.shape
        for i in range(rows):
            for j in range(cols):
                if (img[i, j] > max_value):
                    img[i, j] = max_value
        dist1 = cv2.convertScaleAbs(img)
        dist2 = cv2.normalize(dist1, None, 255, 0, cv2.NORM_MINMAX, cv2.CV_8UC1)
        return dist1
        # return dist2 
開發者ID:hku-mars,項目名稱:crossgap_il_rl,代碼行數:14,代碼來源:img_tools.py


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