Speeding up OpenCV on ARM?
Hi all,
I'm working with OpenCV on a Gumstix, and it is incredibly slow. For instance, running the "GoodFeaturesToTrack" function in a node runs at 1.5Hz, and requires 85% processor utilization on a Gumstix Overo Tide. I used a standard download and compile of the ROS vision_opencv package to get these results. Any ideas on how to optimize? It seems that even a lowly 700MHz processor should be a bit faster than what I'm getting.
Thanks!
Update
I'm looking into Ash Charles' suggestion to add a flag to use the neon coprocessor. I'm not quite sure how to do this. I'm assuming that I make a change to my opencv2 makefile, but would appreciate some direction on that.
Update #2
I'm working on implementing RahulP's suggestion. So, in the vision_opencv package, I added a flag to CMakeLists.txt, which now looks like this:
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
set(ROSPACK_MAKEDIST true)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O2 -mfpu=neon")
rosbuild_make_distribution(1.4.3)
Then, I ran rosmake vision_opencv
which was successful. However, running the code showed no improvement whatsoever in execution speed (as measured by running rostopic hz /output).
Did I skip a step here? Or do I need to be looking into profiling? I tried using oprofile, but didn't really get anywhere productive. If you have any suggestions, they would be much appreciated.
Potential Update/Question
If I were to go to my OpenCV directory, and type in:
./configure -mfpu=neon
followed by running rosmake, would that have the desired effect?
Update
I've uploaded all of my code to Github. The main program that I'd like to optimize is in nodes/find_laser_filtered.py. Obviously, one easy thing to do is to get rid of filtering lines by angle, that was mostly for debugging purposes on the desktop.
If you get an opportunity to take a look, please suggest any ideas for improvement you may have. I'd really like to get this running at 15+ Hz, and I'm currently at about 2 Hz...
Thanks!