Go to Post I'm a drive team coach, they don't eat lunch during competition. - Rick [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

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 26-02-2013, 23:25
wre136's Avatar
wre136 wre136 is offline
Registered User
AKA: Will Edds
FRC #2461 (The METAL-SKINS)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2002
Location: Oklahoma City
Posts: 30
wre136 is an unknown quantity at this point
Possible Wrong Wiring in FRC Vision Tracking Example

In the "Rectangular Tracking - 2013.lvproj", there is the "distance.vi". I believe either something is wired incorrectly there or this post is incorrect on which camera axis resolution you should use.

As from the post, it states that if you are trying to compute distance based off of the height of the sides of the rectangle, then you should use the Y axis resolution which is 240.

However, in the distance.vi (Attached to this post), it is obviously using the X Axis resolution of 320. The code still looks like its comparing against the height of the rectangles so this causes me some confusion.

Is the post wrong, the code wrong or am I just reading this wrong?
Attached Thumbnails
Click image for larger version

Name:	Bad FRC Programming.PNG
Views:	152
Size:	35.7 KB
ID:	14202  
  #2   Spotlight this post!  
Unread 27-02-2013, 07:54
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Possible Wrong Wiring in FRC Vision Tracking Example

That is a good question, and clearly that expression needs more documentation.

The pixel size of the camera resolution needs to match the view angle. So if the datasheet gave a vertical field-of-view, we'd use that. If it used a diagonal, we'd use that. Best I could read the data sheet, it was width that they specified. They list it on page 49 as horizontal angle of view.

Greg McKaskle
  #3   Spotlight this post!  
Unread 27-02-2013, 13:20
wre136's Avatar
wre136 wre136 is offline
Registered User
AKA: Will Edds
FRC #2461 (The METAL-SKINS)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2002
Location: Oklahoma City
Posts: 30
wre136 is an unknown quantity at this point
Re: Possible Wrong Wiring in FRC Vision Tracking Example

Based off of what I can infer, the field-of-view is the same in any direction, up, down, left or right. The only difference is that we go further left and right that up and down with the camera aspect ratio. However, that shouldn't change anything since we know how much further left-right we go verses up-down.

However, if there is an actual difference (stating that I am incorrect with what I said above which I completely can be), then if we are using the width of the image, then we should be rating our distance based off of the horizontal length of rectangles, not the height of them.

Haha ya, more info as to what they are trying to accomplish here would help out a lot. Right now I'm not really wanting to change their example code but it does seem like something is either misplaced or at least not the whole story is being told.
  #4   Spotlight this post!  
Unread 28-02-2013, 08:13
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Possible Wrong Wiring in FRC Vision Tracking Example

The things that need to match are the object size in pixels and in units, and the camera view in pixels and the fov angle. If the pixels weren't square, then we shouldn't switch between height, width, or diagonals. The rest of that is some unit converstion from ft to inches.

The fundamental relationship being used is that at a given plane parallel to the camera sensor, the (size in pixels)/(size in inches) is relatively consistent for all objects in that plane. This means that knowing the physical width or height of an object in the scene lets you calculate a width and height of all other objects in the plane based on their pixel size. This relationship is also true for the visual boundary of the image. The 240x320 image now has a physical size. And that is where you can use the optics of the camera to determine the distance to that plane.

Greg McKaskle
  #5   Spotlight this post!  
Unread 28-02-2013, 23:01
wre136's Avatar
wre136 wre136 is offline
Registered User
AKA: Will Edds
FRC #2461 (The METAL-SKINS)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2002
Location: Oklahoma City
Posts: 30
wre136 is an unknown quantity at this point
Re: Possible Wrong Wiring in FRC Vision Tracking Example

Just to test out your theory, I created an image that was 320 x 240 pixels. In the center, I created a hollow box that was 72 x 72 pixels. I arbitrarily chose that this would be a 3ft x 3ft box. If I run the equation from the previous post using the width of the image and the camera's horizontal angle of 48 degrees (closer to the 206 camera's real-life view angle), I get the following:

(((320/72)*3)/2)/tan(48/2) = 14.97ft

Now, if I do the same thing but with the height of the image, this does not come out to be 14.97ft. However, if I change the view angle to 36.95 degrees, then I have a match.

(((240/72)*3)/2)/tan(36.95/2) = 14.97ft

This I believe proves that the vertical view angle of the cameras is different from the horizontal view angle.

However, I also believe that this shows the importance in the above calculation that if you use the height of the image, use the height view angle, if you use the width of the image, use the width of the view angle. the key point is to use the right combination and not to mix them! However, I see in the code that we are using the X resolution of the camera and the horizontal view angle of the camera so we should be good to go.

However, the previous post listed in the first part of the tread is incorrect since it is using the Y resolution of the camera but the horizontal view angle of the camera. Just an observation.
Attached Thumbnails
Click image for larger version

Name:	Presentation1 (Custom).jpg
Views:	12
Size:	2.5 KB
ID:	14217  
  #6   Spotlight this post!  
Unread 03-03-2013, 11:33
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Possible Wrong Wiring in FRC Vision Tracking Example

I think we are making progress here, but I'm a bit confused. The datasheet for the camera mentions one angle. I believe one camera at least made it clear that this was for the horizontal direction. The code in the picture at the top of the thread uses the X resolution and the X view angle.

Do you now feel that the example is correct or incorrect?

Greg McKaskle
  #7   Spotlight this post!  
Unread 04-03-2013, 16:41
wre136's Avatar
wre136 wre136 is offline
Registered User
AKA: Will Edds
FRC #2461 (The METAL-SKINS)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2002
Location: Oklahoma City
Posts: 30
wre136 is an unknown quantity at this point
Re: Possible Wrong Wiring in FRC Vision Tracking Example

Sorry Greg,

Yes, the code in the picture at the top is correct from what I can tell. The example of what you are suppose to do in the mentioned "post" (the one that is a hyper link) that is in the first post of this tread is incorrect however since it uses the y resolution of the image but to the x view angle of the camera.
  #8   Spotlight this post!  
Unread 06-03-2013, 06:51
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Possible Wrong Wiring in FRC Vision Tracking Example

Ah. I totally overlooked my old post. Sloppy on my part. We are in agreement. The pixel size and angle need to agree.

Greg McKaksle
Closed Thread


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 03:05.

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