Skip to content

feat: add integration with vision camera v5#810

Open
NorbertKlockiewicz wants to merge 25 commits intomainfrom
@nk/vision-camera
Open

feat: add integration with vision camera v5#810
NorbertKlockiewicz wants to merge 25 commits intomainfrom
@nk/vision-camera

Conversation

@NorbertKlockiewicz
Copy link
Contributor

@NorbertKlockiewicz NorbertKlockiewicz commented Feb 16, 2026

Description

This PR adds real-time camera frame processing capabilities to React Native ExecuTorch by integrating with VisionCamera v5. It introduces a new VisionModule base class and extends ObjectDetectionModule to support three input methods: image URLs/paths, raw pixel data (PixelData), and live camera frames.

This PR includes:

  • a dedicated screen for testing object detection + vision camera
  • new tests for added methods

Introduces a breaking change?

  • Yes
  • No

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Other (chores, tests, code style improvements etc.)

Tested on

  • iOS
  • Android

Testing instructions

Run the computer vision example app and test object detection and object detection (live)

Screenshots

Related issues

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

@NorbertKlockiewicz NorbertKlockiewicz changed the title @nk/vision camera feat: add integration with vision camera v5 Feb 18, 2026
@NorbertKlockiewicz NorbertKlockiewicz force-pushed the @nk/vision-camera branch 2 times, most recently from 96f2c14 to f3e17e2 Compare February 19, 2026 21:03
msluszniak

This comment was marked as resolved.

msluszniak

This comment was marked as resolved.

@NorbertKlockiewicz NorbertKlockiewicz changed the title feat: add integration with vision camera v5 feat!: add integration with vision camera v5 Feb 23, 2026
@NorbertKlockiewicz NorbertKlockiewicz changed the title feat!: add integration with vision camera v5 feat: add integration with vision camera v5 Feb 23, 2026
@NorbertKlockiewicz NorbertKlockiewicz marked this pull request as ready for review February 23, 2026 18:41
@NorbertKlockiewicz NorbertKlockiewicz self-assigned this Feb 23, 2026
msluszniak

This comment was marked as resolved.

@msluszniak msluszniak added the feature PRs that implement a new feature label Feb 24, 2026
msluszniak

This comment was marked as resolved.

@NorbertKlockiewicz NorbertKlockiewicz force-pushed the @nk/vision-camera branch 3 times, most recently from c1ff490 to 983242e Compare February 25, 2026 13:09
Copy link
Member

@msluszniak msluszniak left a comment

Choose a reason for hiding this comment

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

LGTM, but I would wait for a review from someone that knows TS more than me ;)

Comment on lines +61 to +64
/**
* Thrown when a feature or platform is not supported in the current environment.
*/
PlatformNotSupported = 119,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make sure to add this to error handling docs

model,
preventLoad: preventLoad,
});
}) as ObjectDetectionType;
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need the type assertion here?

const [isGenerating, setIsGenerating] = useState(false);
const [downloadProgress, setDownloadProgress] = useState(0);
const [moduleInstance] = useState(() => new module());
const [runOnFrame, setRunOnFrame] = useState<any>(null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this have to be any?

Comment on lines 51 to 57
// Use "state trick" to make the worklet serializable for VisionCamera
if ('runOnFrame' in moduleInstance) {
const worklet = moduleInstance.runOnFrame;
if (worklet) {
setRunOnFrame(() => worklet);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it would be explaining what the state trick is and why we need it

Comment on lines 172 to 178
export interface PixelData extends Omit<TensorPtr, 'dataPtr' | 'scalarType'> {
/**
* RGB pixel data as Uint8Array.
* Expected format: RGB (3 channels), not RGBA or BGRA.
* Size must equal: width * height * 3
*/
dataPtr: Uint8Array;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be Pick instead

@msluszniak
Copy link
Member

msluszniak commented Feb 26, 2026

I think you need to rebase because your changes to auto-generated api is as for the older code (before my commit with packages bump).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature PRs that implement a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vision Camera integration - initial API (Object Detection)

3 participants