Quote:
Originally Posted by Oblarg
Pixel displacement should be strictly proportional to angular error, since the camera is effectively a point. To convince yourself of this, draw a picture of the shooter and the target (top view, camera at the origin).
Figure out the lateral FOV of the camera in degrees, and calculate proportional to that using the known width of the image in pixels.
|
Quote:
Originally Posted by lethc
If your camera is mounted solidly then you should be able to interpolate the offset angle of your shooter by using the first option (how many pixels away from the middle the goal is). This isn't necessarily the best way to solve the problem but it works and it's really easy. Is that all you're asking?
|
Sorry, I worded my original post poorly and wasn't clear. This method actually is what I was doing originally, with this code:
Code:
def get_offsets(bb_leftside_x, bb_width, img_width):
middle = bb_leftside_x + (bb_width / 2)
pixel_offset = middle - img_width / 2
angle_offset = pixel_offset * (26.5 / (img_width / 2)) # Raspberry Pi camera module FOV is 53 degrees
ret = {
"pixel_offset": pixel_offset,
"angle_offset": angle_offset,
}
return ret
What I need to get is an angle that can be fed directly into the turntable as an amount to turn.
https://imgur.com/RelZro4