I'm working on integrating MediaPipe Hands into a web-based AR application, and I'm running into some challenges getting my camera image data into a format that the send() function accepts. I haven't found any public-facing API documentation for the JavaScript solution of MediaPipe Hands, but if there is some somewhere please let me know!
The AR framework I'm working with takes control of the camera, so I can't directly connect MediaPipe Hands to the camera as shown in the CodePen example.
The AR framework does expose the camera stream data in a couple of formats, but neither of them are accepted by the send() function. It provides a UInt8Array of pixel data (along with the number of rows, columns, and bytes per row), and a srcTex that it describes as "a texture containing the source image for the returned pixels". When I feed either of them to MediaPipe Hands using send({image: myImageData}), I get this error in my console:
Unhandled promise rejection: TypeError: Failed to execute 'texImage2D' on 'WebGL2RenderingContext': Overload resolution failed.
So it seems like there is a texImage2D call somewhere in MediaPipe Hands, and I need to get my image data into a format that it accepts. Trouble is, there are several overloads and configuration settings for this method, and I'm not sure which is used.
I'm thinking of converting the UInt8Array of pixel data into a format that send() accepts, but what should that be?