NotebookHelpers
These are miscellaneous helper methods to render responses from ApertureDB in a jupyter environment.
This module provides helper classes (such as BoundingBox, TemporalBoundingBox) and functions
(such as display, draw_bboxes, display_video_mp4, display_annotated_video)
to help render visual results from ApertureDB queries directly within a Jupyter Notebook.
It makes it easier to visualize bounding boxes, images, and videos without writing boilerplate code.
BoundingBox Objects
class BoundingBox()
A class which combines a box and a label.
TemporalBoundingBox Objects
class TemporalBoundingBox()
A class that represents a box, but also associated time in the range of frame start and end
display
def display(images_array, save=False)
Show images with matplotlib
This method was used by ApertureDB to display images, but it is not recommended anymore. It will not draw annotation.
Instead, when using with JSON queries, make a instance of the Images class and call the display method. :
from aperturedb.Images import Images
result, response, blobs = execute_query(client, [{"FindImage":{"uniqueids": True}}], [])
wrapper = Images(client, response=response[0]["FindImage"]["entities"])
wrapper.display()
display_video_mp4
def display_video_mp4(blob)
Display a video using IPython.display
Arguments:
blobbytearray - A blob that is the Video.
annotate_video
def annotate_video(blob, bboxes: List[TemporalBoundingBox] = [])
Place annotations on a video framewise
Arguments:
blobbytearray - Video blob returned from the databasebboxesList[TemporalBoundingBox], optional - List of boxes to be drawn. Defaults to [].
display_annotated_video
def display_annotated_video(blob, bboxes: List[TemporalBoundingBox] = [])
Returns a HTML representation with a column filled with video entities.