upsp.cam_cal_utils.img_utils

convert_12bit_to_8bit(img)[source]

Proportionally scales image values from (0, 4095) to (0, 255)

Scales input image values from (0, 4095) to (0, 255). Values in input image that are greater than scale will be clipped to 255 in the output image

Parameters

img (numpy.ndarray, shape (y, x), np.uint8) – Input image

Returns

scaled_img – 8 bit scaled version of input image

Return type

numpy.ndarray, shape (y, x), np.uint8

interp(pts, img, method='nearest')[source]

Interpolate values for pts from img

Interpolates img at the locations defined by pts using the given method

Parameters
Returns

out – Value of pts interpolated from img

Return type

numpy.ndarray, shape (n, 2), float

scale_image(img, scale=4095)[source]

Proportionally scales image values from (0, scale) to (0, 255)

Scales input image values from (0, scale) to (0, 255). Values in input image that are greater than scale will be clipped to 255 in the output image

Parameters
  • img (numpy.ndarray, shape (y, x)) – Input image

  • scale (float or int, optional) – Maximum value for scaling input image. Default=4095 (max int for 12 bit)

Returns

scaled_img – 8 bit scaled version of input image

Return type

numpy.ndarray, shape (y, x), np.uint8

scale_image_max_inlier(img)[source]

Proportionally scales image values from (0, max_inlier) to (0, 255)

Scales input image values from (0, max_inlier) to (0, 255). Values in input image that are greater than the max inlier will be clipped to 255 in the output image

In a sorted list of the pixel intensities, the max inlier is the largest value that satisfies the following condition: intensity[i] * 0.9 <= intensity[i*0.999]

Parameters

img (numpy.ndarray, shape (y, x), np.unit8) – Input image

Returns

scaled_img – 8 bit scaled version of input image

Return type

numpy.ndarray, shape (y, x), np.unit8