| 8 | |
| 9 | class HueTransform(Transform): |
| 10 | def __init__(self, fraction, S_rand, V_rand, format='BGR'): |
| 11 | super().__init__() |
| 12 | self._set_attributes(locals()) |
| 13 | if format == 'BGR': |
| 14 | cvt_format_in = cv2.COLOR_BGR2HSV |
| 15 | cvt_format_out = cv2.COLOR_HSV2BGR |
| 16 | elif format == 'RGB': |
| 17 | cvt_format_in = cv2.COLOR_RGB2HSV |
| 18 | cvt_format_out = cv2.COLOR_HSV2RGB |
| 19 | else: |
| 20 | raise Exception("Image format only accepts BGR and RGB") |
| 21 | self.cvt_format_in = cvt_format_in |
| 22 | self.cvt_format_out = cvt_format_out |
| 23 | |
| 24 | def apply_coords(self, coords): |
| 25 | return coords |