AgentStack
SKILL verified MIT Self-run

Dyn Object Masks

skill-xuansenpa1-skillrevise-dyn-object-masks · by xuansenpa1

Generate dynamic-object binary masks after global motion compensation, output CSR sparse format.

No reviews yet
0 installs
13 views
0.0% view→install

Install

$ agentstack add skill-xuansenpa1-skillrevise-dyn-object-masks

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Dyn Object Masks? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

When to use

  • Detect moving objects in scenes with camera motion; produce sparse masks aligned to sampled frames.

Workflow

1) Global alignment: warp previous gray frame to current using estimated affine/homography. 2) Valid region: also warp an all-ones mask to get valid pixels, avoiding border fill. 3) Difference + adaptive threshold: diff = abs(curr - warp_prev); on diff[valid] compute median + 3×MAD; use a reasonable minimum threshold to avoid triggering on noise. 4) Morphology + area filter: open then close; keep connected components above a minimum area (tune as fraction of image area or a fixed pixel threshold). 5) CSR encoding: for final bool mask

  • rows, cols = nonzero(mask)
  • indices = cols.astype(int32); data = ones(nnz, uint8)
  • counts = bincount(rows, minlength=H); indptr = cumsum(counts, prepend=0)
  • store as f_{i}_data/indices/indptr

Code sketch

warped_prev = cv2.warpAffine(prev_gray, M, (W,H), flags=cv2.INTER_LINEAR, borderValue=0)
valid = cv2.warpAffine(np.ones((H,W),uint8), M, (W,H), flags=cv2.INTER_NEAREST)>0
diff = cv2.absdiff(curr_gray, warped_prev)
vals = diff[valid]
thr = max(20, np.median(vals) + 3*1.4826*np.median(np.abs(vals - np.median(vals))))
raw = (diff>thr) & valid
m = cv2.morphologyEx(raw.astype(uint8)*255, cv2.MORPH_OPEN, k3)
m = cv2.morphologyEx(m, cv2.MORPH_CLOSE, k7)
n, cc, stats, _ = cv2.connectedComponentsWithStats(m>0, connectivity=8)
mask = np.zeros_like(raw, dtype=bool)
for cid in range(1,n):
    if stats[cid, cv2.CC_STAT_AREA] >= min_area:
        mask |= (cc==cid)

Self-check

  • [ ] Masks only for sampled frames; keys match sampled indices.
  • [ ] shape stored as [H, W] int32; len(indptr)==H+1; indptr[-1]==indices.size.
  • [ ] Border fill not treated as foreground; threshold stats computed on valid region only.
  • [ ] Threshold + morphology + area filter applied.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.