How to capture a photo with a Tensorflow Camera in React native? - tfjs
TensorFlow.js version
"@tensorflow/tfjs": "^1.5.2",
"@tensorflow/tfjs-react-native": "^0.2.3",
Browser version
"expo": "^37.0.0",
Platform: Android 10
Device: One Plus 8
Describe the problem or feature request
I have a Tensorflow Camera component where I'm running a model every n frames using the
onReady = {this.handleCameraStream}
type workflow shown in the tensorflow Camera documentation.
I'd like to save a frame of the camera stream as a JPEG depending on the result of the model. Does anybody know the easiest way to do this?
I've tried using Expo-Camera's takePictureAsync function but found that it stops working when you wrap the camera with the cameraWithTensors
Any help would be appreciated!
4 Answer:
Hi, yes this is an unfortunate limitation, as far as we know, once we grab the camera stream texture from expo it seems to interfere with other expo-camera methods. One approach would be to directly encode the tensor values into a jpeg in JS. To do image decoding we use jpeg-js which does have an encode method as well.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 dyas if no further activity occurs. Thank you.
Closing as stale. Please @mention us if this needs more attention.
@tafsiri Hi, thanks for addressing this issue, as I was running into as well. I was working to access the live frames as jpg for OCR purposes, but after decode the tensor into a jpg, found the image quality to be dramatically reduced. My partner had created a stack overflow question detailing this: https://stackoverflow.com/questions/66357352/tensor-to-jpeg-improve-quality
Read next
- React is not defined when install one exported component on bit.dev - bit
- SPU fail over result in over-duplicate of records - Rust fluvio
- pass options to enable container without having to go through cli prompt - takeout
- Magic Keyboard 2 brightness keys (F1/F2) no longer control external monitors, only MacBook pro display - Swift MonitorControl
- Signal-Android Verifier rejected class org.thoughtcrime.securesms.conversation.ConversationFragment$ConversationSnapToTopDataObserver - Java
- (node:11476) UnhandledPromiseRejectionWarning: TimeoutError: Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r609904 - TypeScript puppeteer
- Changelog and releases - C fwupd
- Element hangs on launch on Fedora 33 - TypeScript element-web