def __call__(self, scale, gradient_threshold): canny_image = _edgedetect.canny_edge_image(self, scale, gradient_threshold) canny_image_onebit = canny_image.to_onebit() """ LAPLACIAN OF GAUSSIAN (recreated from convolution.py) """ smooth = _convolution.GaussianKernel(scale) deriv = _convolution.GaussianDerivativeKernel(scale, 2) fp = self.to_float() tmp = fp.convolve_x(deriv) tmp_x = tmp.convolve_y(smooth) tmp = fp.convolve_x(smooth) tmp_y = tmp.convolve_y(deriv) lap = _arithmetic.add_images(tmp_x, tmp_y, False) """ Bias high-confidence background pixels """ gsmooth_image = self.convolve_xy(_convolution.GaussianKernel(scale), border_treatment = 3) img2 = _arithmetic.subtract_images(self, gsmooth_image, False) squared_img2 = _arithmetic.multiply_images(img2, img2, False) gsmooth_img2 = img2.convolve_xy(_convolution.GaussianKernel(scale), border_treatment = 3) gsmooth_squared_img2 = squared_img2.convolve_xy(_convolution.GaussianKernel(scale), border_treatment = 3) rms = squareRoot(gsmooth_squared_img2) threshold_img = checkThreshold(rms, 12) return lap
def __call__(self, scale, gradient_threshold): canny_image = _edgedetect.canny_edge_image(self, scale, gradient_threshold) canny_image_onebit = canny_image.to_onebit() """ LAPLACIAN OF GAUSSIAN (recreated from convolution.py) """ smooth = _convolution.GaussianKernel(scale) deriv = _convolution.GaussianDerivativeKernel(scale, 2) fp = self.to_float() tmp = fp.convolve_x(deriv) tmp_x = tmp.convolve_y(smooth) tmp = fp.convolve_x(smooth) tmp_y = tmp.convolve_y(deriv) lap = _arithmetic.add_images(tmp_x, tmp_y, False) """ Bias high-confidence background pixels """ gsmooth_image = self.convolve_xy(_convolution.GaussianKernel(scale), border_treatment=3) img2 = _arithmetic.subtract_images(self, gsmooth_image, False) squared_img2 = _arithmetic.multiply_images(img2, img2, False) gsmooth_img2 = img2.convolve_xy(_convolution.GaussianKernel(scale), border_treatment=3) gsmooth_squared_img2 = squared_img2.convolve_xy(_convolution.GaussianKernel(scale), border_treatment=3) rms = squareRoot(gsmooth_squared_img2) threshold_img = checkThreshold(rms, 12) return lap
def __call__(self, scale=1.0): smooth = _convolution.GaussianKernel(scale) deriv = _convolution.GaussianDerivativeKernel(scale, 2) fp = self.to_float() tmp = fp.convolve_x(deriv) tmp_x = tmp.convolve_y(smooth) tmp = fp.convolve_x(smooth) tmp_y = tmp.convolve_y(deriv) result = _arithmetic.add_images(tmp_x, tmp_y, False) if self.data.pixel_type == GREYSCALE: return result.to_greyscale() if self.data.pixel_type == GREY16: return result.to_grey16() return result
def __call__(self, other, in_place=False): if self.data.pixel_type == ONEBIT: return _logical.or_image(self, other, in_place) return _arithmetic.add_images(self, other, in_place)