Skip to content

Commit 6fc7e56

Browse files
committed
hsv
1 parent 66f9a73 commit 6fc7e56

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mmseg/datasets/pipelines/hubmap_transforms.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ def apply(self, image, hue_shift=0, sat_shift=0, val_shift=0, **params):
2222
if not A.is_rgb_image(image) and not A.is_grayscale_image(image):
2323
raise TypeError("HueSaturationValue transformation expects 1-channel or 3-channel images.")
2424

25-
image = (image*255).astype(np.uint8)
25+
if image.dtype != np.uint8:
26+
raise TypeError("image must be uint8")
27+
2628
hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
2729

2830
h = hsv[:, :, 0].astype(np.float32) # hue
@@ -36,7 +38,7 @@ def apply(self, image, hue_shift=0, sat_shift=0, val_shift=0, **params):
3638
hsv[:, :, 1] = np.clip(s,0,255).astype(np.uint8)
3739
hsv[:, :, 2] = np.clip(v,0,255).astype(np.uint8)
3840
image = cv2.cvtColor(hsv, cv2.COLOR_HSV2BGR)
39-
image = image.astype(np.float32)/255
41+
4042
return image
4143

4244
def get_params(self):

0 commit comments

Comments
 (0)