Author Topic: Distance Ranging Webcam- Using Sharpness?  (Read 3391 times)

0 Members and 1 Guest are viewing this topic.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Distance Ranging Webcam- Using Sharpness?
« on: August 02, 2007, 03:20:19 PM »
I downloaded RoboRealm (http://www.roborealm.com/) and found that whenever I move my camera close to an object or a wall the sharpness variable decreases. What happens is that the sharpness value will be like at around 1100 and then it will drop proportionally to the distance away until it reaches 300. Then it goes back up to 400. For those who do not know where the sharpness variable is, it is at the bottom in the folder named "Other"

My question is can this be  used for collision avoidance. I haven't done many tests but what I plan on doing is that once the sharpness drops below 300 my VB program gets a command that there is an object in front of it.

I am not very experienced with cameras so can anybody please explain what exactly sharpness is. How can you measure it? What is the difference between a sharpness of 1000 and 300. What does the 1000 represent and what does the 700 difference mean?
Thank You
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline h3ro

  • Full Member
  • ***
  • Posts: 110
  • Helpful? 0
Re: Distance Ranging Webcam- Using Sharpness?
« Reply #1 on: August 02, 2007, 04:54:03 PM »
It might work, try googleing "Hyperfocal distance". Not sure if that is exactly what you are looking for, but it might give some hints?
Also, you can try to find out how much parallax there is between things the camera sees. Parallax increases as objects get closer to the camera. This might be to advance or maybe not work for this kind of stuff.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Distance Ranging Webcam- Using Sharpness?
« Reply #2 on: August 02, 2007, 05:44:37 PM »
The hyperfocal distance thing explains my situation exactly. As I approach an object the sharpness lessens due to the fact that I am not focusing the lens. This is not very precise but should work to avoid collisions. As for the parrallax, I was not able to find a program that calculates the parallax.
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: Distance Ranging Webcam- Using Sharpness?
« Reply #3 on: August 02, 2007, 07:00:10 PM »
parallax needs a picture taken from 2 places, you then compare the pictures and you can tell how far something is by the amount of parallax shift that occurs. This is how we calculate how far stars are from the earth up to a certain point before the paralax shift becomes too small.
 I dont know about using sharpness for distance ranging, but your best option is to use 2 cameras.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Distance Ranging Webcam- Using Sharpness?
« Reply #4 on: August 02, 2007, 07:27:22 PM »
Any projects online that do what you are describing?
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Distance Ranging Webcam- Using Sharpness?
« Reply #5 on: August 04, 2007, 09:17:32 AM »
Hmmmm neat idea!

airman00 please report your findings if you get it to work on a robot, Im curious . . .

Offline h3ro

  • Full Member
  • ***
  • Posts: 110
  • Helpful? 0
Re: Distance Ranging Webcam- Using Sharpness?
« Reply #6 on: August 04, 2007, 10:27:44 AM »
Quote
parallax needs a picture taken from 2 places, you then compare the pictures and you can tell how far something is by the amount of parallax shift that occurs

No, you can work with pictures taken from the same place. But you need more then one picture.

I am no expert on this field, but I know that there are computer programs that track object from a film clip (For mixing CG elements with real footage). With a program like that you can get the info on how long the camera is from a specifics point.

You might want to check out how "Boujou" from 2d3 work. Not sure if it can be used in real time, but it might be possible to simplify the process to only finding distance instead of doing all the stuff a normal tracker program does?

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: Distance Ranging Webcam- Using Sharpness?
« Reply #7 on: August 04, 2007, 10:41:49 AM »
parallax is calculated by taking 2 pictures along a paralel plane, then using the half distance of that plane to work out 2 rightangled triangles, whose points meet at object. some quick trig will tell you the distance (also you get a bonus isosoles triangle to work with by combining the 2).
the greater the distance between the cameras or pictures result in greater accuracy. to measure distances of stars, a picture is taken from 1 end of earths orbit, then 6 months later it is taken from the opposite end to get the biggest plane distance and best accuracy. For a few metres though very little distance would be required (5 - 10 cm ish).

It would also be interesting to hear some results from your sharpess study (have you made a graph of sharpness threshhold against distance ? is it linear ? etc..)

Also what distance does it start losing sharpness? is it just very close?

Offline h3ro

  • Full Member
  • ***
  • Posts: 110
  • Helpful? 0
Re: Distance Ranging Webcam- Using Sharpness?
« Reply #8 on: August 04, 2007, 10:48:49 AM »
Maybe parallax is the wrong word. I might be mixing something here. (Been doing a lot of photostiching lately) But do a search for objec tracking/machmoving and you will find what I am talking about, if your interested.

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: Distance Ranging Webcam- Using Sharpness?
« Reply #9 on: August 04, 2007, 10:49:46 AM »
Quote
No, you can work with pictures taken from the same place. But you need more then one picture.



Ive tried something similar a couple of years ago, but using just one picture, if you know the relational height of the camera, you can gain some data to form a right angled triangle:-

first you get the right angle

then the opposite side is the relational height of the camera

then you get the angle between the hyp and adj sides

it should be possible to calculate the distance like this provided you definately know the relational height of the camera.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Distance Ranging Webcam- Using Sharpness?
« Reply #10 on: August 05, 2007, 08:32:06 AM »
I'm going to experiment with sharpness some more. The sharpness levels decrease from 1000 whenever it it like 6 inches away. What I plan on doing is to record the sharpness level  and then whenever the value is lower than 400 for more than 2 seconds , an object avoidance algorithm starts.
The reason for this is because the sharpness sometimes decreases to 300 only to go up to 500 when the camera moves a little. If a reading of under 400 lasts for more than 2 seconds, that shows that there is definetly an object in front.



Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

 


Get Your Ad Here