Skip to content

Commit b0457c8

Browse files
feat: initial version
1 parent 4279ad4 commit b0457c8

6 files changed

Lines changed: 9 additions & 15 deletions

File tree

apps/computer-vision/app/vision_camera/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export default function VisionCameraScreen() {
181181
outputs={frameOutput ? [frameOutput] : []}
182182
isActive={isFocused}
183183
format={format}
184-
orientationSource="interface"
184+
orientationSource="device"
185185
/>
186186

187187
{/* Layout sentinel — measures the full-screen area for bbox/canvas sizing */}

apps/computer-vision/components/vision_camera/tasks/ObjectDetectionTask.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ export default function ObjectDetectionTask({
7979
}
8080
try {
8181
if (!detRof) return;
82-
const iw = frame.width > frame.height ? frame.height : frame.width;
83-
const ih = frame.width > frame.height ? frame.width : frame.height;
82+
const iw = frame.width;
83+
const ih = frame.height;
8484
const result = detRof(frame, 0.5);
8585
if (result) {
8686
scheduleOnRN(updateDetections, {

apps/computer-vision/components/vision_camera/tasks/SegmentationTask.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export default function SegmentationTask({
138138

139139
const frameOutput = useFrameOutput({
140140
pixelFormat: 'rgb',
141+
enablePhysicalBufferRotation: true,
141142
dropFramesWhileBusy: true,
142143
onFrame: useCallback(
143144
(frame: Frame) => {

apps/computer-vision/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"react-native-screens": "~4.16.0",
3939
"react-native-svg": "15.15.3",
4040
"react-native-svg-transformer": "^1.5.3",
41-
"react-native-vision-camera": "5.0.0-beta.6",
41+
"react-native-vision-camera": "5.0.0-beta.7",
4242
"react-native-worklets": "0.7.4"
4343
},
4444
"devDependencies": {

packages/react-native-executorch/common/rnexecutorch/utils/FrameProcessor.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,7 @@ cv::Mat extractFrame(jsi::Runtime &runtime, const jsi::Object &frameData) {
2828

2929
cv::Mat frameToMat(jsi::Runtime &runtime, const jsi::Value &frameData) {
3030
auto frameObj = frameData.asObject(runtime);
31-
cv::Mat frame = extractFrame(runtime, frameObj);
32-
33-
// Camera sensors deliver landscape frames; rotate to portrait orientation.
34-
if (frame.cols > frame.rows) {
35-
cv::Mat upright;
36-
cv::rotate(frame, upright, cv::ROTATE_90_CLOCKWISE);
37-
return upright;
38-
}
39-
return frame;
31+
return extractFrame(runtime, frameObj);
4032
}
4133

4234
cv::Mat pixelsToMat(const JSTensorViewIn &pixelData) {

packages/react-native-executorch/common/rnexecutorch/utils/FrameProcessor.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ using namespace facebook;
1919
cv::Mat extractFrame(jsi::Runtime &runtime, const jsi::Object &frameData);
2020

2121
/**
22-
* @brief Convert a VisionCamera frame to a rotated RGB cv::Mat.
22+
* @brief Convert a VisionCamera frame to an RGB cv::Mat.
2323
*
24-
* Handles frame extraction and landscape→portrait rotation.
24+
* Expects the frame buffer to already be correctly oriented — use
25+
* enablePhysicalBufferRotation on the FrameOutput to ensure this.
2526
* Callers are responsible for any further colour space conversion.
2627
*/
2728
cv::Mat frameToMat(jsi::Runtime &runtime, const jsi::Value &frameData);

0 commit comments

Comments
 (0)