File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
apps/computer-vision/app/vision_camera
packages/react-native-executorch/common/rnexecutorch/models Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -377,6 +377,7 @@ export default function VisionCameraScreen() {
377377 outputs = { [ frameOutput ] }
378378 isActive = { true }
379379 format = { format }
380+ orientationSource = "interface"
380381 />
381382
382383 < View
Original file line number Diff line number Diff line change @@ -11,7 +11,16 @@ using namespace facebook;
1111cv::Mat VisionModel::extractFromFrame (jsi::Runtime &runtime,
1212 const jsi::Value &frameData) const {
1313 auto frameObj = frameData.asObject (runtime);
14- return ::rnexecutorch::utils::extractFrame (runtime, frameObj);
14+ cv::Mat frame = ::rnexecutorch::utils::extractFrame (runtime, frameObj);
15+
16+ // Camera sensors natively deliver frames in landscape orientation.
17+ // Rotate 90° CW so all models receive upright portrait frames.
18+ if (frame.cols > frame.rows ) {
19+ cv::Mat upright;
20+ cv::rotate (frame, upright, cv::ROTATE_90_CLOCKWISE);
21+ return upright;
22+ }
23+ return frame;
1524}
1625
1726cv::Mat VisionModel::extractFromPixels (const JSTensorViewIn &tensorView) const {
You can’t perform that action at this time.
0 commit comments