Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Robotics Algorithm Anyone?
Message
From
03/01/2006 17:58:33
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
To
03/01/2006 16:07:28
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01082862
Message ID:
01082934
Views:
23
>I am developing a mobile robot that uses a top mounted camera to capture information about its surroundings. To simplify the problem, I am using special blue square-faced obstacles which can be scattered around a room (all the same size). The idea is that the robot could calculate its distance from these objects and formulate a "birds eye view" map of its environment, in relation to itself.
>
>However, I am unsure how to arrive at an algorithm for calculating these distances? From the robot's perspective, it has an image of the known size blue blocks to utilise. It knows the size of the blocks and the size of their appearance on its internal image from the camera. Somehow, it would be good to be able to "look" at the size of the images on screen, compared to their known physical size and therefore be able to calculate the robot's distance from the objects and possibly their distance from each other. Make sense?
>
>Finally, any calculation would need to be able to handle a situation when perhaps the objects it sees are not of a known size.
>
>If anyone has any ideas in this connection, your comments would be appreciated. FYI, this is not driven by Fox <s> - this is a C++ API.

You don't need no steenkin API, you need geometry. Specifically, trigonometry. I assume your camera is fix-focus, i.e. the focal length is fixed. If it can zoom, the whole thing is going to be vastly off.

You need the angle. To get that, you can approximate the total angle your camera can see, both horizontally and vertically, so you have two measurements. Assume it can see 88o horizontally, and has a resolution of 1280 pixels. Your blue square is 17 pixels wide on the picture and nHeight inches (or millimeters or whatever) physically. Then your distance can be calculated like this:
nMaxPx=1280
nPx=17
nHeight=1.25
nMaxAngle=88

nAngle=nMaxAngle/180*pi()*nPx/nMaxPx
nDistance=nHeight/atan(nAngle)
Of course, since the size in pixels can be off by one in any direction (the CCD has its rounding error, and your lens isn't perfect), the closer the object, the more precise this will be.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform