Create a grayscale version of the original image. The colors in masked area, if given, will be kept.
(self, mask=None)
| 1180 | return tuple(res) |
| 1181 | |
| 1182 | def _create_grayscale_image(self, mask=None): |
| 1183 | """ |
| 1184 | Create a grayscale version of the original image. |
| 1185 | The colors in masked area, if given, will be kept. |
| 1186 | """ |
| 1187 | img_bw = self.img.astype("f4").mean(axis=2) |
| 1188 | img_bw = np.stack([img_bw] * 3, axis=2) |
| 1189 | if mask is not None: |
| 1190 | img_bw[mask] = self.img[mask] |
| 1191 | return img_bw |
| 1192 | |
| 1193 | def _change_color_brightness(self, color, brightness_factor): |
| 1194 | """ |
no outgoing calls
no test coverage detected