This commit is contained in:
zhuyuxiao 2021-09-13 10:21:18 +08:00
parent 901124c9bd
commit a8caebd7ec
5 changed files with 10 additions and 10 deletions

View File

@ -50,7 +50,7 @@ class PhotoMetricDistortion:
self.contrast_upper)
img *= alpha
# convert color from BGR to HSV
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_BGR2HSV')))
img = cv2.cvtColor((img, cv2.COLOR_BGR2HSV))
# random saturation
if random.randint(2):
img[..., 1] *= random.uniform(self.saturation_lower,
@ -61,7 +61,7 @@ class PhotoMetricDistortion:
img[..., 0][img[..., 0] > 360] -= 360
img[..., 0][img[..., 0] < 0] += 360
# convert color from HSV to BGR
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_HSV2BGR')))
img = cv2.cvtColor((img, cv2.COLOR_HSV2BGR))
# random contrast
if mode == 0:
if random.randint(2):

View File

@ -107,7 +107,7 @@ class PhotoMetricDistortion:
img *= alpha
# convert color from BGR to HSV
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_BGR2HSV')))
img = cv2.cvtColor((img, cv2.COLOR_BGR2HSV))
# random saturation
if random.randint(2):
@ -121,7 +121,7 @@ class PhotoMetricDistortion:
img[..., 0][img[..., 0] < 0] += 360
# convert color from HSV to BGR
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_HSV2BGR')))
img = cv2.cvtColor((img, cv2.COLOR_HSV2BGR))
# random contrast
if mode == 0:

View File

@ -102,7 +102,7 @@ class PhotoMetricDistortion:
img *= alpha
# convert color from BGR to HSV
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_BGR2HSV')))
img = cv2.cvtColor((img, cv2.COLOR_BGR2HSV))
# random saturation
if random.randint(2):
@ -116,7 +116,7 @@ class PhotoMetricDistortion:
img[..., 0][img[..., 0] < 0] += 360
# convert color from HSV to BGR
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_HSV2BGR')))
img = cv2.cvtColor((img, cv2.COLOR_HSV2BGR))
# random contrast
if mode == 0:

View File

@ -103,7 +103,7 @@ class PhotoMetricDistortion:
img *= alpha
# convert color from BGR to HSV
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_BGR2HSV')))
img = cv2.cvtColor((img, cv2.COLOR_BGR2HSV))
# random saturation
if random.randint(2):
@ -117,7 +117,7 @@ class PhotoMetricDistortion:
img[..., 0][img[..., 0] < 0] += 360
# convert color from HSV to BGR
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_HSV2BGR')))
img = cv2.cvtColor((img, cv2.COLOR_HSV2BGR))
# random contrast
if mode == 0:

View File

@ -116,7 +116,7 @@ class PhotoMetricDistortion:
img *= alpha
# convert color from BGR to HSV
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_BGR2HSV')))
img = cv2.cvtColor((img, cv2.COLOR_BGR2HSV))
# random saturation
if random.randint(2):
@ -130,7 +130,7 @@ class PhotoMetricDistortion:
img[..., 0][img[..., 0] < 0] += 360
# convert color from HSV to BGR
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_HSV2BGR')))
img = cv2.cvtColor((img, cv2.COLOR_HSV2BGR))
# random contrast
if mode == 0: