I’ve been fascinated with OpenCV vision processing recently and I was wondering how I could implement it on the '09 control system. It looks as though it can’t be run on the VxWorks OS or on the hardware on the cRIO. Am I correct in stating this? Do you have any suggestions for how I could implement OpenCV or computer vision processing in general on the new control system?
I don’t claim to be an expert at OpenCV, but from what I understand, there are two parts of OpenCV. The video and image capture/import/export part, and the image processing part. While I doubt that the capture/import part of OpenCV is going to work on the cRio out of the box, I bet the image processing part will work quite well, provided you can compile it. Compiling it could be a challenge, especially resolving dependency problems. OpenCV is definitely a neat tool though.
Trying to port OpenCV to VxWorks/cRIO will lead to massive headaches on the trying to read and reprogram x86 assembly level (try just looking at the source code). OpenCV was designed for x86-based systems and is highly optimized for those architectures. (There was an effort to port it to ARM systems a couple years ago but it was only ever a partial job. I don’t know of any other ports that exist.) When you got done, you might have something that works but it would be a mess and would probably not give you the kind of performance you would want, unless you beat out all my assumptions and are proficient in high performance coding for both x86 and cRIO. I don’t mean to discourage you if you really want to try it, but you’re probably ahead to use the image processing framework included with LabVIEW. Trust me… LabVIEW really isn’t just the “easy way out” for programming.
If you want to use OpenCV on a robot (it can be really powerful), consider using a co-processor. I experimented with this configuration during the 2008 competition and got a quite robust system for recognizing trackballs. I’ve been meaning to post a whitepaper on it for a while. I’ll try to get it posted in the next week or so. Included will be info on my hardware set-up if you’re curious.
–Ryan
P.S.: AustinSchuh: You are correct that there are multiple sections in OpenCV: CV, CXCORE, HighGUI, and CVCam are the official ones that I know of. CV contains high-level image processing and filtering functions (Hough Transforms, Edge Detection, etc). CXCORE contains basic image/array/matrix manipulation functions (like add, dot product, scale, etc). HighGUI does what it sounds like and provides an easy to use way to display images and graphs and such but also contains a rudimentary camera interface. CVCam is a more full-featured camera interface module, but may be overkill for most projects. All, however, are written to be optimized for x86 and would be a pain to cross-compile properly.
Thanks for all the help (and the headaches you saved me)! I was afraid that it would come down to a co-processor or using the LabView libraries. I remember checking out your 'bot at the Seattle Regional and the eePC you guys were using with a usb webcam. Very impressive. Anyways, I would love to know how you guys pulled that off.
OpenCV is great fun and one of the earliest community vision processing toolkits. However Intel started OpenCV with x86 and there has not been very many ports to VxWorks/PowerPC architecture.
But luckily there are many other libraries out there that can work for the 09 Control System.
Slight correction: It appears as if a couple of third party companies have ported OpenCV to the Cell processor for use on a PlayStation3 (not much use for FIRST, I think) and to the PlayStation Portable. I would love to see someone use the PSP on a FIRST robot, but the final version of the x86 coprocessor we put together was under two pounds and was several times as powerful as the PSP. And then you’d have issues conforming to the rules; the battery would need to be removed, etc. Either of these might be really interesting for off-season or personal projects though. 27x performance on the PS3 port supposedly. :yikes:
The white paper is still coming but it has to fit around my classes, which have taken an upturn around midterms. I’m also trying to make it as complete a guide as possible, which means there’s a decent bit of content to generate, but hopefully this will mean that the end product is more helpful.
The cRio has a powerPC and does not have an Intel module. Therefore the standard OpenCV will not work. There are ports available to powerpc but they might not be customized for vxworks,