analytics: add api on OD to retrieve bbox confidence

- Add a specific api to retrieve bbox confidence level without having to
  retrieve it's location.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6017>
This commit is contained in:
Daniel Morin 2024-01-29 22:11:17 -05:00 committed by GStreamer Marge Bot
parent 6dc902a962
commit 42227d7de3
3 changed files with 49 additions and 0 deletions

View file

@ -238,6 +238,24 @@ is generally expected to be allocated on the stack.</doc>
identified by @id is stored.</doc>
<type name="RelationMeta" c:type="GstAnalyticsRelationMeta*"/>
</field>
<method name="get_confidence_lvl" c:identifier="gst_analytics_od_mtd_get_confidence_lvl" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Retrieve location confidence level.</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">TRUE on success, otherwise FALSE.</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="instance" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">instance</doc>
<type name="ODMtd" c:type="GstAnalyticsODMtd*"/>
</instance-parameter>
<parameter name="loc_conf_lvl" direction="out" caller-allocates="0" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Confidence on object location</doc>
<type name="gfloat" c:type="gfloat*"/>
</parameter>
</parameters>
</method>
<method name="get_location" c:identifier="gst_analytics_od_mtd_get_location" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Retrieve location and location confidence level.</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h"/>

View file

@ -141,6 +141,33 @@ gst_analytics_od_mtd_get_location (GstAnalyticsODMtd * instance,
return TRUE;
}
/**
* gst_analytics_od_mtd_get_confidence_lvl:
* @instance: instance
* @loc_conf_lvl: (out): Confidence on object location
*
* Retrieve location confidence level.
*
* Returns: TRUE on success, otherwise FALSE.
*
* Since: 1.24
*/
gboolean
gst_analytics_od_mtd_get_confidence_lvl (GstAnalyticsODMtd * instance,
gfloat * loc_conf_lvl)
{
GstAnalyticsODMtdData *data;
g_return_val_if_fail (instance && loc_conf_lvl, FALSE);
data = gst_analytics_relation_meta_get_mtd_data (instance->meta,
instance->id);
g_return_val_if_fail (data != NULL, FALSE);
*loc_conf_lvl = data->location_confidence_lvl;
return TRUE;
}
/**
* gst_analytics_od_mtd_get_obj_type:
* @handle: Instance handle

View file

@ -52,6 +52,10 @@ GST_ANALYTICS_META_API
gboolean gst_analytics_od_mtd_get_location (GstAnalyticsODMtd * instance,
gint * x, gint * y, gint * w, gint * h, gfloat * loc_conf_lvl);
GST_ANALYTICS_META_API
gboolean gst_analytics_od_mtd_get_confidence_lvl (GstAnalyticsODMtd * instance,
gfloat * loc_conf_lvl);
GST_ANALYTICS_META_API
GQuark gst_analytics_od_mtd_get_obj_type (GstAnalyticsODMtd * handle);