[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M752XNJFF5KT07AZAZ6N07BP":3,"skill-same:01M752XNJFF5KT07AZAZ6N07BP":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M752XNJFF5KT07AZAZ6N07BP","hl-build-pipeline-app",null,"Build a complete GStreamer pipeline app for real-time video processing on Hailo-8\u002F8L\u002F10H.","TejasLamba2006\u002Fhailo-apps","TejasLamba2006","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F73745640?v=4","01M752WBF8KHM6KJTEQXTJZR9K","Tejas Lamba","01M752WBGE2NS66C4ENRHWY36S",0,"MIT","https:\u002F\u002Fgithub.com\u002FTejasLamba2006\u002Fhailo-apps\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fhl-build-pipeline-app\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: hl-build-pipeline-app\ndescription: Build a complete GStreamer pipeline app for real-time video processing on Hailo-8\u002F8L\u002F10H.\n---\n\n# Skill: Build GStreamer Pipeline Application\n\nBuild a complete GStreamer pipeline app for real-time video processing on Hailo-8\u002F8L\u002F10H.\n\n## When This Skill Is Loaded\n\n- User wants **real-time video processing** (detection, pose, segmentation)\n- User mentions: GStreamer, pipeline, stream, FPS, real-time video, tracking\n- User needs a video app with **high throughput** rather than AI understanding\n\n## Reference Implementations\n\nThe canonical pipeline app is `detection\u002F`. Other examples: `pose_estimation\u002F`, `instance_segmentation\u002F`, `face_recognition\u002F`.\n\n**Do NOT read these source files.** This SKILL.md contains all patterns needed to build any pipeline app. The sections below cover: basic pipelines, frame overlays, custom backgrounds, pose extraction, detection data, and subclassing existing pipeline classes.\n\n### Minimum Context for Any Pipeline App\nRead this SKILL.md (full file, single read) + `common_pitfalls.md`. That's it. Build immediately.\n\n## Build Process\n\n### Step 1: Create App Directory\n\nCreate the app directory:\n\n```\nhailo_apps\u002Fpython\u002F\u003Ctype>\u002F\u003Capp_name>\u002F\n├── app.yaml              # App manifest (required)\n├── run.sh                # Launch wrapper\n├── __init__.py\n├── \u003Capp_name>.py         # Main app\n└── README.md             # Usage documentation (REQUIRED — never skip)\n```\n\nCreate `app.yaml` with `type: pipeline` and `run.sh` wrapper.\nDo NOT register in `defines.py` or `resources_config.yaml`.\n\n### Step 2: Build Main App\n\n```python\nimport gi\ngi.require_version('Gst', '1.0')\nfrom gi.repository import Gst\n\nimport hailo  # Required for detection\u002Flandmark extraction in callbacks\n\nfrom hailo_apps.python.core.common.hailo_logger import get_logger\nfrom hailo_apps.python.core.common.core import resolve_hef_path, handle_list_models_flag\nfrom hailo_apps.python.core.common.parser import get_pipeline_parser\n# If your app uses resolve_hef_path with an app name, register it in defines.py.\n# Otherwise use a local string constant:\n# APP_NAME = \"my_pipeline_app\"\nfrom hailo_apps.python.core.gstreamer.gstreamer_app import GStreamerApp, app_callback_class\nfrom hailo_apps.python.core.gstreamer.gstreamer_helper_pipelines import (\n    SOURCE_PIPELINE,\n    INFERENCE_PIPELINE,\n    INFERENCE_PIPELINE_WRAPPER,\n    DISPLAY_PIPELINE,\n    TRACKER_PIPELINE,\n    USER_CALLBACK_PIPELINE,\n    QUEUE,\n)\nfrom hailo_apps.python.core.common.buffer_utils import (\n    get_caps_from_pad,\n    get_numpy_from_buffer,\n)\n\nlogger = get_logger(__name__)\n\nAPP_NAME = \"my_pipeline_app\"\n\n\nclass UserAppCallback(app_callback_class):\n    \"\"\"Custom callback class for per-frame state.\"\"\"\n    def __init__(self):\n        super().__init__()\n        self.detection_count = 0\n\n\ndef app_callback(element, buffer, user_data):\n    \"\"\"Per-frame callback — runs on every GStreamer buffer.\"\"\"\n    # Access detections from buffer\n    # user_data.detection_count += len(detections)\n    return Gst.FlowReturn.OK\n\n\nclass MyPipelineApp(GStreamerApp):\n    def __init__(self, app_callback, user_data, parser=None):\n        parser = parser or get_pipeline_parser()\n        handle_list_models_flag(parser, APP_NAME)\n        args = parser.parse_args()\n        super().__init__(args, user_data)\n\n        self.hef_path = resolve_hef_path(args.hef_path, APP_NAME, self.arch)\n        logger.info(\"HEF: %s\", self.hef_path)\n\n    def get_pipeline_string(self):\n        return (\n            SOURCE_PIPELINE(self.video_source, self.arch)\n            + \" ! \"\n            + INFERENCE_PIPELINE(\n                hef_path=self.hef_path,\n                batch_size=self.batch_size,\n            )\n            + \" ! \"\n            + USER_CALLBACK_PIPELINE()\n            + \" ! \"\n            + DISPLAY_PIPELINE(video_sink=self.video_sink, sync=self.sync)\n        )\n\n\ndef main():\n    user_data = UserAppCallback()\n    app = MyPipelineApp(app_callback, user_data)\n    app.run()\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Step 4: Validate\n\n```bash\npython3 .github\u002Fscripts\u002Fvalidate_app.py hailo_apps\u002Fpython\u002Fpipeline_apps\u002Fmy_pipeline_app --smoke-test\n```\n\n## Critical Conventions\n\n0. **USB camera input**: Always use `--input usb` for USB cameras — the framework auto-detects the correct device. **NEVER** hardcode `\u002Fdev\u002Fvideo0` — that is often the integrated webcam, not the USB camera. If you need a specific device, run `v4l2-ctl --list-devices` first.\n1. **CLI parser**: `get_pipeline_parser()` (NOT `get_standalone_parser()`)\n2. **Pipeline composition**: Use helper functions — `SOURCE_PIPELINE`, `INFERENCE_PIPELINE`, `DISPLAY_PIPELINE`\n3. **Callback**: `app_callback(element, buffer, user_data)` — never call `user_data.increment()`\n4. **Resolution preservation**: Use `INFERENCE_PIPELINE_WRAPPER` for full-res display\n5. **Tracking**: `TRACKER_PIPELINE()` for ByteTrack\n6. **Cascaded inference**: `CROPPER_PIPELINE()` for crop → second model\n7. **VAAPI**: Add `QUEUE(\"vaapi_queue\") + vaapi_convert_pipeline` for HW decode\n\n## Common Patterns\n\n| Pattern | Helper | Use Case |\n|---|---|---|\n| Basic inference | `INFERENCE_PIPELINE(hef_path=...)` | Single model |\n| With tracking | `+ TRACKER_PIPELINE()` | Object tracking |\n| With user callback | `+ USER_CALLBACK_PIPELINE()` | Per-frame processing |\n| Cascaded | `CROPPER_PIPELINE(...)` | Face detection → recognition |\n| Multi-source | Multiple `SOURCE_PIPELINE` + compositor | Dashboard view |\n| Tiling | Custom tiling pipeline | Small object detection |\n\n---\n\n## Frame Overlay Pattern (use_frame + OpenCV Drawing)\n\nWhen you need to draw on frames (overlays, game graphics, custom visualizations), use the `use_frame` pattern:\n\n### 1. Enable use_frame in your callback class\n```python\nclass UserAppCallback(app_callback_class):\n    def __init__(self):\n        super().__init__()\n        self.use_frame = True  # Enables frame access in callback\n```\n\n**CRITICAL**: Setting `use_frame = True` in the callback class alone is NOT enough when subclassing a pipeline class (e.g., `GStreamerPoseEstimationApp`). `GStreamerApp.__init__()` overwrites `user_data.use_frame` from the CLI default (`False`). You MUST also force it in the app class:\n```python\nclass MyApp(GStreamerPoseEstimationApp):\n    def __init__(self, app_callback, user_data, parser=None):\n        super().__init__(app_callback, user_data, parser)\n        self.options_menu.use_frame = True  # starts display process\n        user_data.use_frame = True          # enables frame extraction\n```\nWithout this, `set_frame()` calls are silently ignored and only the raw camera feed is shown.\n\n### 2. Get the frame in the callback\n```python\nimport cv2\nimport hailo\nfrom hailo_apps.python.core.common.buffer_utils import get_caps_from_pad, get_numpy_from_buffer\n\ndef app_callback(element, buffer, user_data):\n    pad = element.get_static_pad(\"src\")\n    format, width, height = get_caps_from_pad(pad)\n\n    frame = None\n    if user_data.use_frame and format and width and height:\n        # Signature: get_numpy_from_buffer(buffer, format, width, height)\n        # Returns RGB numpy array (H, W, 3)\n        frame = get_numpy_from_buffer(buffer, format, width, height)\n```\n\n### 3. Draw with OpenCV, convert RGB→BGR, then set_frame()\n```python\n    if user_data.use_frame and frame is not None:\n        # Draw on the frame (frame is RGB from GStreamer)\n        cv2.circle(frame, (x, y), 10, (0, 255, 0), -1)\n        cv2.putText(frame, \"Hello\", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (255, 255, 255), 2)\n\n        # CRITICAL: Convert RGB → BGR before set_frame (OpenCV expects BGR)\n        frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)\n        user_data.set_frame(frame)\n\n    return Gst.FlowReturn.OK\n```\n\n**Key rules:**\n- `get_numpy_from_buffer(buffer, format, width, height)` — NOT `(buffer, pad, format)`\n- Frame comes in **RGB** from GStreamer\n- Must convert to **BGR** with `cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)` before `set_frame()`\n- Always check `user_data.use_frame` and that `frame is not None`\n- Pass `--use-frame` on CLI to enable (or set `self.use_frame = True` in callback class)\n\n### Custom Background Pattern (games, virtual scenes)\n\nWhen the user wants a **custom background image** (not the live camera feed), use `background.copy()` — **never blend** the camera feed with the background via `addWeighted` or similar.\n\n```python\n# ✅ CORRECT — background only, no camera feed visible\nif self.background is not None:\n    output = self.background.copy()\nelse:\n    output = np.zeros_like(frame)\n\n# Draw game elements on output...\n# Draw hand\u002Fbody markers from pose data on output...\n\noutput = cv2.cvtColor(output, cv2.COLOR_RGB2BGR)\nuser_data.set_frame(output)\n```\n\n```python\n# ❌ WRONG — blends camera feed, user sees themselves + background = confusing\noutput = cv2.addWeighted(self.background, 0.4, frame, 0.6, 0)\n```\n\n**Rule**: If the user provides a background image or asks for a virtual scene, the camera feed is used **only for pose\u002Fdetection data extraction** — it must NOT appear in the rendered output. The `frame` from `get_numpy_from_buffer()` is still needed to extract detections, but the display output should be `background.copy()` with game elements drawn on top.\n\n---\n\n## Detection Data Extraction in Callbacks\n\n### Getting ROI and Detections\n```python\nimport hailo\n\ndef app_callback(element, buffer, user_data):\n    roi = hailo.get_roi_from_buffer(buffer)\n    detections = roi.get_objects_typed(hailo.HAILO_DETECTION)\n\n    for detection in detections:\n        label = detection.get_label()        # e.g., \"person\", \"car\"\n        confidence = detection.get_confidence()  # 0.0 - 1.0\n        bbox = detection.get_bbox()          # Normalized bounding box\n        # bbox.xmin(), bbox.ymin(), bbox.width(), bbox.height() — all normalized [0,1]\n```\n\n### Getting Track IDs (requires TRACKER_PIPELINE in pipeline)\n```python\n        track_id = 0\n        track = detection.get_objects_typed(hailo.HAILO_UNIQUE_ID)\n        if len(track) == 1:\n            track_id = track[0].get_id()\n```\n\n### Getting Pose Landmarks (pose estimation models)\n```python\n        landmarks = detection.get_objects_typed(hailo.HAILO_LANDMARKS)\n        if landmarks:\n            points = landmarks[0].get_points()\n            # Each point has .x() and .y() — normalized to bounding box\n            # Convert to pixel coordinates:\n            for point in points:\n                pixel_x = int((point.x() * bbox.width() + bbox.xmin()) * frame_width)\n                pixel_y = int((point.y() * bbox.height() + bbox.ymin()) * frame_height)\n```\n\n### Hailo Detection Types Reference\n| Type | Constant | Method | Returns |\n|---|---|---|---|\n| Detection boxes | `hailo.HAILO_DETECTION` | `roi.get_objects_typed()` | List of detections |\n| Track IDs | `hailo.HAILO_UNIQUE_ID` | `detection.get_objects_typed()` | List with single ID object |\n| Pose landmarks | `hailo.HAILO_LANDMARKS` | `detection.get_objects_typed()` | List of landmark sets |\n| Classification | `hailo.HAILO_CLASSIFICATION` | `detection.get_objects_typed()` | List of classifications |\n| Masks | `hailo.HAILO_CONF_CLASS_MASK` | `detection.get_objects_typed()` | Segmentation masks |\n\n---\n\n## Reusing Existing Pipeline Classes\n\nFor apps that extend existing pipelines (e.g., a pose estimation game), **subclass the domain-specific pipeline class** instead of the base `GStreamerApp`:\n\n```python\nfrom hailo_apps.python.pipeline_apps.pose_estimation.pose_estimation_pipeline import (\n    GStreamerPoseEstimationApp,\n)\n\nclass MyPoseGame(GStreamerPoseEstimationApp):\n    \"\"\"Inherits full pose pipeline: SOURCE → INFERENCE → TRACKER → USER_CALLBACK → DISPLAY\"\"\"\n    pass  # Pipeline is already configured — just write your callback\n\ndef app_callback(element, buffer, user_data):\n    # All pose detection data is available here\n    ...\n\ndef main():\n    user_data = UserAppCallback()\n    app = MyPoseGame(app_callback, user_data)  # No pipeline config needed\n    app.run()\n```\n\n**Available pipeline classes to subclass:**\n| Class | Module | Pipeline includes |\n|---|---|---|\n| `GStreamerPoseEstimationApp` | `pose_estimation.pose_estimation_pipeline` | Inference + Tracker + User Callback |\n| `GStreamerDetectionApp` | `detection.detection_pipeline` | Inference + User Callback |\n| `GStreamerInstanceSegmentationApp` | `instance_segmentation.instance_segmentation_pipeline` | Inference + User Callback |\n| `GStreamerFaceRecognitionApp` | `face_recognition.face_recognition_pipeline` | Cascaded inference + Tracker |\n\nWhen subclassing, you get the full pipeline for free — just provide your custom `app_callback` and `app_callback_class`.\n\n","# Skill: Build GStreamer Pipeline Application\n\nBuild a complete GStreamer pipeline app for real-time video processing on Hailo-8\u002F8L\u002F10H.\n\n## When This Skill Is Loaded\n\n- User wants **real-time video processing** (detection, pose, segmentation)\n- User mentions: GStreamer, pipeline, stream, FPS, real-time video, tracking\n- User needs a video app with **high throughput** rather than AI understanding\n\n## Reference Implementations\n\nThe canonical pipeline app is `detection\u002F`. Other examples: `pose_estimation\u002F`, `instance_segmentation\u002F`, `face_recognition\u002F`.\n\n**Do NOT read these source files.** This SKILL.md contains all patterns needed to build any pipeline app. The sections below cover: basic pipelines, frame overlays, custom backgrounds, pose extraction, detection data, and subclassing existing pipeline classes.\n\n### Minimum Context for Any Pipeline App\nRead this SKILL.md (full file, single read) + `common_pitfalls.md`. That's it. Build immediately.\n\n## Build Process\n\n### Step 1: Create App Directory\n\nCreate the app directory:\n\n```\nhailo_apps\u002Fpython\u002F\u003Ctype>\u002F\u003Capp_name>\u002F\n├── app.yaml              # App manifest (required)\n├── run.sh                # Launch wrapper\n├── __init__.py\n├── \u003Capp_name>.py         # Main app\n└── README.md             # Usage documentation (REQUIRED — never skip)\n```\n\nCreate `app.yaml` with `type: pipeline` and `run.sh` wrapper.\nDo NOT register in `defines.py` or `resources_config.yaml`.\n\n### Step 2: Build Main App\n\n```python\nimport gi\ngi.require_version('Gst', '1.0')\nfrom gi.repository import Gst\n\nimport hailo  # Required for detection\u002Flandmark extraction in callbacks\n\nfrom hailo_apps.python.core.common.hailo_logger import get_logger\nfrom hailo_apps.python.core.common.core import resolve_hef_path, handle_list_models_flag\nfrom hailo_apps.python.core.common.parser import get_pipeline_parser\n# If your app uses resolve_hef_path with an app name, register it in defines.py.\n# Otherwise use a local string constant:\n# APP_NAME = \"my_pipeline_app\"\nfrom hailo_apps.python.core.gstreamer.gstreamer_app import GStreamerApp, app_callback_class\nfrom hailo_apps.python.core.gstreamer.gstreamer_helper_pipelines import (\n    SOURCE_PIPELINE,\n    INFERENCE_PIPELINE,\n    INFERENCE_PIPELINE_WRAPPER,\n    DISPLAY_PIPELINE,\n    TRACKER_PIPELINE,\n    USER_CALLBACK_PIPELINE,\n    QUEUE,\n)\nfrom hailo_apps.python.core.common.buffer_utils import (\n    get_caps_from_pad,\n    get_numpy_from_buffer,\n)\n\nlogger = get_logger(__name__)\n\nAPP_NAME = \"my_pipeline_app\"\n\n\nclass UserAppCallback(app_callback_class):\n    \"\"\"Custom callback class for per-frame state.\"\"\"\n    def __init__(self):\n        super().__init__()\n        self.detection_count = 0\n\n\ndef app_callback(element, buffer, user_data):\n    \"\"\"Per-frame callback — runs on every GStreamer buffer.\"\"\"\n    # Access detections from buffer\n    # user_data.detection_count += len(detections)\n    return Gst.FlowReturn.OK\n\n\nclass MyPipelineApp(GStreamerApp):\n    def __init__(self, app_callback, user_data, parser=None):\n        parser = parser or get_pipeline_parser()\n        handle_list_models_flag(parser, APP_NAME)\n        args = parser.parse_args()\n        super().__init__(args, user_data)\n\n        self.hef_path = resolve_hef_path(args.hef_path, APP_NAME, self.arch)\n        logger.info(\"HEF: %s\", self.hef_path)\n\n    def get_pipeline_string(self):\n        return (\n            SOURCE_PIPELINE(self.video_source, self.arch)\n            + \" ! \"\n            + INFERENCE_PIPELINE(\n                hef_path=self.hef_path,\n                batch_size=self.batch_size,\n            )\n            + \" ! \"\n            + USER_CALLBACK_PIPELINE()\n            + \" ! \"\n            + DISPLAY_PIPELINE(video_sink=self.video_sink, sync=self.sync)\n        )\n\n\ndef main():\n    user_data = UserAppCallback()\n    app = MyPipelineApp(app_callback, user_data)\n    app.run()\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Step 4: Validate\n\n```bash\npython3 .github\u002Fscripts\u002Fvalidate_app.py hailo_apps\u002Fpython\u002Fpipeline_apps\u002Fmy_pipeline_app --smoke-test\n```\n\n## Critical Conventions\n\n0. **USB camera input**: Always use `--input usb` for USB cameras — the framework auto-detects the correct device. **NEVER** hardcode `\u002Fdev\u002Fvideo0` — that is often the integrated webcam, not the USB camera. If you need a specific device, run `v4l2-ctl --list-devices` first.\n1. **CLI parser**: `get_pipeline_parser()` (NOT `get_standalone_parser()`)\n2. **Pipeline composition**: Use helper functions — `SOURCE_PIPELINE`, `INFERENCE_PIPELINE`, `DISPLAY_PIPELINE`\n3. **Callback**: `app_callback(element, buffer, user_data)` — never call `user_data.increment()`\n4. **Resolution preservation**: Use `INFERENCE_PIPELINE_WRAPPER` for full-res display\n5. **Tracking**: `TRACKER_PIPELINE()` for ByteTrack\n6. **Cascaded inference**: `CROPPER_PIPELINE()` for crop → second model\n7. **VAAPI**: Add `QUEUE(\"vaapi_queue\") + vaapi_convert_pipeline` for HW decode\n\n## Common Patterns\n\n| Pattern | Helper | Use Case |\n|---|---|---|\n| Basic inference | `INFERENCE_PIPELINE(hef_path=...)` | Single model |\n| With tracking | `+ TRACKER_PIPELINE()` | Object tracking |\n| With user callback | `+ USER_CALLBACK_PIPELINE()` | Per-frame processing |\n| Cascaded | `CROPPER_PIPELINE(...)` | Face detection → recognition |\n| Multi-source | Multiple `SOURCE_PIPELINE` + compositor | Dashboard view |\n| Tiling | Custom tiling pipeline | Small object detection |\n\n---\n\n## Frame Overlay Pattern (use_frame + OpenCV Drawing)\n\nWhen you need to draw on frames (overlays, game graphics, custom visualizations), use the `use_frame` pattern:\n\n### 1. Enable use_frame in your callback class\n```python\nclass UserAppCallback(app_callback_class):\n    def __init__(self):\n        super().__init__()\n        self.use_frame = True  # Enables frame access in callback\n```\n\n**CRITICAL**: Setting `use_frame = True` in the callback class alone is NOT enough when subclassing a pipeline class (e.g., `GStreamerPoseEstimationApp`). `GStreamerApp.__init__()` overwrites `user_data.use_frame` from the CLI default (`False`). You MUST also force it in the app class:\n```python\nclass MyApp(GStreamerPoseEstimationApp):\n    def __init__(self, app_callback, user_data, parser=None):\n        super().__init__(app_callback, user_data, parser)\n        self.options_menu.use_frame = True  # starts display process\n        user_data.use_frame = True          # enables frame extraction\n```\nWithout this, `set_frame()` calls are silently ignored and only the raw camera feed is shown.\n\n### 2. Get the frame in the callback\n```python\nimport cv2\nimport hailo\nfrom hailo_apps.python.core.common.buffer_utils import get_caps_from_pad, get_numpy_from_buffer\n\ndef app_callback(element, buffer, user_data):\n    pad = element.get_static_pad(\"src\")\n    format, width, height = get_caps_from_pad(pad)\n\n    frame = None\n    if user_data.use_frame and format and width and height:\n        # Signature: get_numpy_from_buffer(buffer, format, width, height)\n        # Returns RGB numpy array (H, W, 3)\n        frame = get_numpy_from_buffer(buffer, format, width, height)\n```\n\n### 3. Draw with OpenCV, convert RGB→BGR, then set_frame()\n```python\n    if user_data.use_frame and frame is not None:\n        # Draw on the frame (frame is RGB from GStreamer)\n        cv2.circle(frame, (x, y), 10, (0, 255, 0), -1)\n        cv2.putText(frame, \"Hello\", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (255, 255, 255), 2)\n\n        # CRITICAL: Convert RGB → BGR before set_frame (OpenCV expects BGR)\n        frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)\n        user_data.set_frame(frame)\n\n    return Gst.FlowReturn.OK\n```\n\n**Key rules:**\n- `get_numpy_from_buffer(buffer, format, width, height)` — NOT `(buffer, pad, format)`\n- Frame comes in **RGB** from GStreamer\n- Must convert to **BGR** with `cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)` before `set_frame()`\n- Always check `user_data.use_frame` and that `frame is not None`\n- Pass `--use-frame` on CLI to enable (or set `self.use_frame = True` in callback class)\n\n### Custom Background Pattern (games, virtual scenes)\n\nWhen the user wants a **custom background image** (not the live camera feed), use `background.copy()` — **never blend** the camera feed with the background via `addWeighted` or similar.\n\n```python\n# ✅ CORRECT — background only, no camera feed visible\nif self.background is not None:\n    output = self.background.copy()\nelse:\n    output = np.zeros_like(frame)\n\n# Draw game elements on output...\n# Draw hand\u002Fbody markers from pose data on output...\n\noutput = cv2.cvtColor(output, cv2.COLOR_RGB2BGR)\nuser_data.set_frame(output)\n```\n\n```python\n# ❌ WRONG — blends camera feed, user sees themselves + background = confusing\noutput = cv2.addWeighted(self.background, 0.4, frame, 0.6, 0)\n```\n\n**Rule**: If the user provides a background image or asks for a virtual scene, the camera feed is used **only for pose\u002Fdetection data extraction** — it must NOT appear in the rendered output. The `frame` from `get_numpy_from_buffer()` is still needed to extract detections, but the display output should be `background.copy()` with game elements drawn on top.\n\n---\n\n## Detection Data Extraction in Callbacks\n\n### Getting ROI and Detections\n```python\nimport hailo\n\ndef app_callback(element, buffer, user_data):\n    roi = hailo.get_roi_from_buffer(buffer)\n    detections = roi.get_objects_typed(hailo.HAILO_DETECTION)\n\n    for detection in detections:\n        label = detection.get_label()        # e.g., \"person\", \"car\"\n        confidence = detection.get_confidence()  # 0.0 - 1.0\n        bbox = detection.get_bbox()          # Normalized bounding box\n        # bbox.xmin(), bbox.ymin(), bbox.width(), bbox.height() — all normalized [0,1]\n```\n\n### Getting Track IDs (requires TRACKER_PIPELINE in pipeline)\n```python\n        track_id = 0\n        track = detection.get_objects_typed(hailo.HAILO_UNIQUE_ID)\n        if len(track) == 1:\n            track_id = track[0].get_id()\n```\n\n### Getting Pose Landmarks (pose estimation models)\n```python\n        landmarks = detection.get_objects_typed(hailo.HAILO_LANDMARKS)\n        if landmarks:\n            points = landmarks[0].get_points()\n            # Each point has .x() and .y() — normalized to bounding box\n            # Convert to pixel coordinates:\n            for point in points:\n                pixel_x = int((point.x() * bbox.width() + bbox.xmin()) * frame_width)\n                pixel_y = int((point.y() * bbox.height() + bbox.ymin()) * frame_height)\n```\n\n### Hailo Detection Types Reference\n| Type | Constant | Method | Returns |\n|---|---|---|---|\n| Detection boxes | `hailo.HAILO_DETECTION` | `roi.get_objects_typed()` | List of detections |\n| Track IDs | `hailo.HAILO_UNIQUE_ID` | `detection.get_objects_typed()` | List with single ID object |\n| Pose landmarks | `hailo.HAILO_LANDMARKS` | `detection.get_objects_typed()` | List of landmark sets |\n| Classification | `hailo.HAILO_CLASSIFICATION` | `detection.get_objects_typed()` | List of classifications |\n| Masks | `hailo.HAILO_CONF_CLASS_MASK` | `detection.get_objects_typed()` | Segmentation masks |\n\n---\n\n## Reusing Existing Pipeline Classes\n\nFor apps that extend existing pipelines (e.g., a pose estimation game), **subclass the domain-specific pipeline class** instead of the base `GStreamerApp`:\n\n```python\nfrom hailo_apps.python.pipeline_apps.pose_estimation.pose_estimation_pipeline import (\n    GStreamerPoseEstimationApp,\n)\n\nclass MyPoseGame(GStreamerPoseEstimationApp):\n    \"\"\"Inherits full pose pipeline: SOURCE → INFERENCE → TRACKER → USER_CALLBACK → DISPLAY\"\"\"\n    pass  # Pipeline is already configured — just write your callback\n\ndef app_callback(element, buffer, user_data):\n    # All pose detection data is available here\n    ...\n\ndef main():\n    user_data = UserAppCallback()\n    app = MyPoseGame(app_callback, user_data)  # No pipeline config needed\n    app.run()\n```\n\n**Available pipeline classes to subclass:**\n| Class | Module | Pipeline includes |\n|---|---|---|\n| `GStreamerPoseEstimationApp` | `pose_estimation.pose_estimation_pipeline` | Inference + Tracker + User Callback |\n| `GStreamerDetectionApp` | `detection.detection_pipeline` | Inference + User Callback |\n| `GStreamerInstanceSegmentationApp` | `instance_segmentation.instance_segmentation_pipeline` | Inference + User Callback |\n| `GStreamerFaceRecognitionApp` | `face_recognition.face_recognition_pipeline` | Cascaded inference + Tracker |\n\nWhen subclassing, you get the full pipeline for free — just provide your custom `app_callback` and `app_callback_class`.\n\n",{"name":5,"description":7},"main","9beb824677028b4974e90b0cc558b6fd6de3d935",".github\u002Fskills\u002Fhl-build-pipeline-app","https:\u002F\u002Fgithub.com\u002FTejasLamba2006\u002Fhailo-apps","https:\u002F\u002Fgithub.com\u002FTejasLamba2006","https:\u002F\u002Ftejas.is-a.dev\u002F","Rust | Java |  TypeScript ","2026-11-12 16:44:30",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add TejasLamba2006\u002Fhailo-apps --skill hl-build-pipeline-app",{"tool":38,"command":39},"bunx","bunx skills add TejasLamba2006\u002Fhailo-apps --skill hl-build-pipeline-app",{"tool":41,"command":42},"pnpm","pnpm dlx skills add TejasLamba2006\u002Fhailo-apps --skill hl-build-pipeline-app","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTejasLamba2006\u002Fhailo-apps\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fhl-build-pipeline-app\u002FSKILL.md",true,[],[47,53,60,67,74,81],{"skillNo":48,"name":49,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M752Y17N6R7ME2TRA2NNS5X3","hl-build-voice-app","https:\u002F\u002Fgithub.com\u002FTejasLamba2006\u002Fhailo-apps\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fhl-build-voice-app\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M752XW3BPNVCM0823YAEP6YA","hl-build-vlm-app","Build a complete Vision-Language Model application that uses the Hailo-10H VLM for image understanding.","https:\u002F\u002Fgithub.com\u002FTejasLamba2006\u002Fhailo-apps\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fhl-build-vlm-app\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M752XT54VT5E95QASFX7F8JR","hl-build-standalone-app","Build a complete standalone app using HailoInfer + OpenCV on Hailo-8\u002F8L\u002F10H.","https:\u002F\u002Fgithub.com\u002FTejasLamba2006\u002Fhailo-apps\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fhl-build-standalone-app\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M752XK1JS2XC5BF31EVA06XP","hl-build-llm-app","Build a complete LLM text generation app running on Hailo-10H.","https:\u002F\u002Fgithub.com\u002FTejasLamba2006\u002Fhailo-apps\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fhl-build-llm-app\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M752XFTEGGYMFEWZVECY31HM","hl-build-agent-app","Build a complete agent app with LLM reasoning + tool execution on Hailo-10H.","https:\u002F\u002Fgithub.com\u002FTejasLamba2006\u002Fhailo-apps\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fhl-build-agent-app\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M752XBWXEB5MRRHGAQBK6JHC","hl-validate","Validation at every phase gate.","https:\u002F\u002Fgithub.com\u002FTejasLamba2006\u002Fhailo-apps\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fhl-validate\u002FSKILL.md",[],[]]