admin管理员组文章数量:1122832
I had a web Project that used Emscripten to build c++
Code and use "Moduleall
.." to call my c++ function, the main feature is to render by using OpenGL ES, now I want to add MediaPipe's Gesture recognition to my Project using JavaScript, but I have to called "GestureRecognizer.createFromOptions.." 2~3 times, the process will go ahead is the first problem, and the second is after process can go ahead, but when I call "Moduleall
..", it will show message
"Uncaught TypeError: Cannot read properties of undefined (reading 'ccall')", some one can help? Thanks!, the code is bellow:
import { FilesetResolver, GestureRecognizer } from "/@mediapipe/[email protected]";
async function startGestureDetection() {
const videoElement = document.getElementById('webcam');
const canvasElement = document.getElementById('webcam_preview');
const canvasCtx = canvasElement.getContext('2d');
videoStream = await navigator.mediaDevices.getUserMedia({ video: true });
videoElement.srcObject = videoStream;
try {
console.log("[ges] FilesetResolver: ", FilesetResolver);
const vision = await FilesetResolver.forVisionTasks(
"/@mediapipe/[email protected]/wasm"
);
console.log("[ges] vision: ", vision);
console.log("[ges] GestureRecognizer: ", GestureRecognizer);
gestureRecognizer = await GestureRecognizer.createFromOptions(vision, {
baseOptions: {
,
modelAssetPath: "./models/gesture_recognizer.task",
delegate: "GPU"
},
runningMode: "VIDEO"
});
} catch (error) {
console.error("Error initializing hand detection:", error);
}
console.log("[ges][startGestureDetection] gestureRecognizer: ", gestureRecognizer);
videoElement.addEventListener('loadeddata', async () => {
while (isGestureDetectionActive) {
const results = await gestureRecognizer.recognizeForVideo(videoElement, performance.now());
canvasCtx.clearRect(0, 0, canvasElement.width, canvasElement.height);
canvasCtx.drawImage(videoElement, 0, 0, canvasElement.width, canvasElement.height);
if (results.gestures.length > 0) {
const categoryName = results.gestures[0][0].categoryName;
const categoryScore = parseFloat(results.gestures[0][0].score * 100).toFixed(2);
canvasCtx.fillStyle = 'red';
canvasCtx.font = '20px Arial';
canvasCtx.fillText(`${categoryName} (${categoryScore})`, 10, 30);
}
await new Promise(requestAnimationFrame);
}
});
}
I want Moduleall.. to work
本文标签: opengl esUncaught TypeError Cannot read properties of undefined (reading 39ccall39)Stack Overflow
版权声明:本文标题:opengl es - Uncaught TypeError: Cannot read properties of undefined (reading 'ccall') - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736282809a1926762.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论