ImageAnnotationPreview
Introduction
ImageAnnotationPreview
is a widget for displaying image annotation.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
| Opacity of the annotation |
|
| If |
|
| Width of the annotation border (contour) line |
|
| ID of the widget |
annotations_opacity
Annotation opacity. Value must be between 0 and 1. Set to 0 to hide annotations.
type: float
default value: 0.5
enable_zoom
If True
, allows to zoom image with the mouse wheel.
type: bool
default value: False
line_width
Width of the annotation border (contour) line. Set to 0 to hide line.
type: int
default value: 1
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
Attributes and Methods | Description |
---|---|
| Set image and annotation to widget. |
| Clean up widget from image. |
| Return bool value, whether image is set or not. |
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/media/015_image_annotation_preview/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Initialize Project ID
Project ID
Get Project ID and meta
Get images from dataset
Get annotation for image
Initialize ImageAnnotationPreview widget and set image with annotation and project meta
Add button widget to show random image, we will use it later
Create app layout
Prepare a layout for app using Card
widget with the content
parameter and place widgets that we've just created in the Container
widget.
Create app using layout
Create an app object with layout parameter.
Add button click event to update preview
Last updated