Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit 2afeeeb

Browse files
authored
Merge pull request #511 from hieuck/Fix-issue-with-value-equal-to-0-
Fix issue with value equal to 0
2 parents 5783537 + 2a0e1de commit 2afeeeb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

WAS_Node_Suite.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6227,7 +6227,10 @@ def adjust(self, im):
62276227
im_arr = np.clip(im_arr, 0, 255)
62286228

62296229
# mid-level adjustment
6230-
gamma = math.log(0.5) / math.log((self.mid_level - self.min_level) / (self.max_level - self.min_level))
6230+
if self.mid_level <= self.min_level:
6231+
gamma = 1.0
6232+
else:
6233+
gamma = math.log(0.5) / math.log((self.mid_level - self.min_level) / (self.max_level - self.min_level))
62316234
im_arr = np.power(im_arr / 255, gamma) * 255
62326235

62336236
im_arr = im_arr.astype(np.uint8)

0 commit comments

Comments
 (0)