Skip to content

example with-tfjs-camera example is outdated and not working with latest Expo SDK #597

@DarshanBuddhacharya

Description

@DarshanBuddhacharya

Hello there, I was trying to test out the example, with tensorflow for Pose detection.

The with-tfjs-camera example from the Expo examples repo is currently not working with the latest versions of Expo SDK and TensorFlow.js. Here are the details:

Problem
The example uses deprecated or incompatible code.

first issue I found was

TypeError: _expoCamera.Camera.useCameraPermissions is not a function (it is undefined)

for which I changed const [permission, requestPermission] = Camera.useCameraPermissions() to const [permission, requestPermission] = Camera.requestCameraPermissionsAsync()

another Issue was

TypeError: Cannot read property 'Type' of undefined

fixed it by changing <CustomTensorCamera width={size.width} style={styles.camera} type={Camera.Constants.Type.back} onReady={onReady} autorender /> to
<CustomTensorCamera width={size.width} style={styles.camera} type={"back"} onReady={onReady} autorender />

Main problem is that the screen is black and unresponsive.

specially in apk or expo-go. In emulator the camera shows up but is unresponsive.

note: I changed const TensorCamera = cameraWithTensors(Camera); to const TensorCamera = cameraWithTensors(CameraView); according to latest docs.

Steps to Reproduce
Clone the repo and navigate to with-tfjs-camera.

Run npm install or yarn install.

Device: Physical (Android/iOS)

Is it possible to get latest working example? Any help will be appreciated. Thanks in advance :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions