Sync worker-safety-detection from metro-analytics-catalog
Browse files
README.md
CHANGED
|
@@ -117,9 +117,8 @@ annotated result to `output_dlstreamer.mp4`.
|
|
| 117 |
import gi
|
| 118 |
|
| 119 |
gi.require_version("Gst", "1.0")
|
| 120 |
-
gi.require_version("
|
| 121 |
-
from gi.repository import Gst
|
| 122 |
-
from gstgva import VideoFrame
|
| 123 |
|
| 124 |
Gst.init(None)
|
| 125 |
|
|
@@ -142,11 +141,18 @@ pipeline = Gst.parse_launch(pipeline_str)
|
|
| 142 |
|
| 143 |
def on_buffer(pad, info):
|
| 144 |
buf = info.get_buffer()
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
return Gst.PadProbeReturn.OK
|
| 151 |
|
| 152 |
|
|
|
|
| 117 |
import gi
|
| 118 |
|
| 119 |
gi.require_version("Gst", "1.0")
|
| 120 |
+
gi.require_version("GstAnalytics", "1.0")
|
| 121 |
+
from gi.repository import Gst, GLib, GstAnalytics
|
|
|
|
| 122 |
|
| 123 |
Gst.init(None)
|
| 124 |
|
|
|
|
| 141 |
|
| 142 |
def on_buffer(pad, info):
|
| 143 |
buf = info.get_buffer()
|
| 144 |
+
rmeta = GstAnalytics.buffer_get_analytics_relation_meta(buf)
|
| 145 |
+
if rmeta is None:
|
| 146 |
+
return Gst.PadProbeReturn.OK
|
| 147 |
+
idx = 1
|
| 148 |
+
while True:
|
| 149 |
+
ok, od = rmeta.get_od_mtd(idx)
|
| 150 |
+
if not ok:
|
| 151 |
+
break
|
| 152 |
+
label = GLib.quark_to_string(od.get_obj_type())
|
| 153 |
+
_, x, y, w, h, conf = od.get_location()
|
| 154 |
+
print(f" [PPE] {label} conf={conf:.2f}", flush=True)
|
| 155 |
+
idx += 1
|
| 156 |
return Gst.PadProbeReturn.OK
|
| 157 |
|
| 158 |
|