labatrockwell / openTSPS

TSPS is a cross platform Toolkit for Sensing People in Spaces. It performs openCV operations on live video (Kinect, web camera, etc) and sends it to clients as JSON (via WebSockets), OSC, TUIO, or TCP.
http://www.openTSPS.com
194 stars 51 forks source link

Error with debug URL for socket server (1.3.7) #86

Closed cylinderStudio closed 6 years ago

cylinderStudio commented 9 years ago

When I open the debug URL/localhost:port, I'm getting this error in the browser:

Connected browser: ... Not initialized

main.js:49 "Cannot read property 'x' of undefined"

robotconscience commented 9 years ago

Just tested, totally just a tiny bug in the code.

If you send the contours from TSPS, you won't see the error. The fix is to replace the block that starts at line 49 with this:

if ( person.contours.length > 0 ){
                ctx.beginPath();
                ctx.moveTo(person.contours[0].x*vid_width,person.contours[0].y*vid_height);

                for (var j=1; j<person.contours.length; j++ ){
                    ctx.lineTo( person.contours[j].x*vid_width,person.contours[j].y*vid_height );
                }               
                ctx.stroke();
            }
robotconscience commented 9 years ago

Sorry, this is all in bin/data/web/js/main.js!

cylinderStudio commented 9 years ago

Thanks! That definitely helped, but in Tracking, if I set maximum blob size to anything over 10% of view, the socket server quits with:

WebSocket connection to 'ws://localhost:7681/' failed: Invalid frame header

robotconscience commented 9 years ago

Ah! Try turning contours off for now and using that fixed javascript if you can.

I know what the error is, need to update the Websockets library and recompile. There was a bug in that addon that's now fixed. Will post here when it's updated!

cylinderStudio commented 9 years ago

Works for me. Thanks again.

robotconscience commented 8 years ago

Fixed in feature-kinect2 branch (soon to become master branch)