My team is currently integrating OpenCV.js into an app and I am trying to avoid fetching an image twice (once for a Babylon texture and once for OpenCV.js) by re-using the texture pixels from Babylon.
One way to initialize a Mat() object in OpenCV.js is to provide it a buffer of pixel data. However, one also needs to provide the type of the data so OpenCV knows how to interpret it (i.e. it needs to be one of these types: opencv-ts/constants.d.ts at da6e203b7fdf26249ee0c494f93d407b0f393003 · peteruhnak/opencv-ts · GitHub)
I am now trying to user texture.readPixel() to get the pixel data and I was thinking of using textureType and textureFormat in order to figure out the type of data but I always get -1 for both of those.
Can someone confirm that the basic approach described above is valid and if so - why do I get -1 for textureType and textureFormat instead of one of the values defined here Babylon.js/constants.ts at master · BabylonJS/Babylon.js · GitHub?