def test_convert_hsv_and_remove_luminance(self): image_three_channel = np.full((50, 50, 3), [100, 50, 200], dtype=np.uint8) image_two_channel = TSEImageUtils.convert_hsv_and_remove_luminance( image_three_channel) # Test that the colour space has been converted to HSV, and the 'V' channel has been set to 0 (i.e. remove it) assert_true((image_two_channel == [170, 191, 0]).all( ), "Converted colour to HSV and 'V' stripped should equal [170, 191, 0]" )
def __init__(self, image_one_file_path, image_two_file_path, calib_data_file_path, plot_axis): self._image_one_file_path = image_one_file_path self._image_two_file_path = image_two_file_path # Find the last instance of '/' in the file path, and grab the image name from the split array. self._image_one_file_name = image_one_file_path.rsplit('/', 1)[1] self._image_two_file_name = image_two_file_path.rsplit('/', 1)[1] self._raw_img1 = cv2.imread(image_one_file_path, cv2.IMREAD_COLOR) self._raw_img2 = cv2.imread(image_two_file_path, cv2.IMREAD_COLOR) self._hsv_img1 = TSEImageUtils.convert_hsv_and_remove_luminance( self._raw_img1) self._hsv_img2 = TSEImageUtils.convert_hsv_and_remove_luminance( self._raw_img2) self._calibration_lookup = self.load_calibration_data( calib_data_file_path) self._calib_data_file_path = calib_data_file_path self._plot_axis = plot_axis