Go to Post We are not here to build robots, or to win a contest, or to travel to cool places or to bring home trophies. we are here to see what a career in engineering and science is like; anything else that happens along the way is frosting on the cake - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 02-04-2016, 19:16
simon-andrews's Avatar
simon-andrews simon-andrews is offline
Registered User
FRC #4761 (Robockets)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: Reading, MA
Posts: 16
simon-andrews is an unknown quantity at this point
Re: How can angle offset of a shooter be calculated from pixel offset?

Quote:
Originally Posted by Oblarg View Post
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 View Post
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
__________________

GitHub | StackOverflow
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 20:56.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi