Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   how to use openCV? (http://www.chiefdelphi.com/forums/showthread.php?t=101685)

ganchara 01-02-2012 09:56

how to use openCV?
 
Does OpenCV have a program that will spit out code for you similar to what the NI Vision Assistant program does? If it does, it seems like using OpenCV will be easier for my team to implement and understand how our rectangle tracking works, as we are having some trouble understanding the code that is spit out by Vision Assistant.

PaulDavis1968 01-02-2012 12:12

Re: how to use openCV?
 
Opencv would have to be ported to vxworks. If you use that you would have to do off crio processing. I am attempting that now.

ganchara 01-02-2012 12:18

Re: how to use openCV?
 
doing the processing off cRIO has always been the plan, could you let me know if you have success in porting it?

DjScribbles 01-02-2012 16:27

Re: how to use openCV?
 
Just to make you aware, ColorImage and Binary image implement a number of features that you would likely have in your NI Vision Assistant generated code in a c++ interface that is much cleaner, we gutted most of the code out of the vision assist generated stuff except for the convex hull and the particle filter; the threshold and particle analysis are both done in the C++ outside. (we also switched the vision assist file to a cpp file to evade some big errors)

I wouldn't worry to much about trying to fully understand the inards of the generated code, just because C code is written much differently, and maybe confusing to the students. Simply minimize how much of it you are using, make sure they understand what is in the generated code, how it was created from the script, and how to interface with it.

Edit: Also, if you plan to do vision processing on the driver station, I've been told that competition network can be an issue with the added latency.

ganchara 01-02-2012 16:53

Re: how to use openCV?
 
the biggest issue with the NIVA code is we aren't sure how it outputs the particle analysis measurements. Latency shouldn't be an issue as we are planning to use it just to establish a baseline of where we need to get to, and use a gyro to actually do the positioning, and finally going back to use the camera to double check that we got to the correct position.

PaulDavis1968 01-02-2012 17:07

Re: how to use openCV?
 
Quote:

Originally Posted by ganchara (Post 1117833)
doing the processing off cRIO has always been the plan, could you let me know if you have success in porting it?

Well if you do it off the crio then you do not need to port it. Are you using the driving station? Anon-board computer? Opencv compiles to both linux and windows. I am using the console to take mjpeg files off the network then process them and then send it back to the crio to act on it. I will hook in to the output of the c++ windows app by modifying the console code(Java). I do worry about processing speed. The robot might have to be in a stop state to pull this off.

ganchara 01-02-2012 17:12

Re: how to use openCV?
 
well, what i was really trying to figure out is if there is a program that will spit out vision processing code using the WPIJavaCV libraries, as those will both be easier to understand and be compatible with java. we are currently planning to do the processing on the driver station laptop

ganchara 01-02-2012 17:19

Re: how to use openCV?
 
Quote:

Originally Posted by DjScribbles (Post 1117984)
the threshold and particle analysis are both done in the C++ outside. (we also switched the vision assist file to a cpp file to evade some big errors)

When you say that the threshold and particle analysis are done in the C++ how does that work, because that would mean you went from C++ for the plane extraction and threshold, to VA to do the convex hull and particle filter, and then back to C++ for the final particle analysis?

Paul, in your first post you say that to do off cRIO processing you would have to port openCV into vxWorks, but then in your most recent post you say you don't need to port it to do off cRIO processing.

violinuxer 01-02-2012 18:10

Re: how to use openCV?
 
Another programmer from team 2523 here...

To clarify- we plan to do the following:

1. Get the image from the camera.
2. Process image on drivestation computer. To do this we use the javacv libraries included in SmartDashboard. We determine the offset of the target from the center of the camera image.
3. Using NetworkTables, send this data back to the robot
4. Move the robot.
5. Rinse, repeat :)

AFAIK, The OpenCV has to be written manually. Am I right? An automation utility would be great...

Thanks!

violinuxer

catacon 01-02-2012 18:27

Re: how to use openCV?
 
OpenCV is just a set of C++/Java/Python libraries. It doesn't generate any code for you....

violinuxer 01-02-2012 18:28

Re: how to use openCV?
 
One more thing: where might we find the docs for WPI's JavaCV implementation?

Thanks!

violinuxer

violinuxer 01-02-2012 18:32

Re: how to use openCV?
 
Quote:

Originally Posted by catacon (Post 1118066)
OpenCV is just a set of C++/Java/Python libraries. It doesn't generate any code for you....

Thought so... I just don't know how to use the wrappers provided with SmartDashboard. This is the best I have been able to find:

http://pastebin.com/cYtQiKpF


Gotta love javadocs!

violinuxer

DjScribbles 02-02-2012 14:55

Re: how to use openCV?
 
Quote:

Originally Posted by ganchara (Post 1118013)
When you say that the threshold and particle analysis are done in the C++ how does that work, because that would mean you went from C++ for the plane extraction and threshold, to VA to do the convex hull and particle filter, and then back to C++ for the final particle analysis?

Code:

binaryImage = colorImage->ThresholdHSL(######);
imaqImage = binaryImage->GetImaqImage();
IVA_ProcessImage(imaqImage); //In here we just convex hull and particle filter
vector<ParticleAnalysisReport> *reports = binaryImage->GetOrderedParticleAnalysisReports();


ganchara 02-02-2012 17:27

Re: how to use openCV?
 
Quote:

Originally Posted by DjScribbles (Post 1118572)
Code:

binaryImage = colorImage->ThresholdHSL(######);
imaqImage = binaryImage->GetImaqImage();
IVA_ProcessImage(imaqImage); //In here we just convex hull and particle filter
vector<ParticleAnalysisReport> *reports = binaryImage->GetOrderedParticleAnalysisReports();


if the code is in C++ where are you running it? on the driver station or the robot? My team is planning to run our image processing on the DS, which supposedly can't send data back to the robot while in C++.

PaulDavis1968 05-02-2012 12:11

Re: how to use openCV?
 
Quote:

Originally Posted by ganchara (Post 1118013)
When you say that the threshold and particle analysis are done in the C++ how does that work, because that would mean you went from C++ for the plane extraction and threshold, to VA to do the convex hull and particle filter, and then back to C++ for the final particle analysis?

Paul, in your first post you say that to do off cRIO processing you would have to port openCV into vxWorks, but then in your most recent post you say you don't need to port it to do off cRIO processing.

Sorry for the confusion. If on crio you would need to do a port.


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

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