32b1313d00f1a7000532fd191ad497aaac7bf8c4,imgaug/augmenters/arithmetic.py,Invert,_augment_images,#Invert#Any#Any#Any#Any#,1493
Before Change
image_c = image[..., c]
distance_from_min = np.abs(image_c - self.min_value) // d=abs(v-m)
image[..., c] = -distance_from_min + self.max_value // v"=M-d
np.clip(image, 0, 255, out=image)
result[i] = image.astype(np.uint8)
else:
p_sample = self.p.draw_sample(random_state=rs_image)
assert 0 <= p_sample <= 1.0
if p_sample > 0.5:
distance_from_min = np.abs(image - self.min_value) // d=abs(v-m)
image = -distance_from_min + self.max_value
np.clip(image, 0, 255, out=image)
result[i] = image.astype(np.uint8)
return result
def _augment_keypoints(self, keypoints_on_images, random_state, parents, hooks):
return keypoints_on_images
After Change
self.max_value = max_value
def _augment_images(self, images, random_state, parents, hooks):
input_dtypes = meta.copy_dtypes_for_restore(images)
result = images
nb_images = len(images)
seeds = random_state.randint(0, 10**6, (nb_images,))
for i in sm.xrange(nb_images):
image = images[i].astype(np.int32)
rs_image = ia.new_random_state(seeds[i])
per_channel = self.per_channel.draw_sample(random_state=rs_image)
if per_channel == 1:
nb_channels = image.shape[2]
p_samples = self.p.draw_samples((nb_channels,), random_state=rs_image)
for c, p_sample in enumerate(p_samples):
assert 0 <= p_sample <= 1
if p_sample > 0.5:
image_c = image[..., c]
distance_from_min = np.abs(image_c - self.min_value) // d=abs(v-m)
image[..., c] = -distance_from_min + self.max_value // v"=M-d
result[i] = image
else:
p_sample = self.p.draw_sample(random_state=rs_image)
assert 0 <= p_sample <= 1.0
if p_sample > 0.5:
distance_from_min = np.abs(image - self.min_value) // d=abs(v-m)
image = -distance_from_min + self.max_value
result[i] = image
meta.clip_augmented_images_(result, self.min_value, self.max_value)
meta.restore_augmented_images_dtypes_(result, input_dtypes)
return result
def _augment_keypoints(self, keypoints_on_images, random_state, parents, hooks):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 12
Instances
Project Name: aleju/imgaug
Commit Name: 32b1313d00f1a7000532fd191ad497aaac7bf8c4
Time: 2018-01-12
Author: kontakt@ajung.name
File Name: imgaug/augmenters/arithmetic.py
Class Name: Invert
Method Name: _augment_images
Project Name: aleju/imgaug
Commit Name: 32b1313d00f1a7000532fd191ad497aaac7bf8c4
Time: 2018-01-12
Author: kontakt@ajung.name
File Name: imgaug/augmenters/arithmetic.py
Class Name: Invert
Method Name: _augment_images
Project Name: aleju/imgaug
Commit Name: 32b1313d00f1a7000532fd191ad497aaac7bf8c4
Time: 2018-01-12
Author: kontakt@ajung.name
File Name: imgaug/augmenters/arithmetic.py
Class Name: Add
Method Name: _augment_images
Project Name: aleju/imgaug
Commit Name: 32b1313d00f1a7000532fd191ad497aaac7bf8c4
Time: 2018-01-12
Author: kontakt@ajung.name
File Name: imgaug/augmenters/arithmetic.py
Class Name: Multiply
Method Name: _augment_images