1

My FRC (robotics) team is having issues with image processing, and tomorrow is our last testing day before competition. The camera is facing downward and tilted in the x direction. We are trying to calculate the distance that an object is to a fixed point on the same surface. We only need to calculate the x distance (in inches).

Here's a diagram. The object could be anywhere on the line with the fixed point.

Here is the view from the camera

The tape measure represents the line in the diagram. I know it's low res and not the best picture, I took it just before I left today. The tape measure is where the object could be. And we only care about it's x position.

Other info if needed:

  • Camera: Pixy
  • Focal length: 28mm (1.1024")
  • Sensor size: 0.25"
  • Height of camera from surface (the ground in our case): 8"

We always know the x position (in pixels) of the object, we just need to calculate the distance (in inches) that the object is from the fixed point.

If you have any other questions please ask. Thanks.

Titan
  • 33
  • 10
  • You should edit the images into the question - external resources that are important to the question tend to disappear over time. When this happens, your question becomes unintelligible. – Rob Feb 19 '19 at 13:00

1 Answers1

0

You are on the right track with your image of the tape measure. All you need to do is manually (from that image), determine the inches (from zero) for each x-position (pixel). Create a lookup table that you can use in the code.

When you determine the x-position of the object and the x-position of the fixed point, look up the inches for each of these x-positions and subtract to get the distance between the object and the fixed point.

This approach is super simple, but also depends on proper calibration of the system. In particular, the operational setup (height, angle, camera optics, etc.) has to exactly match the setup when the test image was taken that was used to create the lookup table.

A standard technique is to calibrate the system by taking and processing a calibration image whenever the operational setup might have changed. For example, you could place a grid patter (e.g., with one inch squares) in the field of view. The idea is that you code a calibration analysis that will determine the proper lookup table values based on the standard image.

Rob
  • 6,247
  • 2
  • 25
  • 33