def draw_on_image(self, image, color=(<NUM_LIT:0>, <NUM_LIT:255>, <NUM_LIT:0>), alpha=<NUM_LIT:1.0>, size=<NUM_LIT:3>,<EOL>copy=True, raise_if_out_of_image=False):
if copy:<EOL><INDENT>image = np.copy(image)<EOL><DEDENT>if image.ndim == <NUM_LIT:2>:<EOL><INDENT>assert ia.is_single_number(color), (<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (str(color),))<EOL><DEDENT>elif image.ndim == <NUM_LIT:3> and ia.is_single_number(color):<EOL><INDENT>color = [color] * image.shape[-<NUM_LIT:1>]<EOL><DEDENT>input_dtype = image.dtype<EOL>alpha_color = color<EOL>if alpha < <NUM_LIT>:<EOL><INDENT>return image<EOL><DEDENT>elif alpha > <NUM_LIT>:<EOL><INDENT>alpha = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>image = image.astype(np.float32, copy=False)<EOL>alpha_color = alpha * np.array(color)<EOL><DEDENT>height, width = image.shape[<NUM_LIT:0>:<NUM_LIT:2>]<EOL>y, x = self.y_int, self.x_int<EOL>x1 = max(x - size//<NUM_LIT:2>, <NUM_LIT:0>)<EOL>x2 = min(x + <NUM_LIT:1> + size//<NUM_LIT:2>, width)<EOL>y1 = max(y - size//<NUM_LIT:2>, <NUM_LIT:0>)<EOL>y2 = min(y + <NUM_LIT:1> + size//<NUM_LIT:2>, height)<EOL>x1_clipped, x2_clipped = np.clip([x1, x2], <NUM_LIT:0>, width)<EOL>y1_clipped, y2_clipped = np.clip([y1, y2], <NUM_LIT:0>, height)<EOL>x1_clipped_ooi = (x1_clipped < <NUM_LIT:0> or x1_clipped >= width)<EOL>x2_clipped_ooi = (x2_clipped < <NUM_LIT:0> or x2_clipped >= width+<NUM_LIT:1>)<EOL>y1_clipped_ooi = (y1_clipped < <NUM_LIT:0> or y1_clipped >= height)<EOL>y2_clipped_ooi = (y2_clipped < <NUM_LIT:0> or y2_clipped >= height+<NUM_LIT:1>)<EOL>x_ooi = (x1_clipped_ooi and x2_clipped_ooi)<EOL>y_ooi = (y1_clipped_ooi and y2_clipped_ooi)<EOL>x_zero_size = (x2_clipped - x1_clipped) < <NUM_LIT:1>  <EOL>y_zero_size = (y2_clipped - y1_clipped) < <NUM_LIT:1><EOL>if not x_ooi and not y_ooi and not x_zero_size and not y_zero_size:<EOL><INDENT>if alpha == <NUM_LIT:1>:<EOL><INDENT>image[y1_clipped:y2_clipped, x1_clipped:x2_clipped] = color<EOL><DEDENT>else:<EOL><INDENT>image[y1_clipped:y2_clipped, x1_clipped:x2_clipped] = (<EOL>(<NUM_LIT:1> - alpha)<EOL>* image[y1_clipped:y2_clipped, x1_clipped:x2_clipped]<EOL>+ alpha_color<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if raise_if_out_of_image:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (y, x, image.shape))<EOL><DEDENT><DEDENT>if image.dtype.name != input_dtype.name:<EOL><INDENT>if input_dtype.name == "<STR_LIT>":<EOL><INDENT>image = np.clip(image, <NUM_LIT:0>, <NUM_LIT:255>, out=image)<EOL><DEDENT>image = image.astype(input_dtype, copy=False)<EOL><DEDENT>return image<EOL>
Draw the keypoint onto a given image.

The keypoint is drawn as a square.

Parameters
----------
image : (H,W,3) ndarray
    The image onto which to draw the keypoint.

color : int or list of int or tuple of int or (3,) ndarray, optional
    The RGB color of the keypoint. If a single int ``C``, then that is
    equivalent to ``(C,C,C)``.

alpha : float, optional
    The opacity of the drawn keypoint, where ``1.0`` denotes a fully
    visible keypoint and ``0.0`` an invisible one.

size : int, optional
    The size of the keypoint. If set to ``S``, each square will have
    size ``S x S``.

copy : bool, optional
    Whether to copy the image before drawing the keypoint.

raise_if_out_of_image : bool, optional
    Whether to raise an exception if the keypoint is outside of the
    image.

Returns
-------
image : (H,W,3) ndarray
    Image with drawn keypoint.