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) grad = _convolution.GaussianDerivativeKernel(scale, 1) tmp = self.convolve_x(grad) result_x = tmp.convolve_y(smooth) tmp = self.convolve_x(smooth) result_y = tmp.convolve_y(grad) return result_x, result_y
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, scale=1.0): smooth = _convolution.GaussianKernel(scale) deriv1 = _convolution.GaussianDerivativeKernel(scale, 1) deriv2 = _convolution.GaussianDerivativeKernel(scale, 2) fp = self.to_float() tmp = fp.convolve_x(deriv2) tmp_x = tmp.convolve_y(smooth) tmp = fp.convolve_x(smooth) tmp_y = tmp.convolve_y(deriv2) tmp = fp.convolve_x(deriv1) tmp_xy = fp.convolve_y(deriv1) if self.data.pixel_type == GREYSCALE: return tmp_x.to_greyscale(), tmp_y.to_greyscale( ), tmp_xy.to_greyscale() if self.data.pixel_type == GREY16: return tmp_x.to_grey16(), tmp_y.to_grey16(), tmp_xy.to_grey16() return result
def __call__(self, std_dev=1.0): return self.convolve_xy(_convolution.GaussianKernel(std_dev), border_treatment=BORDER_TREATMENT_REFLECT)