Python cv2.CV_8UC1 Examples

The following are 5 code examples of cv2.CV_8UC1(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module cv2 , or try the search function .
Example #1
Source File: BloodVessels.py    From Diabetic-Retinopathy-Feature-Extraction-using-Fundus-Images with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #2
Source File: img_tools.py    From crossgap_il_rl with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #3
Source File: img_tools.py    From crossgap_il_rl with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #4
Source File: img_tools.py    From crossgap_il_rl with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #5
Source File: stereo_matcher_app.py    From cvcalib with Apache License 2.0 5 votes vote down vote up
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)