Skip to content

Commit

Permalink
Check and upgrade precision as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
jabriffa committed Jun 22, 2018
1 parent 3d2c8e1 commit 41e1ce9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cr2_replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ def main():

# read sensor image file
sensor = jbimage.image_file.read(args.sensor).squeeze()
# determine precision
precision_sensor = jbimage.get_precision(sensor.max())
print "Sensor image required precision: %d bits" % precision_sensor
# decide if we need to upgrade encoding precision
if precision_sensor > precision:
print "Upgrading from precision: %d bits" % precision
precision = precision_sensor

# check input image parameters
assert len(sensor.shape) == 2 # must be a one-channel image
Expand Down

0 comments on commit 41e1ce9

Please sign in to comment.