I'm an actionscript developer and my next project is a traffic information capture system. I'm assuming that this project will require a lot of image processing and motion capture methods on images obtained through cameras. I know I can achieve this with ActionScript, but might require sacrificing performance and accuracy. Will Java be better suited? Which is the best language for such a process? Are there any open source libraries/solutions available for this?
If you need to develop image processing algorithms for this then MATLAB (or a clone such as Octave) is probably the best starting point for algorithm development. Once you have algorithms then you can implement these in your language of choice. If performance is an important factor (and it probably will be for an application like this) then you probably want to use a suitable compiled language such as C or C++, at least for the performance-critical code.
I use Delphi, mainly because it allows reasonably fast programs, with an easy (and compatible) GUI visualisation. (which is a mix of windows GDI and OpenGL)
Our images are fairly large (2000x2000 x 20fps and beyond), and cache utilization is the main problem.
I don't use opencv, though I investigated it several times. The algorithms in OpenCV are usually targeted to find the best solution, which is usually fairly slow.
I therefore have developed own algorithms that are specified to my applications, dropping many borderconditions that opencv tries to satisfy.
(not real image recognition, but e.g. for a 90 degree rotate that is optimized for cache usage, see http://stackoverflow.com/questions/848025/rotating-bitmaps-in-code )
Hello,
Do you need to this online, as in any user could connect to your application or you'd just pull the camera data, but us it locally on a machine ?
If it's locally, speed wise have a go with GNU Octave, but the syntax will be a bit different and you'll need to get the grips with signals and systems.
If you come from a C/C++ background you should be fine, but if you come from a purely actionscript environment (like me :) ), you'll find yourself comfortable in more creative coding mediums.
For prototyping, I would recommend MaxMSPJitter. As it was already mentioned, the key will be using openCV, it's ported in most languages (even is as3, but haven't tried it in as3 yet) and it's there for MaxMSPJitter as cv.jit.
Advantages are:
- it's easy to pickup, visually intuitive, plus the help system is amazing!
it's fast! (it's made for speed MSP is the signal processing package and Jitter is the package for fast(optimized) matrix operations (video processing, 3D, etc. )
no compiling needed, your patch is a thing that runs all the time and you change it live as it runs.
- cv.jit comes with a bunch of cool help examples ready to plug and play
If you don't find the patching environment intuitive and you like as3/java style coding, you might want to consider either Processing with OpenCV,either openframeworks, the FAT package as it includes all the addons including openCV.
Openframeworks is a collection of C++ libraries so that will be pretty fast, but you'll be restricted to a desktop app. If you want to tie that to Flash you can probably connect to flash from openframworks using the OSC protocol and FLOSC.
Processing is basically a Java library that nicely abstracts a lot of things and makes it all a bit simple. It is slower than openframeworks, but it allows to publish a java applet that you can run online.
What feature do you need to extract from your video ? The simplest thing you could do is compare the current frame to the previous and use the pixels that are different to see how much overall motion is there. You could use more advanced techniques like Optical Flow to get the direction of motion and all that. Have a look at this presentation, could be handy. There are some source files there to inspect as well.
At Uni, we had a openframeworks/opencv workshop with Joel Gethin Lewis and Arturo Castro. You can get an opticalflow example from the wiki.
HTH, George
Matlab is useful with its large selection of toolboxes - include image processing and machine learning. Matrix-based calculations make it easy to manipulate images. Matlab also has integration with c++ if you need speed, although it's rather messy and requires loading the ~100MB matlab runtime into memory.
IDL is quite popular in certain industries, including geophysics, astronomy, and medical imaging. It's roughly similar to matlab but with a different set of quirks. It's fast, able to use multi-core CPUs and all that. There's a free clone named Fawlty Language.