Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Vision Tracking Solution (http://www.chiefdelphi.com/forums/showthread.php?t=132809)

Fauge7 13-01-2015 19:15

Vision Tracking Solution
 
I am proud to announce Team 3019's Vision tracking in java!

I have found that the libraries from First are too unreliable or do not even work and have researched a solution to tracking a yellow tote with or without the retro-reflective tape with green led ring-light. The solution I created runs on the driver-station computer meaning it will not interfere with the RobotRio's processing power but should take up more bandwidth.

I commented the code to describe my methodology and tried to make it as readable as possible. The program does not have a graphical user interface (gui) as it is the bare bones vision tracking without distance or any information based purely based on location of it relative to the point (0,0).

If you are going to use it all I ask is to give credit where credit is due.

Cheers!

Github Link

Ozuru 13-01-2015 22:30

Re: Vision Tracking Solution
 
Interesting solution, nice work on it. It's very sleek and simple.

faust1706 13-01-2015 23:46

Re: Vision Tracking Solution
 
Good job! It takes a lot of work to do just this, believe it or not.

If you want to take it one step further, you can figure out the angle the camera(robot) needs to move to make the center of the object the center of the image.

Simply solve this proportion

Image width/Fov_x= distance from the center of the image/degrees

be careful though, the origin of the image in opencv is the top left, so you have to do a linear remapping of the point so the origin is the center of the screen!

proof of concept: In 2013 we used this x rotation value to line up with the 3 pt goal autonomously using a pid as shown slightly in this video: http://youtu.be/VhE10dNBxXs?t=27s

Those micro adjustments were not done by our driver, but rather by simply pushing a button on the controller to line up.

This is just food for thought. Take it as you will. (You can also calculate distance to your target if your camera height and angle stay constant, that involves y rotation ;) )

aaronjeline 16-01-2015 19:59

Re: Vision Tracking Solution
 
Hey, sorry for being a tad scrubby, but where is the OpenCV Library you are using?

Fauge7 17-01-2015 01:04

Re: Vision Tracking Solution
 
It is openCV 2.4.10 downloadable here

aaronjeline 17-01-2015 15:13

Re: Vision Tracking Solution
 
Continuing in my eternal scrubiness, I got the library working fine, but I keep getting an error on
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
NATIVE_LIBRARY_NAME cannot be resolved or is not a field

Any ideas? All the imports are working, and code referencing objects/fields in the library aren't throwing any errors.
I'd appreciate any help I could get.

Fauge7 17-01-2015 18:54

Re: Vision Tracking Solution
 
for version 2.4.10 the string value is "opencv_java2410"

gegozi 18-01-2015 15:37

Re: Vision Tracking Solution
 
Hello,
I am wondering if other FRC teams are allowed to copy this code.
Thanks.

Fauge7 18-01-2015 16:00

Re: Vision Tracking Solution
 
Quote:

Originally Posted by gegozi (Post 1430208)
Hello,
I am wondering if other FRC teams are allowed to copy this code.
Thanks.

of course! Just give credit to my team(3019) that's all I ask!

Fauge7 20-01-2015 22:51

Re: Vision Tracking Solution
 
Updated! fixed a big memory leak!

popcorn107 07-02-2015 09:31

Re: Vision Tracking Solution
 
At the moment we are trying to get our robot to center itself with the bin by rotating (later on by strafing as well). How might we go about getting the center of the bin from your program? First time trying to implement Vision and am having some troubles fully understanding.

WillNess 07-02-2015 15:32

Re: Vision Tracking Solution
 
The import for opencv "highgui" is not working, like it can't find it. Any help would be appreciated.

Fauge7 07-02-2015 23:21

Re: Vision Tracking Solution
 
This solution uses opencv 2.4.10 not 3.0

WillNess 08-02-2015 18:44

Re: Vision Tracking Solution
 
Thanks I believed that worked. But when we're creating java classes on roborio, we get errors. We have installed the libraries for OpenCV.

Fauge7 08-02-2015 21:38

Re: Vision Tracking Solution
 
It's meant to be run on the driverstation laptop not the actual robot


All times are GMT -5. The time now is 10:41.

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