Randomly modifies given color to produce a slightly different color than the color given. Args: color (tuple[double]): a tuple of 3 elements, containing the RGB values of the color picked. The values in the list are in the [0.0, 1.0] range. Retu
(self, color)
| 1160 | """ |
| 1161 | |
| 1162 | def _jitter(self, color): |
| 1163 | """ |
| 1164 | Randomly modifies given color to produce a slightly different color than the color given. |
| 1165 | |
| 1166 | Args: |
| 1167 | color (tuple[double]): a tuple of 3 elements, containing the RGB values of the color |
| 1168 | picked. The values in the list are in the [0.0, 1.0] range. |
| 1169 | |
| 1170 | Returns: |
| 1171 | jittered_color (tuple[double]): a tuple of 3 elements, containing the RGB values of the |
| 1172 | color after being jittered. The values in the list are in the [0.0, 1.0] range. |
| 1173 | """ |
| 1174 | color = mplc.to_rgb(color) |
| 1175 | # np.random.seed(0) |
| 1176 | vec = np.random.rand(3) |
| 1177 | # better to do it in another color space |
| 1178 | vec = vec / np.linalg.norm(vec) * 0.5 |
| 1179 | res = np.clip(vec + color, 0, 1) |
| 1180 | return tuple(res) |
| 1181 | |
| 1182 | def _create_grayscale_image(self, mask=None): |
| 1183 | """ |
no outgoing calls
no test coverage detected