hiukim / mind-ar-js

Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js
MIT License
2.12k stars 391 forks source link

how can i change camera resolution for image tracking #482

Open ehsanwwe opened 5 months ago

ehsanwwe commented 5 months ago

Hi i works on your project more than one year but i cant find a way to change threshold of detection or a way to change resolution of video who feed into the detector class

can you help me |?

hiukim commented 5 months ago

We are just calling the default getUserMedia. If you want, you can modify this line and recompile the library.

https://github.com/hiukim/mind-ar-js/blob/fb5db87b1e5076ba86fde82101955da70b629a1c/src/image-target/three.js#L109

ehsanwwe commented 5 months ago

thank you ( i was amazed for your fast and directly true answer ) according tho this reference https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia i changed this const constraints = { audio: false, video: {} }; to getUserMedia({ audio: true, video: { width: 1280, height: 720 }, }); Thanx for writing this awesome project

also i find an advance mode ( i can't find any documentation for this mode )

const constraints = { audio: false, video: { advanced: [ { width: { exact: 2560 } }, { width: { exact: 1920 } }, { width: { exact: 1280 } }, { width: { exact: 1024 } }, { width: { exact: 900 } }, { width: { exact: 800 } }, { width: { exact: 640 } }, { width: { exact: 320 } } ] } };

i got better result with belo config ( without any shake and FPS grows to 39 ) const constraints = { audio: false, video: { advanced: [ { width: { exact: 640 } }, { width: { exact: 320 } } ] } };