|
@@ -37,16 +37,22 @@ class MediaFile:
|
|
self.__file.set_collection_by_reference(reference)
|
|
self.__file.set_collection_by_reference(reference)
|
|
self.__notifications.add(self.__notifications.nm.edit_file, self.__file)
|
|
self.__notifications.add(self.__notifications.nm.edit_file, self.__file)
|
|
|
|
|
|
- def set_image_label(self, label: Union[int, MediaLabel]):
|
|
|
|
|
|
+ def set_image_label(self, label: Union[int, MediaLabel], frame: int = None):
|
|
"""
|
|
"""
|
|
create a labeled-image result
|
|
create a labeled-image result
|
|
|
|
|
|
:param label: label identifier
|
|
:param label: label identifier
|
|
|
|
+ :param frame: frame index (only set for videos)
|
|
"""
|
|
"""
|
|
if label is not None and isinstance(label, MediaLabel):
|
|
if label is not None and isinstance(label, MediaLabel):
|
|
label = label.identifier
|
|
label = label.identifier
|
|
|
|
|
|
- created = self.__file.create_result('pipeline', 'labeled-image', label)
|
|
|
|
|
|
+ if frame is not None:
|
|
|
|
+ data = {'frame': frame}
|
|
|
|
+ else:
|
|
|
|
+ data = None
|
|
|
|
+
|
|
|
|
+ created = self.__file.create_result('pipeline', 'labeled-image', label, data)
|
|
self.__notifications.add(self.__notifications.nm.create_result, created)
|
|
self.__notifications.add(self.__notifications.nm.create_result, created)
|
|
|
|
|
|
def add_bounding_box(self, x: float, y: float, w: float, h: float,
|
|
def add_bounding_box(self, x: float, y: float, w: float, h: float,
|
|
@@ -59,7 +65,7 @@ class MediaFile:
|
|
:param w: relative width [0, 1]
|
|
:param w: relative width [0, 1]
|
|
:param h: relative height [0, 1]
|
|
:param h: relative height [0, 1]
|
|
:param label: label
|
|
:param label: label
|
|
- :param frame: frame index
|
|
|
|
|
|
+ :param frame: frame index (only set for videos)
|
|
"""
|
|
"""
|
|
result = {
|
|
result = {
|
|
'x': x,
|
|
'x': x,
|