Skip to content

Commit

Permalink
Apply python black style 🎱
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamdasn committed Dec 26, 2023
1 parent b9067db commit 8f4fcc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions code-example/showcase_video_im2dhisteq.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
cap = cv2.VideoCapture("assets/Arctic-Convoy-With-Giant-Mack-Trucks.mp4")

# video without sound
video_out_name = (
"assets/Arctic-Convoy-With-Giant-Mack-Trucks-im2dhisteq.mp4"
)
video_out_name = "assets/Arctic-Convoy-With-Giant-Mack-Trucks-im2dhisteq.mp4"

i = 0
j = 0
Expand Down
5 changes: 4 additions & 1 deletion src/im2dhisteq.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numba
import numpy as np


@numba.njit()
def transformer(image, w_neighboring=6):
[h, w] = image.shape
Expand All @@ -22,6 +23,7 @@ def transformer(image, w_neighboring=6):
CDFxn_transform = np.cumsum(X_transform)
return CDFxn_transform, H_in


@numba.njit()
def im2dhisteq(image, w_neighboring=6):
[h, w] = image.shape
Expand All @@ -30,11 +32,12 @@ def im2dhisteq(image, w_neighboring=6):
bins = np.arange(256)
# use linear interpolation of cdf to find new pixel values
image_equalized = np.floor(
np.interp(V.flatten(), bins, 255*CDFxn_transform).reshape(h, w)
np.interp(V.flatten(), bins, 255 * CDFxn_transform).reshape(h, w)
).astype(np.uint8)

return image_equalized


@numba.njit()
def vid2dhisteq(image, w_neighboring=6, Wout_list=np.zeros((10))):
h, w = image.shape
Expand Down

0 comments on commit 8f4fcc1

Please sign in to comment.