Add a patch to get correct orientation for Android for frame processor

This commit is contained in:
Johannes Klein
2023-10-16 22:17:53 +02:00
parent 9c562f4838
commit defe991dd1
2 changed files with 8 additions and 4 deletions

4
package-lock.json generated
View File

@@ -27239,7 +27239,7 @@
},
"node_modules/vision-camera-plugin-inatvision": {
"version": "0.1.0",
"resolved": "git+ssh://git@github.com/inaturalist/vision-camera-plugin-inatvision.git#40d4e8de35272c92d5d17a8de696fa0f40addca2",
"resolved": "git+ssh://git@github.com/inaturalist/vision-camera-plugin-inatvision.git#f8a965966b89b9f851546ec19bdc30c70baf49e3",
"license": "MIT",
"engines": {
"node": ">= 16.0.0"
@@ -47404,7 +47404,7 @@
}
},
"vision-camera-plugin-inatvision": {
"version": "git+ssh://git@github.com/inaturalist/vision-camera-plugin-inatvision.git#40d4e8de35272c92d5d17a8de696fa0f40addca2",
"version": "git+ssh://git@github.com/inaturalist/vision-camera-plugin-inatvision.git#f8a965966b89b9f851546ec19bdc30c70baf49e3",
"from": "vision-camera-plugin-inatvision@github:inaturalist/vision-camera-plugin-inatvision#vision-v3",
"requires": {}
},

View File

@@ -12,6 +12,7 @@ import {
} from "react-native-vision-camera";
import { Worklets } from "react-native-worklets-core";
import { modelPath, taxonomyPath } from "sharedHelpers/cvModel";
import { useDeviceOrientation } from "sharedHooks";
import * as InatVision from "vision-camera-plugin-inatvision";
type Props = {
@@ -49,6 +50,8 @@ const FrameProcessorCamera = ( {
onZoomChange,
takingPhoto
}: Props ): Node => {
const { deviceOrientation } = useDeviceOrientation();
useEffect( () => {
// This registers a listener for the frame processor plugin's log events
// iOS part exposes no logging, so calling it would crash
@@ -89,7 +92,8 @@ const FrameProcessorCamera = ( {
version,
modelPath,
taxonomyPath,
confidenceThreshold
confidenceThreshold,
patchedOrientationAndroid: deviceOrientation
} );
handleResults( results );
} catch ( classifierError ) {
@@ -98,7 +102,7 @@ const FrameProcessorCamera = ( {
}
} );
},
[version, confidenceThreshold, takingPhoto]
[version, confidenceThreshold, takingPhoto, deviceOrientation]
);
return (