Fastest method to process an image
Hi,
I would like to know, what do you find the best (fastest) way to process an image?
I did some performance tests on a 60 megapixel image and a pixel-by-pixel time-intensive operation (dest=sqrt(src/255.0)*255). I'm using Linux and a 4-core Core i7 processor.
I implemented this using 1. MatIterator; 2. two for cycles (and pointers); 3. a parallel_for_ (for lines) and a for cycle (inside the lines).
To my surprise, MatIterator was 3 times faster than the other two (570ms), while there was no difference between the other two methods (1700-1750ms).
When I checked the processor usage, it seemed that only one core is used while running the program.
My questions are:
- Is there a better way to process images?
- Is it normal, that there is no speed gain with parallel_for_?
- Do I need to set some flags or use some libraries when compiling with g++ to get a parallel code?
Thanks for any explications!
If you want, I can post my code, too.