Ask Your Question

Revision history [back]

IMO, the flip function's performance is depend on several factors: + The OpenCV build: because OpenCV can be built with OpenCL support, and IPP support, so when running, your program can call the normal version (no OpenCL or IPP support), or the OpenCL version, or the IPP version. + The image resolution: if the width is much larger than then the height (or vice versa) then the result is different. + And the memory access mechanism (as @Der Luftmensch mentioned): with horizontal flip, it should be faster because accessing matrix's elements row by row is faster than column by column. My reproduced results when running your code on my machine (Duo Core 2x2.4 Ghz, OpenCV 3 with IPP no OpenCL, VS 2013 64 bit) are different from yours: Image 1 (500x800): flipVert process time (averaged for 500 runs): 0.66 ms flipHoriz process time (averaged for 500 runs): 0.43 ms Image 2 (500x500): flipVert process time (averaged for 500 runs): 0.66 ms flipHoriz process time (averaged for 500 runs): 0.25 ms Image 2 (800x500): flipVert process time (averaged for 500 runs): 0.74 ms flipHoriz process time (averaged for 500 runs): 0.37 ms

IMO, the flip function's performance is depend on several factors: + The OpenCV build: because OpenCV can be built with OpenCL support, and IPP support, so when running, your program can call the normal version (no OpenCL or IPP support), or the OpenCL version, or the IPP version. + The image resolution: if the width is much larger than then the height (or vice versa) then the result is different. + And the memory access mechanism (as @Der Luftmensch mentioned): with horizontal flip, it should be faster because accessing matrix's elements row by row is faster than column by column. My reproduced results when running your code on my machine (Duo Core 2x2.4 Ghz, OpenCV 3 with IPP no OpenCL, VS 2013 64 bit) are different from yours: yours:

Image 1 (500x800): (500x800):

  • flipVert process time (averaged for 500 runs): 0.66 ms ms
  • flipHoriz process time (averaged for 500 runs): 0.43 ms ms

Image 2 (500x500): (500x500):

  • flipVert process time (averaged for 500 runs): 0.66 ms ms
  • flipHoriz process time (averaged for 500 runs): 0.25 ms ms

Image 2 (800x500): 3 (800x500):

  • flipVert process time (averaged for 500 runs): 0.74 ms ms
  • flipHoriz process time (averaged for 500 runs): 0.37 ms

    ms

IMO, the flip function's performance is depend on several factors: + factors:

  • The OpenCV build: because OpenCV can be built with OpenCL support, and IPP support, so when running, your program can call the normal version (no OpenCL or IPP support), or the OpenCL version, or the IPP version. + version.
  • The image resolution: if the width is much larger than then the height (or vice versa) then the result is different. + different.
  • And the memory access mechanism (as @Der Luftmensch mentioned): with horizontal flip, it should be faster because accessing matrix's elements row by row is faster than column by column. column.

My reproduced results when running your code on my machine (Duo Core 2x2.4 Ghz, OpenCV 3 with IPP no OpenCL, VS 2013 64 bit) are different from yours:

Image 1 (500x800):

  • flipVert process time (averaged for 500 runs): 0.66 ms
  • flipHoriz process time (averaged for 500 runs): 0.43 ms

Image 2 (500x500):

  • flipVert process time (averaged for 500 runs): 0.66 ms
  • flipHoriz process time (averaged for 500 runs): 0.25 ms

Image 3 (800x500):

  • flipVert process time (averaged for 500 runs): 0.74 ms
  • flipHoriz process time (averaged for 500 runs): 0.37 ms