12-05-2015 04:09 PM
We're looking for a fast method to perform a horizontal/vertical flip to a 2D array of around 150 by 150 elements. At the moment, the array enters a for loop, and then the corresponding 1D vectors are flipped using Reverse 1D Array. The output of the for loop has the correct form, but we need to perform this operation on over 5 million images. The image flip is a huge bottleneck on the speed of the program. Any ideas as to a better way to perform a horizontal/vertical flip?
12-05-2015 05:14 PM
I need pictures.
Do mean
11 12 13 14
21 22 23 24
31 32 33 34
41 42 44 44
to ?
12-05-2015 05:35 PM - edited 12-05-2015 05:36 PM
Done right, this is a fast in-place operation. Did you calculate how many cpu clock cycles per element you are currently using, then decide if the speed can be improved at all. What is the datatype (U8, U32, etc.)
Show us your code, including the benchmarking and explain the operation. Just reversing rows will do nothing interesting in the vertical direction, but you are talking about "horizontal/vertical" so there has to be more than what you are saying.
One thing you could probably do is use a parallel FOR loop and process several images at once.
Where are the images coming from and where are they going? Do you read each one from disk and write it back later? Most likely the disk IO will be the bottleneck in this case.