# davisinteractive.utils.scribbles

scribbles2mask(scribbles,
output_resolution,
bezier_curve_sampling=False,
nb_points=1000,
bresenham=True,
default_value=-1)

Convert the scribbles data into a mask.

Arguments

• scribbles: Dictionary. Scribbles in the default format.
• output_resolution: Tuple. Output resolution (H, W).
• bezier_curve_sampling: Boolean. Weather to sample first the returned scribbles using bezier curve or not.
• nb_points: Integer. If bezier_curve_sampling is True set the number of points to sample from the bezier curve.
• bresenham: Boolean. Whether to compute bresenham algorithm for the scribbles lines.
• default_value: Integer. Default value for the pixels which do not belong to any scribble.

Returns

ndarray: Array with the mask of the scribbles with the index of the object ids. The shape of the returned array is (B x H x W) by default or (H x W) if only_annotated_frame==True.

## scribbles2points

scribbles2points(scribbles_data, output_resolution=None)

Convert the given scribbles into a list of points and object ids.

Arguments

• scribbles_data: Dictionary. Scribbles in the default format
• output_resolution: Tuple. Output resolution (H, W) to scale the points. If None given, the points will be floats as a fraction of height and width.

Returns

(ndarray, ndarray): Returns (X, Y) where X is a list of points from the scribbles represented in the output_resolution with shape (N x 3) with N being the total number of points on all the scribbles. The three coordinates given correspond the the frame number, height and width, respectively. Y is the object id for each given point with shape (N,).

## fuse_scribbles

fuse_scribbles(scribbles_a, scribbles_b)

Fuse two scribbles in the default format.

Arguments

• scribbles_a: Dictionary. Default representation of scribbles A.
• scribbles_b: Dictionary. Default representation of scribbles B.

Returns

dict: Returns a dictionary with scribbles A and B fused.

## is_empty

is_empty(scribbles_data)

Checks whether the given scribble has any non-empty line.

Arguments

• scribbles_data (dict): Scribble in the default format

Returns

bool: Whether the scribble is empty or not.

## annotated_frames

annotated_frames(scribbles_data)

Finds which frames have a scribble.

Arguments

• scribbles_data (dict): Scribble in the default format.

Returns

list: Number of the frames that contain at least one scribble.

## annotated_frames_object

annotated_frames_object(scribbles_data, object_id)

Computes which frames have a scribble for a certain object.

Arguments

• scribbles_data (dict): Scribble in the default format.
• object_id (int): Id of the object of interest.

Returns

dict: Number of the frames that contain at least one scribble.