Draw
draw_circle
paz.backend.image.draw.draw_circle(image, center, color=(0, 255, 0), radius=5)
Draw a circle in an image
Arguments
- image: Array
(H, W, 3)
- center: List
(2)
with(x, y)
values in openCV coordinates. - radius: Float. Radius of circle.
- color: Tuple
(3)
indicating the RGB colors.
Returns
Array (H, W, 3)
with circle.
draw_square
paz.backend.image.draw.draw_square(image, center, color, size)
Draw a square in an image
Arguments
- image: Array
(H, W, 3)
- center: List
(2)
with(x, y)
values in openCV coordinates. - size: Float. Length of square size.
- color: List
(3)
indicating RGB colors.
Returns
Array (H, W, 3)
with square.
draw_triangle
paz.backend.image.draw.draw_triangle(image, center, color, size)
Draw a triangle in an image
Arguments
- image: Array
(H, W, 3)
- center: List
(2)
containing(x_center, y_center)
. - size: Float. Length of square size.
- color: Tuple
(3)
indicating the RGB colors.
Returns
Array (H, W, 3)
with triangle.
draw_keypoint
paz.backend.image.draw.draw_keypoint(image, point, color=(0, 255, 0), radius=5)
Draws a circle in image.
Arguments
- image: Numpy array of shape
[H, W, 3]
. - point: List of length two indicating
(y, x)
openCV coordinates. - color: List of length three indicating RGB color of point.
- radius: Integer indicating the radius of the point to be drawn.
Returns
Numpy array with shape [H, W, 3]
. Image with circle.
draw_cube
paz.backend.image.draw.draw_cube(image, points, color=(0, 255, 0), thickness=2, radius=5)
Draws a cube in image.
Arguments
- image: Numpy array of shape (H, W, 3).
- points: List of length 8 having each element a list of length two indicating (U, V) openCV coordinates.
- color: List of length three indicating RGB color of point.
- thickness: Integer indicating the thickness of the line to be drawn.
- radius: Integer indicating the radius of corner points to be drawn.
Returns
Numpy array with shape (H, W, 3). Image with cube.
draw_dot
paz.backend.image.draw.draw_dot(image, point, color=(0, 255, 0), radius=5, filled=-1)
Draws a dot (small rectangle) in image.
Arguments
- image: Numpy array of shape
[H, W, 3]
. - point: List of length two indicating
(y, x)
openCV coordinates. - color: List of length three indicating RGB color of point.
- radius: Integer indicating the radius of the point to be drawn.
- filled: Boolean. If
True
rectangle is filled withcolor
.
Returns
Numpy array with shape [H, W, 3]
. Image with dot.
draw_filled_polygon
paz.backend.image.draw.draw_filled_polygon(image, vertices, color)
Draws filled polygon
Arguments
- image: Numpy array.
- vertices: List of elements each having a list
of length two indicating
(y, x)
openCV coordinates. - color: Numpy array specifying RGB color of the polygon.
Returns
Numpy array with shape [H, W, 3]
. Image with polygon.
draw_line
paz.backend.image.draw.draw_line(image, point_A, point_B, color=(0, 255, 0), thickness=5)
Draws a line in image from point_A
to point_B
.
Arguments
- image: Numpy array of shape
[H, W, 3]
. - point_A: List of length two indicating
(y, x)
openCV coordinates. - point_B: List of length two indicating
(y, x)
openCV coordinates. - color: List of length three indicating RGB color of point.
- thickness: Integer indicating the thickness of the line to be drawn.
Returns
Numpy array with shape [H, W, 3]
. Image with line.
draw_random_polygon
paz.backend.image.draw.draw_random_polygon(image, max_radius_scale=0.5)
Draw random polygon image.
Arguments
- image: Numpy array with shape
[H, W, 3]
. - max_radius_scale: Float between [0, 1].
Returns
Numpy array with shape [H, W, 3]
. Image with polygon.
draw_rectangle
paz.backend.image.draw.draw_rectangle(image, corner_A, corner_B, color, thickness)
Draws a filled rectangle from corner_A
to corner_B
.
Arguments
- image: Numpy array of shape
[H, W, 3]
. - corner_A: List of length two indicating
(y, x)
openCV coordinates. - corner_B: List of length two indicating
(y, x)
openCV coordinates. - color: List of length three indicating RGB color of point.
- thickness: Integer/openCV Flag. Thickness of rectangle line. or for filled use cv2.FILLED flag.
Returns
Numpy array with shape [H, W, 3]
. Image with rectangle.
lincolor
paz.backend.image.draw.lincolor(num_colors, saturation=1, value=1, normalized=False)
Creates a list of RGB colors linearly sampled from HSV space with randomised Saturation and Value.
Arguments
- num_colors: Int.
- saturation: Float or
None
. If float indicates saturation. IfNone
it samples a random value. - value: Float or
None
. If float indicates value. IfNone
it samples a random value. - normalized: Bool. If True, RGB colors are returned between [0, 1] if False, RGB colors are between [0, 255].
Returns
List, for which each element contains a list with RGB color
put_text
paz.backend.image.draw.put_text(image, text, point, scale, color, thickness)
Draws text in image.
Arguments
- image: Numpy array.
- text: String. Text to be drawn.
- point: Tuple of coordinates indicating the top corner of the text.
- scale: Float. Scale of text.
- color: Tuple of integers. RGB color coordinates.
- thickness: Integer. Thickness of the lines used for drawing text.
Returns
Numpy array with shape [H, W, 3]
. Image with text.
make_mosaic
paz.backend.image.draw.make_mosaic(images, shape, border=0)
Creates an image mosaic.
Arguments
- images: Numpy array of shape (num_images, height, width, num_channels)
- shape: List of two integers indicating the mosaic shape.
- border: Integer indicating the border per image.
Returns
A numpy array containing all images.
Exceptions
Shape must satisfy len(images) > shape[0] * shape[1]
draw_points2D
paz.backend.image.draw.draw_points2D(image, points2D, colors)
Draws a pixel for all points2D in UV space using only numpy.
Arguments
- image: Array (H, W).
- keypoints: Array (num_points, U, V). Keypoints in image space
- colors: Array (num_points, 3). Colors in RGB space.
Returns
Array with drawn points.
draw_keypoints_link
paz.backend.image.draw.draw_keypoints_link(image, keypoints, link_args, link_orders, link_colors, check_scores=False, link_width=2)
Draw link between the keypoints.
Arguments
- images: Numpy array.
- keypoints: Keypoint(k0, k1, ...) locations in the image. Numpy array.
- link_args: Keypoint labels. Dictionary. {'k0':0, 'k1':1, ...}
- link_orders: List of tuple. [('k0', 'k1'),('kl', 'k2'), ...]
- link_colors: Color of each link. List of list
- check_scores: Condition to draw links. Boolean.
Returns
A numpy array containing drawn link between the keypoints.
draw_keypoints
paz.backend.image.draw.draw_keypoints(image, keypoints, keypoint_colors, check_scores=False, keypoint_radius=6)
Draw a circle at keypoints.
Arguments
- images: Numpy array.
- keypoints: Keypoint locations in the image. Numpy array.
- keypoint_colors: Color of each keypoint. List of list
- check_scores: Condition to draw keypoint. Boolean.
Returns
A numpy array containing circle at each keypoints.
points3D_to_RGB
paz.backend.image.draw.points3D_to_RGB(points3D, object_sizes)
Transforms points3D in object frame to RGB color space. Arguments
- points3D: Array (num_points, 3). Points3D a
- object_sizes: Array (3) indicating the (width, height, depth) of object.
Returns
Array of ints (num_points, 3) in RGB space.
draw_RGB_mask
paz.backend.image.draw.draw_RGB_mask(image, points2D, points3D, object_sizes)
Draws RGB mask by transforming points3D to RGB space and putting in them in their 2D coordinates (points2D)
Arguments
- image: Array (H, W, 3).
- points2D: Array (num_points, 2)
- points3D: Array (num_points, 3)
- object_sizes: Array (x_size, y_size, z_size)
Returns
Image array with drawn masks
draw_RGB_masks
paz.backend.image.draw.draw_RGB_masks(image, points2D, points3D, object_sizes)
Draws RGB masks by transforming points3D to RGB space and putting in them in their 2D coordinates (points2D)
Arguments
- image: Array (H, W, 3).
- points2D: Array (num_samples, num_points, 2)
- points3D: Array (num_samples, num_points, 3)
- object_sizes: Array (x_size, y_size, z_size)
Returns
Image array with drawn masks
draw_human_pose6D
paz.backend.image.draw.draw_human_pose6D(image, rotation, translation, camaera_intrinsics)
Draw basis vectors for human pose 6D
Arguments
- image: numpy array
- rotation: numpy array of size (3 x 3)
- translations: list of length 3
- camera_matrix: numpy array
Returns
- image: numpy array image with basis vectors of rotaion and translation.