def _draw_contour(self, img):
if self.mask is None or self.contour_width == <NUM_LIT:0>:<EOL><INDENT>return img<EOL><DEDENT>mask = self._get_bolean_mask(self.mask) * <NUM_LIT:255><EOL>contour = Image.fromarray(mask.astype(np.uint8))<EOL>contour = contour.resize(img.size)<EOL>contour = contour.filter(ImageFilter.FIND_EDGES)<EOL>contour = np.array(contour)<EOL>contour[[<NUM_LIT:0>, -<NUM_LIT:1>], :] = <NUM_LIT:0><EOL>contour[:, [<NUM_LIT:0>, -<NUM_LIT:1>]] = <NUM_LIT:0><EOL>radius = self.contour_width / <NUM_LIT:10><EOL>contour = Image.fromarray(contour)<EOL>contour = contour.filter(ImageFilter.GaussianBlur(radius=radius))<EOL>contour = np.array(contour) > <NUM_LIT:0><EOL>contour = np.dstack((contour, contour, contour))<EOL>ret = np.array(img) * np.invert(contour)<EOL>if self.contour_color != '<STR_LIT>':<EOL><INDENT>color = Image.new(img.mode, img.size, self.contour_color)<EOL>ret += np.array(color) * contour<EOL><DEDENT>return Image.fromarray(ret)<EOL>
Draw mask contour on a pillow image.