Closed BarakBon closed 3 months ago
Guten Tag, Hans here.
[!NOTE] New features, bugfixes, updates and other improvements are all handled mostly by
@mrousavy
in his free time. To support@mrousavy
, please consider 💖 sponsoring him on GitHub 💖. Sponsored issues will be prioritized.
FATAL EXCEPTION: AsyncTask #1
Have you tried wrapping your function in runOnJs
inside the useFrameProcessor
hook?
https://docs.swmansion.com/react-native-reanimated/docs/2.x/api/miscellaneous/runOnJS/
FATAL EXCEPTION: AsyncTask #1
Have you tried wrapping your function in
runOnJs
inside theuseFrameProcessor
hook? https://docs.swmansion.com/react-native-reanimated/docs/2.x/api/miscellaneous/runOnJS/
thank you for your answer. I didn't. tried to understand the way you suggesting me to use it. and ended up with this:
const handleResize = (frame) => {
const resized = resize(frame, {
scale: {
width: 800,
height: 800,
},
pixelFormat: "rgb",
dataType: "float32",
});
console.log(`Resized to ${resized.width} x ${resized.height} Frame!`);
};
const frameProcessor = useFrameProcessor((frame) => {
"worklet";
runAtTargetFps(2, () => {
console.log(`Received a ${frame.width} x ${frame.height} Frame!`);
runOnJS(handleResize)(frame);
});
}, []);
now i get this error:
Frame Processor Error: Property '_WORKLET' doesn't exist, js engine: VisionCamera
probably using it wrong.
tried some other way as I saw that it is probably supposed to be the right way:
const handleResize = useRunOnJS((frame) => {
console.log(`Received a ${frame.width} x ${frame.height} Frame!`);
const resized = resize(frame, {
scale: {
width: 800,
height: 800,
},
pixelFormat: "rgb",
dataType: "float32",
});
console.log(`Resized to ${resized.width} x ${resized.height} Frame!`);
}, []);
const frameProcessor = useFrameProcessor((frame) => {
"worklet";
runAtTargetFps(2, () => {
"worklet";
handleResize(frame);
});
}, []);
now I get no error but something weird is happening and that's why I edited it in, because maybe it can point at my issue. i get the print of "Received..." every random amount of seconds and don't get the "Resized..." print at all.
sorry to bother but it is important to me.
Try this (last comment) - https://github.com/mrousavy/react-native-vision-camera/issues/1613#issuecomment-2192605759
java.lang.String com.oplus.uxdesign.language.bean.FileHostBean.getManual()
this doesn't really look related to VisionCamera. Does everything run fine if you just remove the resize(..)
call?
Try this (last comment) - #1613 (comment)
thank you for trying to help, I appreciate it.
the createRunInJsFn
is deprecated as I saw, so I used createRunOnJS
instead like this:
const handleResize = (frame) => {
console.log(`Received a ${frame.width} x ${frame.height} Frame!`);
const resized = resize(frame, {
scale: {
width: 800,
height: 800,
},
pixelFormat: "rgb",
dataType: "float32",
});
console.log(`Resized to ${resized.width} x ${resized.height} Frame!`);
};
const resizer = Worklets.createRunOnJS(handleResize);
const frameProcessor = useFrameProcessor((frame) => {
"worklet";
runAtTargetFps(2, () => {
"worklet";
// console.log(`Received a ${frame.width} x ${frame.height} Frame!`);
resizer(frame);
});
}, []);
still the same as the edit in my previous comment. a large gap between "Received.." prints and not any "Resized.." ones
java.lang.String com.oplus.uxdesign.language.bean.FileHostBean.getManual()
this doesn't really look related to VisionCamera. Does everything run fine if you just remove the
resize(..)
call?
thank you for your response.
its not crushing if I comment the resize call.
Can you please create an issue in the resize plugin then? If the plugin crashes, this is not a VisionCamera issue but rather an issue with the plugin you are calling.
What's happening?
i want to use vision camera on my device for future uses with Tflite model. I need to resize the image data for this model, and I tried to use the resize plugin. without the execution of the resizing, the app runs just fine. but when I try resizing the app crushes after 1 second the resizing is attempting to execute. I'm running the application on my device through Expo eas development server
Reproduceable Code
Relevant log output
Camera Device
Device
one plus 7 pro
VisionCamera Version
4.4.1
Can you reproduce this issue in the VisionCamera Example app?
No, I cannot reproduce the issue in the Example app
Additional information