4 Replies Latest reply on Nov 21, 2017 9:39 AM by genebren

# Computer Vision, OpenCV + Maths

I love learning things, and maths - as much as i hated it at school (Why do i need this?) In my older years, I'm starting to see why.

The previous version of my robot had camera and laser mounted on the same appendage so the maths was pretty much simple simple.  separating the two has been somewhat of a challenge and a rewarding one, the code is still quite raw and im sure i can make it more responsive but the initial results are amazing.

So here we are using the focal length of the camera to determine the distance to the object based on its given size (18cm)  and then using the triangle similarity method to determine how far off center the target is to compute the cartesian coordinates of the object concerned. The offset is then recalculated on the appendage that is 11 cm off center and the polar coords are delivered.

• ###### Re: Computer Vision, OpenCV + Maths

Nice demo.

Yes, math is the language of science and engineering.

Sometimes, math is the only clean way to express an idea so that it can be rendered in a physical form or software.

I was good at math, though I can honestly say that it took many years before I was able to fully understand and use some of the more exotic parts of it.

DAB

1 of 1 people found this helpful

• ###### Re: Computer Vision, OpenCV + Maths

Thanks guys!

Main robot control is managed through an Arduino Mega, the Pi then sends it commands to operate various features

CMD:value;

so

MTR:150;    #Motors "right" for 150ms

using multithreading in python i can have a thread for each serial connection (2x arduino + gsm modem)  and control it all from the one interface running in the pi.

Hope this helps!

Cheers,

Matt

• ###### Re: Computer Vision, OpenCV + Maths

Matt,

That is pretty cool.  I really like the camera output with the object recognition (green circle) overlay view.  The response time and tracking seems very quick. Good luck on your future developments on this project.