tracking.js icon indicating copy to clipboard operation
tracking.js copied to clipboard

face detection using IP camera

Open vijaysagi1 opened this issue 6 years ago • 7 comments

Hi all,

Please suggest how can i access IP camera and undergo face detection

Thanks vijay

vijaysagi1 avatar Mar 23 '18 05:03 vijaysagi1

i think i need to configure rtsp://xx.xx.xx.xx:554/Streaming/Channels/1 to read the video feed. Currently am stuck how to do face detection on RTSP

vijaysagi1 avatar Mar 23 '18 13:03 vijaysagi1

I don't believe html5 video tags can accept RTSP. You might consider using video.js with the HLS add-on to make it work. Once you have your RTSP feed rendering correctly inside the video tag, tracking.js should work normally.

alexandermaisey avatar Mar 26 '18 16:03 alexandermaisey

Thanks Alex,

Pls suggest using tracking.js can i read http stream remotely from IP camera ?

vijaysagi1 avatar Mar 27 '18 07:03 vijaysagi1

Not directly. You will need to figure out how to make the video output of the IP camera stream compatible with an HTML5 video tag, i.e. HLS or MPEG-DASH. I do not know how to accomplish that, but video.js with the HLS add-on (links in my prior response) may be your answer. Once that is setup, you can use tracking.js as it is documented.

alexandermaisey avatar Mar 27 '18 15:03 alexandermaisey

Connecting IP camera to trackingJS

I have connected IP camera to tracking.js by using jsmpeg (https://github.com/phoboslab/jsmpeg). I am using ubuntu Linux. My face tracking is not working but at least you can see how to use IP camera.

Use ffmpeg to stream IP camera to jsmpeg: ffmpeg -i rtsp://192.168.8.105:554/onvif1 -b:v 50k -r 30 http://127.0.0.1:8096/jsmpeg_secret/1280/720

In my test html page: consume the incoming video // rough copy, from my code capture

< canvas id="videoFeed1" width="640" height="480" >< / canvas >

window.onload = function() {  var client1 = new WebSocket( 'ws://192.168.8.101:8097/' );  var feed1 = document.getElementById('videoFeed1');  var player1 = new jsmpeg(client1, {canvas:feed1}); var tracker = new tracking.ObjectTracker('face');

tracker.setInitialScale(4); tracker.setStepSize(2); tracker.setEdgesDensity(0.1); tracking.track(player1.canvas, tracker);

... rest of the tracking code etc };

wilwad avatar Jun 25 '18 17:06 wilwad

To get your face tracking working, you probably don't want everything in window.onload, particularly the tracking.track(...). Try moving that into a callback from the video element (something like, feed1.onloadedmetadata = (e) => { feed1.play(); tracking.track(...); }; )

alexandermaisey avatar Jun 25 '18 17:06 alexandermaisey

Very true. Will try that thank you very much.

wilwad avatar Jun 25 '18 18:06 wilwad