I am writing an app that extracts the outline of an actor using openCV. The data can be quite a lot, like 400 points (x,y) per actor on stage. I then send these points to another machine using Osc. Because of size limitations I have to have one Osc package per actor and limit each actor (by resampling) to 100 points.
I have two questions:
- If instead of sending the file via Osc I send it using the ofxHttpServer addon do I overcome this package size limit, or at least increase it significantly?
- My application is real time and I need it to be as fast as possible. Is there a speed related reason why I should not use the http protocol to transfer data between two machines and instead use the Osc?
unless I am horribly wrong somehow http is running on TCP packets which have more logic involved in get the packet across correctly. So there is error detection and correction and of course re-sending of packages. Additionally, messages received on client are not handed over to the application unless all the packets have arrived and been sorted.
On the other hand osc is based on udp which oversimplifing translates too “just send the damn packet over”.
judging from the above i think osc is the way forward as far as real-time response is concerned.
I’m not sure you need to down-sample when using OSC. You could just send each person as four messages and rebuild at the other end:
Also, is the size limitation from OSC or ofNetwork UDP? If it’s OSC, you could just send strings over UDP. Check out the UDP example.
Hi @jmarsico , how can you know in advance that 4 messages suffice to send the data you need ? you still have an upper limit to the # of points that you can send in an OSC msg albeit it’ll be 4x as big. no?
Wouldn’t it make more sense to use HTTP since it uses TCP and there is no limit in the size of the packet? do you think the handshaking of the TCP is a huge overhead that would slow things down?
Would it solve the problem if one used http-persistent-connection (aka keep-alive)? (related wiki article) Do you know if @arturo’s ofxHttpServer addon supports this feature?
@synthnassizer you are correct. i was thinking that each person blob would have the same number of points; in which case you could just alway send (totalnumPoints / maxPointsallowedbyOSC) number of messages, and just recompile the messages into one blob on the other end.
All this being said, i think you’d want to use the built in udp tools. check out networkUdpSenderExample it essentially shows exactly what oyu want to do, but with human-drawn strokes instead of cv blob points.