View Single Post
  #1   Spotlight this post!  
Unread 13-02-2015, 22:23
FleventyFive FleventyFive is offline
Registered User
FRC #4118
 
Join Date: Sep 2014
Location: Gainesville, FL
Posts: 23
FleventyFive is on a distinguished road
Re: Has anyone run OpenCV in a separate WPILLib Task / Thread on the RoboRIO?

Quote:
Originally Posted by jreneew2 View Post
Yeah, you are ok to use it! We are still refining the vision code for detecting totes though so you should redo that part if you can do it better. For compiling and linking, this is a lengthy process. We used just plain OpenCV2. We followed team 2168's linking instructions which are a bit vague so I will try and explain.

1. Download our OpenCV project from our github here. And move the project somewhere safe (we have C:\OpenCV_frc\arm\include\OpenCV\opencv2)

2. Then I assume you have an existing project for C++ (im not sure if this differs from java) go open eclipse and right click on your project go to Properties->C/C++ Build->Settings. Then go to the tool settings tab and click on Cross G++ Linker and add -rpath,C:\OpenCV_frc\arm\libs\opencv (what ever your directory is). Also make sure you have a comma in between entries.

3. Then go to C/C++ general and go to paths and symbols. Click on the library paths tab and hit add. Add the directory from your file system and type in C:\OpenCV_frc\arm\libs\opencv (what ever your directory was) hit apply.

4. Then go to the Libraries tab and add opencv_core,opencv_highgui,opencv_imgproc from C:\OpenCV_frc\arm\libs\opencv (whatever your directory is)

5.Now hit apply and add the cpp and h files in a folder in your project. we have our called Vision2015. Then add the necessary includes and and using namespace cv;

6. You should be able to compile and run the robot. You might want to see how to run the code on a separate task though because it will slow down drive code if running in a separate task. Our actual robot project in robot.cpp shows how to do that.


Please feel free to reply if you have any questions. Also, if you improve the tote detector in any way, contact us.

Have a fun time!,
Drew (2053 Programmer)

Thanks for the great instructions! However, every time I setup a project (including importing yours and fixing the paths to opencv) I get like 175 errors in opencv2/core/core.hpp. I had the same problem when I tried earlier in the season to get opencv in the project. Any idea why I would get so many errors? Sound like something to do with the index, but I've rebuilt in many times.

Edit: followed PaulDavis1968's suggestion to comment out that line in WPILIB. No idea what that does, but it fixed it!

Last edited by FleventyFive : 13-02-2015 at 22:36.
Reply With Quote