jugggernault commited on
Commit
bbcdd70
·
1 Parent(s): b7828ff

fix: correct pixels values range in log trans

Browse files
Files changed (1) hide show
  1. improcess.py +3 -2
improcess.py CHANGED
@@ -47,9 +47,10 @@ def binarize(image) -> np.ndarray:
47
 
48
 
49
  def log_trans(image) -> np.ndarray:
 
50
  c = 255 / np.log(1 + np.max(image))
51
-
52
- log_img = c * np.log(image + 1)
53
  return log_img.astype("uint8")
54
 
55
 
 
47
 
48
 
49
  def log_trans(image) -> np.ndarray:
50
+ image = image.astype(float)
51
  c = 255 / np.log(1 + np.max(image))
52
+ log_img = c * np.log(1 + image)
53
+ log_img = np.clip(log_img, 0, 255)
54
  return log_img.astype("uint8")
55
 
56