Skip to content

Commit 3b61d98

Browse files
refactor: rename isMirrored to isFrontCamera
1 parent 303828e commit 3b61d98

File tree

13 files changed

+21
-21
lines changed

13 files changed

+21
-21
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export default function VisionCameraScreen() {
209209
outputs={frameOutput ? [frameOutput] : []}
210210
isActive={isFocused}
211211
format={format}
212-
orientationSource="interface"
212+
orientationSource="device"
213213
/>
214214

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ export default function OCRTask({
6262
}
6363
try {
6464
if (!ocrRof) return;
65-
const isMirrored = cameraPositionSync.getDirty() === 'front';
66-
const result = ocrRof(frame, isMirrored);
65+
const isFrontCamera = cameraPositionSync.getDirty() === 'front';
66+
const result = ocrRof(frame, isFrontCamera);
6767
if (result) {
6868
scheduleOnRN(updateDetections, {
6969
results: result,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ export default function ObjectDetectionTask({
8181
}
8282
try {
8383
if (!detRof) return;
84-
const isMirrored = cameraPositionSync.getDirty() === 'front';
85-
const result = detRof(frame, isMirrored, 0.5);
84+
const isFrontCamera = cameraPositionSync.getDirty() === 'front';
85+
const result = detRof(frame, isFrontCamera, 0.5);
8686
const screenW = frame.height;
8787
const screenH = frame.width;
8888
if (result) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ export default function SegmentationTask({
149149
}
150150
try {
151151
if (!segRof) return;
152-
const isMirrored = cameraPositionSync.getDirty() === 'front';
153-
const result = segRof(frame, isMirrored, [], false);
152+
const isFrontCamera = cameraPositionSync.getDirty() === 'front';
153+
const result = segRof(frame, isFrontCamera, [], false);
154154
if (result?.ARGMAX) {
155155
const argmax: Int32Array = result.ARGMAX;
156156
const screenW = frame.height;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ export default function StyleTransferTask({
103103
}
104104
try {
105105
if (!styleRof) return;
106-
const isMirrored = cameraPositionSync.getDirty() === 'front';
107-
const result = styleRof(frame, isMirrored);
106+
const isFrontCamera = cameraPositionSync.getDirty() === 'front';
107+
const result = styleRof(frame, isFrontCamera);
108108
if (result) {
109109
const pixels = new Uint8Array(result.dataPtr.buffer);
110110
const skData = Skia.Data.fromBytes(pixels);

packages/react-native-executorch/src/controllers/BaseOCRController.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export abstract class BaseOCRController {
8989
};
9090

9191
get runOnFrame():
92-
| ((frame: Frame, isMirrored: boolean) => OCRDetection[])
92+
| ((frame: Frame, isFrontCamera: boolean) => OCRDetection[])
9393
| null {
9494
if (!this.isReady) {
9595
throw new RnExecutorchError(
@@ -100,7 +100,7 @@ export abstract class BaseOCRController {
100100

101101
const nativeGenerateFromFrame = this.nativeModule.generateFromFrame;
102102

103-
return (frame: any, isMirrored: boolean): OCRDetection[] => {
103+
return (frame: any, isFrontCamera: boolean): OCRDetection[] => {
104104
'worklet';
105105

106106
let nativeBuffer: any = null;
@@ -109,7 +109,7 @@ export abstract class BaseOCRController {
109109
const frameData = {
110110
nativeBuffer: nativeBuffer.pointer,
111111
orientation: frame.orientation,
112-
isMirrored,
112+
isMirrored: isFrontCamera,
113113
};
114114
return nativeGenerateFromFrame(frameData);
115115
} finally {

packages/react-native-executorch/src/hooks/computer_vision/useOCR.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const useOCR = ({ model, preventLoad = false }: OCRProps): OCRType => {
1717
const [downloadProgress, setDownloadProgress] = useState(0);
1818
const [error, setError] = useState<RnExecutorchError | null>(null);
1919
const [runOnFrame, setRunOnFrame] = useState<
20-
((frame: Frame, isMirrored: boolean) => OCRDetection[]) | null
20+
((frame: Frame, isFrontCamera: boolean) => OCRDetection[]) | null
2121
>(null);
2222

2323
const [controller] = useState(

packages/react-native-executorch/src/hooks/computer_vision/useVerticalOCR.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const useVerticalOCR = ({
2222
const [error, setError] = useState<RnExecutorchError | null>(null);
2323

2424
const [runOnFrame, setRunOnFrame] = useState<
25-
((frame: Frame, isMirrored: boolean) => OCRDetection[]) | null
25+
((frame: Frame, isFrontCamera: boolean) => OCRDetection[]) | null
2626
>(null);
2727

2828
const [controller] = useState(

packages/react-native-executorch/src/modules/computer_vision/VisionModule.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export abstract class VisionModule<TOutput> extends BaseModule {
5252
* onFrame(frame) {
5353
* 'worklet';
5454
* if (!runOnFrame) return;
55-
* const result = runOnFrame(frame, isMirrored);
55+
* const result = runOnFrame(frame, isFrontCamera);
5656
* frame.dispose();
5757
* }
5858
* });
@@ -70,7 +70,7 @@ export abstract class VisionModule<TOutput> extends BaseModule {
7070
const nativeGenerateFromFrame = this.nativeModule.generateFromFrame;
7171

7272
// Return worklet that captures ONLY the JSI function
73-
return (frame: any, isMirrored: boolean, ...args: any[]): TOutput => {
73+
return (frame: any, isFrontCamera: boolean, ...args: any[]): TOutput => {
7474
'worklet';
7575

7676
let nativeBuffer: any = null;
@@ -79,7 +79,7 @@ export abstract class VisionModule<TOutput> extends BaseModule {
7979
const frameData = {
8080
nativeBuffer: nativeBuffer.pointer,
8181
orientation: frame.orientation,
82-
isMirrored,
82+
isMirrored: isFrontCamera,
8383
};
8484
return nativeGenerateFromFrame(frameData, ...args);
8585
} finally {

packages/react-native-executorch/src/types/objectDetection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export interface ObjectDetectionType<L extends LabelEnum> {
145145
runOnFrame:
146146
| ((
147147
frame: Frame,
148-
isMirrored: boolean,
148+
isFrontCamera: boolean,
149149
detectionThreshold: number
150150
) => Detection<L>[])
151151
| null;

0 commit comments

Comments
 (0)