Skip to content

Commit

Permalink
Removes commented-out code related to tensor operations in `DetectTil…
Browse files Browse the repository at this point in the history
…t` class for cleanup.
  • Loading branch information
Paethon committed Oct 28, 2024
1 parent 4ce04e4 commit 7d06603
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions ocr_wrapper/tilt_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7d06603

Please sign in to comment.