Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Performance comparison of horizontal & vertical flipping

$
0
0
[cv::flip function](http://docs.opencv.org/master/d2/de8/group__core__array.html#gaca7be533e3dac7feb70fc60635adf441&gsc.tab=0) internally calls [flipHoriz](https://github.com/Itseez/opencv/blob/master/modules/core/src/copy.cpp#L561-L581) or [flipVert](https://github.com/Itseez/opencv/blob/master/modules/core/src/copy.cpp#L583-L642) functions. When i compared the passing time of vertical flipping and horizontal flipping with the code below i get following results. - flipVert process time (averaged for 500 runs): 0.286388 milliseconds. - flipHoriz process time (averaged for 500 runs): 1.09012 milliseconds. i thought that flipVert has different algorihtm (i did not understand deeper) and faster than flipHoriz . i wonder is it possible to apply flipVert's algorihtm to flipHoriz. **what is your remarks?** #include #include #include int main() { cv::Mat SrcImg = cv::imread("lena.jpg"); cv::Mat DstImg; const int times = 500; double t; t = (double)cv::getTickCount(); for (int i = 0; i < times; ++i) { flip(SrcImg, DstImg, 0); } t = 1000*((double)cv::getTickCount() - t)/cv::getTickFrequency(); t /= times; std::cout << "flipVert process time (averaged for "<< times << " runs): " << t << " milliseconds."<< std::endl; t = (double)cv::getTickCount(); for (int i = 0; i < times; ++i) { flip(SrcImg, DstImg, 1); } t = 1000*((double)cv::getTickCount() - t)/cv::getTickFrequency(); t /= times; std::cout << "flipHoriz process time (averaged for "<< times << " runs): " << t << " milliseconds."<< std::endl; return 0; }

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>