Go to Post FIRST is a community unlike the public at large, with the distinction lying on its gracious professionalism. I have no doubt that the community will continue to uphold and cherish this unique characteristic through difficult events such as this. - Joon Park [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-03-2013, 16:47
Dreuxtray Dreuxtray is offline
Registered User
AKA: Dreux Trahan
FRC #4336 (Ramageddon)
Team Role: Programmer
 
Join Date: Feb 2013
Rookie Year: 2012
Location: Louisiana
Posts: 4
Dreuxtray is an unknown quantity at this point
C++ Vision

I'm in no hurry to get an answer to this. I'm mearly doing research for next year.

I'm kinda new at using C++ for coding the robot this year. My team is thinking about implementing Vision for next year via C++. What I am looking for is someone to explain to me how to write a C++ program that does nothing but Vision processing or at least give me a place to start off with. I don't want to run robot driving code on it, just vision processing code. I've read all of the manuals for the C++ stuff and it just confuses me.
Reply With Quote
  #2   Spotlight this post!  
Unread 12-03-2013, 20:02
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: C++ Vision

I know it's not exactly what you're looking for, but you can find an example by going to (in WindRiver) File -> New -> Example -> VxWorks Downloadable Kernel Module Sample Project -> 2013 Vision (... I think there's two "vision" related examples). We've never actually tried vision tracking ourselves (this is also our first year of C++), but that's what most people who have will probably recommend. Enjoy!
Reply With Quote
  #3   Spotlight this post!  
Unread 13-03-2013, 00:37
AlexBrinister AlexBrinister is offline
Registered User
AKA: Alex Brinister
FRC #1768 (RoboChiefs)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Bolton, MA
Posts: 93
AlexBrinister will become famous soon enough
Re: C++ Vision

Our robot has a little Intel NUC on it running Arch Linux, in which we run OpenCV code that gets images from our cameras, figures out angles, distance, etc, and sends it to the cRIO. We write it ourselves in C++. You can look at the source code here. I'm looking to port this C sometime. It's not the fastest thing on the planet... I also want to clean this up later. It's ultra messy as we kind of write our code in a hurry all the time

Alex Brinister
Reply With Quote
  #4   Spotlight this post!  
Unread 13-03-2013, 03:59
faust1706's Avatar
faust1706 faust1706 is offline
Registered User
FRC #1706 (Ratchet Rockers)
Team Role: College Student
 
Join Date: Apr 2012
Rookie Year: 2011
Location: St Louis
Posts: 498
faust1706 is infamous around these partsfaust1706 is infamous around these parts
Post Re: C++ Vision

1706 is highly advanced in Vision programming. That is my role on the team and i love it. There are only 2 programmers on the team, me and a senior who does everything else. My program actually runs on a completely different computer than his on the robot, and runs independently. I used intel's OpenCV libraries and had to fix some of the functions such as approxpoly because it wasnt good enough. I have a paper posted on here the I wrote about it for a science competition, which won me a trip to Houston for I-SWEEEP. If you have any questions, please contact me.
__________________
"You're a gentleman," they used to say to him. "You shouldn't have gone murdering people with a hatchet; that's no occupation for a gentleman."
Reply With Quote
  #5   Spotlight this post!  
Unread 13-03-2013, 18:57
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,050
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: C++ Vision

Quote:
Originally Posted by faust1706 View Post
My program actually runs on a completely different computer than his on the robot, and runs independently. I used intel's OpenCV libraries and had to fix some of the functions such as approxpoly because it wasnt good enough. I have a paper posted on here the I wrote about it for a science competition, which won me a trip to Houston for I-SWEEEP. If you have any questions, please contact me.
What did you fix with ApproxPoly?
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #6   Spotlight this post!  
Unread 14-03-2013, 00:58
faust1706's Avatar
faust1706 faust1706 is offline
Registered User
FRC #1706 (Ratchet Rockers)
Team Role: College Student
 
Join Date: Apr 2012
Rookie Year: 2011
Location: St Louis
Posts: 498
faust1706 is infamous around these partsfaust1706 is infamous around these parts
Re: C++ Vision

If you notice how poorly it draws the polygons, I dont rely on the corners it gives me. I adjusted aishack's program(http://www.aishack.in/2011/06/image-moments/) to tracking a coloured ball and applied the moment to the contour, and not the whole image. That gives me subpixel accuracy for the centers of the targets that doesnt budge when everything is still. Last year to find the center of the target, I averaged the corners of ApproxPoly. To fix Approxpoly's poor quality, I used contour-tree temporarily filled in the contour all white (im dealing with a binary image),then applied approxpoly, but around each corner it gave me, i applied a region of interest and then used cvcornerharris. Then I took those new corners, ordered them top to bottom, left to right, and drew the polygon around them. Of course I knew it was a square, but I could adjust the code to do it for any size polygon. We'll be at stl and terra houte if you by chance happen be going too.
__________________
"You're a gentleman," they used to say to him. "You shouldn't have gone murdering people with a hatchet; that's no occupation for a gentleman."

Last edited by faust1706 : 14-03-2013 at 02:55.
Reply With Quote
  #7   Spotlight this post!  
Unread 14-03-2013, 08:59
Dreuxtray Dreuxtray is offline
Registered User
AKA: Dreux Trahan
FRC #4336 (Ramageddon)
Team Role: Programmer
 
Join Date: Feb 2013
Rookie Year: 2012
Location: Louisiana
Posts: 4
Dreuxtray is an unknown quantity at this point
Re: C++ Vision

Okay, so I looked at Open CV and it doesn't seem to be anything on getting the camera. Do yall use the WPI libraries to set up the camera and then use OpenCV to do the processing?
Reply With Quote
  #8   Spotlight this post!  
Unread 14-03-2013, 10:21
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,050
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: C++ Vision

Quote:
Originally Posted by Dreuxtray View Post
Okay, so I looked at Open CV and it doesn't seem to be anything on getting the camera. Do yall use the WPI libraries to set up the camera and then use OpenCV to do the processing?
If you execute the stuff on the robot, you're better off using NIVision, in which case you would use the WPI Libraries to set things up. On the driver station or some other processing platform, there's a variety of ways to capture images from the camera.

One way of doing it is with the VideoCapture class, with a connection string something like "http://10.xx.xx.11/mjpg/video.mjpg". However, beware of significant startup delays in the default build of OpenCV. See http://www.chiefdelphi.com/forums/sh...d.php?t=114806
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #9   Spotlight this post!  
Unread 14-03-2013, 23:04
faust1706's Avatar
faust1706 faust1706 is offline
Registered User
FRC #1706 (Ratchet Rockers)
Team Role: College Student
 
Join Date: Apr 2012
Rookie Year: 2011
Location: St Louis
Posts: 498
faust1706 is infamous around these partsfaust1706 is infamous around these parts
Re: C++ Vision

I haven't had an issue with the built in delays with OpenCV. My program runs at 20 fps, could be faster, but it isnt needed. We have 4 cores on our O Droid X board, but are only using one, so theoretically we could use all of them and make the program run at 80 fps. But again, that is not needed.
__________________
"You're a gentleman," they used to say to him. "You shouldn't have gone murdering people with a hatchet; that's no occupation for a gentleman."
Reply With Quote
  #10   Spotlight this post!  
Unread 14-03-2013, 23:06
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,050
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: C++ Vision

Quote:
Originally Posted by faust1706 View Post
I haven't had an issue with the built in delays with OpenCV. My program runs at 20 fps, could be faster, but it isnt needed. We have 4 cores on our O Droid X board, but are only using one, so theoretically we could use all of them and make the program run at 80 fps. But again, that is not needed.
The delays only occur at low framerates (like 5fps) and low resolutions. Sounds like you're processing on board, so you don't have to deal with the 7Mbps limitation for the driver station, which means you're unlikely to run into the problem.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #11   Spotlight this post!  
Unread 18-03-2013, 00:34
faust1706's Avatar
faust1706 faust1706 is offline
Registered User
FRC #1706 (Ratchet Rockers)
Team Role: College Student
 
Join Date: Apr 2012
Rookie Year: 2011
Location: St Louis
Posts: 498
faust1706 is infamous around these partsfaust1706 is infamous around these parts
Re: C++ Vision

I guess I didnt understand the scenario. And yes, you are correct about having an onboard computer. It weighs 6 ounces, so weight is not an issue. It is an O-Droid X board. Very powerful. I highly recommend it.
__________________
"You're a gentleman," they used to say to him. "You shouldn't have gone murdering people with a hatchet; that's no occupation for a gentleman."
Reply With Quote
Reply


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 12:49.

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