Skip to content

Add sync subnode for FrameCropper inputs#303

Merged
tadeas0 merged 4 commits into
mainfrom
feat/frame-cropper-input-sync
Jul 14, 2026
Merged

Add sync subnode for FrameCropper inputs#303
tadeas0 merged 4 commits into
mainfrom
feat/frame-cropper-input-sync

Conversation

@tadeas0

@tadeas0 tadeas0 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Purpose

Add Sync subnode in front of FrameCropper inputs. This enables non-blocking queue usage earlier in the pipeline and makes the FrameCropper node more robust.

Specification

None / not applicable

Dependencies & Potential Impact

None / not applicable

Deployment Plan

None / not applicable

Testing & Validation

All oak-examples using FrameCropper work same as before after this change.

AI Usage

Assisted-by: Pi Coding Agent:GPT-5.5

Submitted code was reviewed by a human: YES

The author is taking the responsibility for the contribution: YES

Summary by CodeRabbit

  • New Features

    • Added an optional synchronization threshold (syncThreshold) for frame cropping to better pair frames with detections.
    • Enhanced waiting-on-config workflows for frame processing with manipulation configs, including optional synchronization when waitForConfig is enabled.
  • Bug Fixes

    • Improved pairing reliability by synchronizing frame and related metadata into a single matched stream, reducing mismatches between images and their associated detections/configs.

@tadeas0
tadeas0 requested a review from PetrNovota July 1, 2026 12:50
@github-actions github-actions Bot added the enhancement New feature or request label Jul 1, 2026
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 29ce873b-aa93-4591-89a0-233a85467231

📥 Commits

Reviewing files that changed from the base of the PR and between f179a35 and bc27ff5.

📒 Files selected for processing (1)
  • depthai_nodes/node/frame_cropper.py

📝 Walkthrough

Walkthrough

FrameCropper now synchronizes frames with detections or manipulation configurations through dai.node.Sync. Scripts consume synchronized groups, waitForConfig controls the synchronized manipulation-config path, and both public APIs support configurable synchronization thresholds.

Changes

FrameCropper synchronized cropping pipeline

Layer / File(s) Summary
Script content and initialization
depthai_nodes/node/frame_cropper.py
Initializes synchronization state, adds synchronized manipulation-config Script content, and updates Scripts to consume synchronized groups.
Public synchronization API
depthai_nodes/node/frame_cropper.py
Adds syncThreshold to fromImgDetections and fromManipConfigs, documents synchronization behavior, stores the threshold, and validates its use with waitForConfig.
Sync node pipeline wiring
depthai_nodes/node/frame_cropper.py
Configures dai.node.Sync for detection and waiting manipulation-config paths, while retaining direct wiring for non-waiting configurations.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant FrameCropper
  participant Sync
  participant Script
  participant ImageManip
  FrameCropper->>Sync: configure syncThreshold
  FrameCropper->>Sync: link frame with detections or configs
  Sync->>Script: provide synced group
  Script->>ImageManip: forward paired frame and crop configuration
Loading

Suggested reviewers: klemen1999, tersekmatija

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a Sync subnode in front of FrameCropper inputs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/frame-cropper-input-sync

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@depthai_nodes/node/frame_cropper.py`:
- Around line 201-209: The docstring for the FrameCropper configuration method
should explicitly note the timestamp requirement when waitForConfig=True. Update
the text near inputManipConfigs/syncThreshold to say that the MessageGroup must
carry a timestamp aligned with inputImage because dai.node.Sync uses it to pair
config groups with frames; mention that untimestamped groups will not
synchronize. Keep the existing explanation of reuse behavior when
waitForConfig=False, and reference the FrameCropper method and waitForConfig
branch so the change is easy to locate.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 24191cb7-9ea0-4afe-af23-53f85db3faec

📥 Commits

Reviewing files that changed from the base of the PR and between d98ce6d and f179a35.

📒 Files selected for processing (1)
  • depthai_nodes/node/frame_cropper.py

Comment thread depthai_nodes/node/frame_cropper.py Outdated

@PetrNovota PetrNovota left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Looking good. Left a couple of minor comments

Comment thread depthai_nodes/node/frame_cropper.py Outdated
Comment thread depthai_nodes/node/frame_cropper.py Outdated

@PetrNovota PetrNovota left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@codecov-commenter

codecov-commenter commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 8.33333% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.18%. Comparing base (981ecf7) to head (c25838f).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
depthai_nodes/node/frame_cropper.py 8.33% 33 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #303      +/-   ##
==========================================
- Coverage   48.34%   48.18%   -0.17%     
==========================================
  Files          99       99              
  Lines        6410     6438      +28     
==========================================
+ Hits         3099     3102       +3     
- Misses       3311     3336      +25     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@tadeas0
tadeas0 merged commit 60c8202 into main Jul 14, 2026
13 checks passed
@tadeas0
tadeas0 deleted the feat/frame-cropper-input-sync branch July 14, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants