Skip to content

Commit

Permalink
prod: Add dust visualisation script
Browse files Browse the repository at this point in the history
Signed-off-by: Naushir Patuck <[email protected]>
  • Loading branch information
naushir committed Jul 14, 2023
1 parent b46e287 commit bf478b1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions utils/dust_img.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/python3

import math
import rawpy
import cv2
import sys

if len(sys.argv) < 3:
print(f'Usage: {sys.argv[0]} <filename> <threshold>')
sys.exit(-1)

filename = sys.argv[1]
threshold = int(sys.argv[2])

image = rawpy.imread(filename)
raw = image.raw_image
bpp = int(math.log2(image.white_level + 1))
raw = raw << (16 - bpp)

raw[raw < threshold] = 65535

cv2.imshow(f'Threshold {threshold}', raw)
cv2.waitKey(0)
cv2.destroyAllWindows()

0 comments on commit bf478b1

Please sign in to comment.