vagheshpatel commited on
Commit
af83f27
·
verified ·
1 Parent(s): 4154036

Sync object-detection from metro-analytics-catalog

Browse files
Files changed (1) hide show
  1. README.md +14 -8
README.md CHANGED
@@ -236,9 +236,8 @@ The pipeline below runs the FP16 YOLO26 detector on the sample video via
236
  import gi
237
 
238
  gi.require_version("Gst", "1.0")
239
- gi.require_version("GstVideo", "1.0")
240
- from gi.repository import Gst
241
- from gstgva import VideoFrame
242
 
243
  Gst.init(None)
244
 
@@ -261,11 +260,18 @@ pipeline = Gst.parse_launch(pipeline_str)
261
 
262
  def on_buffer(pad, info):
263
  buf = info.get_buffer()
264
- caps = pad.get_current_caps()
265
- frame = VideoFrame(buf, caps=caps)
266
- for region in frame.regions():
267
- print(f" {region.label()} at ({region.rect().x},{region.rect().y})",
268
- flush=True)
 
 
 
 
 
 
 
269
  return Gst.PadProbeReturn.OK
270
 
271
 
 
236
  import gi
237
 
238
  gi.require_version("Gst", "1.0")
239
+ gi.require_version("GstAnalytics", "1.0")
240
+ from gi.repository import Gst, GLib, GstAnalytics
 
241
 
242
  Gst.init(None)
243
 
 
260
 
261
  def on_buffer(pad, info):
262
  buf = info.get_buffer()
263
+ rmeta = GstAnalytics.buffer_get_analytics_relation_meta(buf)
264
+ if rmeta is None:
265
+ return Gst.PadProbeReturn.OK
266
+ idx = 1
267
+ while True:
268
+ ok, od = rmeta.get_od_mtd(idx)
269
+ if not ok:
270
+ break
271
+ label = GLib.quark_to_string(od.get_obj_type())
272
+ _, x, y, w, h, conf = od.get_location()
273
+ print(f" {label} at ({int(x)},{int(y)})", flush=True)
274
+ idx += 1
275
  return Gst.PadProbeReturn.OK
276
 
277