diff mbox series

[FFmpeg-devel,V3,1/3] libavfilter/bbox.h: add BoundingBoxHeader and BoundingBox

Message ID 20210222073045.16070-1-yejun.guo@intel.com
State Superseded
Headers show
Series [FFmpeg-devel,V3,1/3] libavfilter/bbox.h: add BoundingBoxHeader and BoundingBox
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Guo, Yejun Feb. 22, 2021, 7:30 a.m. UTC
They will be used for filters such as detect and classify.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
---
 libavfilter/bbox.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
diff mbox series

Patch

diff --git a/libavfilter/bbox.h b/libavfilter/bbox.h
index 116158d59e..7c63dfa727 100644
--- a/libavfilter/bbox.h
+++ b/libavfilter/bbox.h
@@ -22,6 +22,51 @@ 
 #define AVFILTER_BBOX_H
 
 #include <stdint.h>
+#include "libavutil/rational.h"
+
+typedef struct BoundingBoxHeader {
+    /*
+     * Information about how the bounding box is generated.
+     * for example, the DNN model name.
+     */
+    char source[128];
+
+    /* Must be set to the size of BoundingBox (that is,
+     * sizeof(BoundingBox)).
+     */
+    uint32_t bbox_size;
+} BoundingBoxHeader;
+
+typedef struct BoundingBox {
+    /**
+     * Distance in pixels from the top edge of the frame to top
+     * and bottom, and from the left edge of the frame to left and
+     * right, defining the bounding box.
+     */
+    int top;
+    int left;
+    int bottom;
+    int right;
+
+#define BBOX_LABEL_NAME_MAX_LENGTH 32
+
+    /**
+     * Detect result with confidence
+     */
+    char detect_label[BBOX_LABEL_NAME_MAX_LENGTH+1];
+    AVRational detect_confidence;
+
+    /**
+     * At most 4 classifications based on the detected bounding box.
+     * For example, we can get max 4 different attributes with 4 different
+     * DNN models on one bounding box.
+     * classify_count is zero if no classification.
+     */
+#define AV_NUM_BBOX_CLASSIFY 4
+    uint32_t classify_count;
+    char classify_labels[AV_NUM_BBOX_CLASSIFY][BBOX_LABEL_NAME_MAX_LENGTH+1];
+    AVRational classify_confidences[AV_NUM_BBOX_CLASSIFY];
+} BoundingBox;
 
 typedef struct FFBoundingBox {
     int x1, x2, y1, y2;