From 7d06603075f5503945bb7fbbc1ae1becf037247a Mon Sep 17 00:00:00 2001 From: Sebastian Stabinger Date: Mon, 28 Oct 2024 15:06:04 +0100 Subject: [PATCH] Removes commented-out code related to tensor operations in `DetectTilt` class for cleanup. --- ocr_wrapper/tilt_correction.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/ocr_wrapper/tilt_correction.py b/ocr_wrapper/tilt_correction.py index 69f4731..4cca15c 100644 --- a/ocr_wrapper/tilt_correction.py +++ b/ocr_wrapper/tilt_correction.py @@ -213,7 +213,6 @@ def _calc_square_sum() -> np.ndarray: small_image_tensor.squeeze(0), self.contrast_kernel, mode="valid" ) - # small_image_tensor = torch.maximum(torch.tensor(0, device=self.device), small_image_tensor).square() # The contrast filter might have created negative values, which we remove now. # After that, we square the results. The reason is that the contrast filter only removes perfectly homogenous areas # of the some color - for all other pixel-areas we just reduce the pixel values. Squaring suppresses these small @@ -260,7 +259,6 @@ def _calc_square_sum() -> np.ndarray: dark_threshold = np.maximum(MINIMAL_DARK_VALUE, np.mean(small_image_tensor)) # Determine all pixel-indices of pixels above the dark_threshold (i.e. the ones which survive the filtering) - # indices = torch.where(work_tensor > dark_threshold) indices = np.where(work_tensor > dark_threshold) # We emulate rotating the image for various test_angles. For the rotation, we need the (x,y) positions of the pixels