Skip to content

Commit 1a2d641

Browse files
author
Joshua Whitley
authored
Merge pull request #334 from Fruchtzwerg94/patch-2
Scale pixels down from 16 to 8 bits instead of just clipping
2 parents 021ab3c + 1aa583e commit 1a2d641

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

camera_calibration/src/camera_calibration/calibrator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def mkgray(self, msg):
256256
# TODO: get a Python API in cv_bridge to check for the image depth.
257257
if self.br.encoding_to_dtype_with_channels(msg.encoding)[0] in ['uint16', 'int16']:
258258
mono16 = self.br.imgmsg_to_cv2(msg, '16UC1')
259-
mono8 = numpy.array(numpy.clip(mono16, 0, 255), dtype=numpy.uint8)
259+
mono8 = numpy.array(mono16 / 256, dtype=numpy.uint8)
260260
return mono8
261261
elif 'FC1' in msg.encoding:
262262
# floating point image handling

0 commit comments

Comments
 (0)