Camera Coordinate Calibration Overview - gabrielburnworth/plant-detection GitHub Wiki
###Let's say we have a photo with three plants in it whose locations and sizes we need to detect:
These example images were created with rotation to simulate a rotated camera. Background grid shown for reference.
Assumptions:
- We always know the coordinate location of the camera, since it is CNC-controlled.
- The image center is directly below the camera.
- The camera is the same distance away from the calibration objects and the objects to detect.
- The pixels in the image the camera takes are square.
Step 1: Take calibration image of known objects
With the (imaginary) camera at the same height from the subjects, we take a photo of two calibration dots of known spacing:
These example images were created with rotation to simulate a rotated camera. Background grid shown for reference.
We know that these objects are 1000 units apart and that they are square with our desired coordinate system.
Note: Camera coordinates are not needed for calibration. Calibration does require the orientation of the coordination objects to be known: that they are along the x-axis and that the origin is in the lower left.
Step 2: Run calibration
Using our known values, we determine that the camera is rotated 5 degrees from the coordinate system, and determine that the pixel to coordinate conversion scale is 1.72.
Step 3: Determine locations and sizes of "plants" in original image:
Using the calibration parameters determined in step 2, and the known location of the camera in this image (800, 500), we find the locations and sizes of the "plants":
X (calculated) | Y (calculated) | dia. (calculated) | X (actual) | Y (actual) | dia. (actual) |
---|---|---|---|---|---|
300 | 299 | 102 | 300 | 300 | 100 |
898 | 601 | 104 | 900 | 600 | 100 |
99 | 799 | 104 | 100 | 800 | 100 |