Created
          September 2, 2016 11:35 
        
      - 
      
 - 
        
Save mshabunin/862b6ff3da9721fd6ea20df694e3f06c to your computer and use it in GitHub Desktop.  
    medianBlur performance test
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include "opencv2/core.hpp" | |
| #include "opencv2/imgproc.hpp" | |
| #include "opencv2/imgcodecs.hpp" | |
| #include <iostream> | |
| using namespace cv; | |
| using namespace std; | |
| int main(int argc, char** argv) | |
| { | |
| string imageFileName = "test.png"; | |
| { | |
| Mat src = imread(imageFileName), out; | |
| TickMeter tick; tick.start(); | |
| medianBlur(src, out, 5); //70ms | |
| tick.stop(); | |
| cout << src.cols << " x " << src.rows << " (" << src.depth() << ", " << src.channels() << ")" | |
| << ": " << tick.getTimeMilli() << " ms" << endl; | |
| } | |
| { | |
| Mat src = imread(imageFileName, IMREAD_GRAYSCALE), out; | |
| TickMeter tick; tick.start(); | |
| medianBlur(src, out, 5); //3700ms | |
| tick.stop(); | |
| cout << src.cols << " x " << src.rows << " (" << src.depth() << ", " << src.channels() << ")" | |
| << ": " << tick.getTimeMilli() << " ms" << endl; | |
| } | |
| { | |
| Mat src = imread(imageFileName, IMREAD_GRAYSCALE), out; | |
| TickMeter tick; tick.start(); | |
| cvtColor(src, src, CV_GRAY2BGR); | |
| medianBlur(src, out, 5); //70ms | |
| cvtColor(out, out, CV_BGR2GRAY); //total process ~100ms | |
| tick.stop(); | |
| cout << src.cols << " x " << src.rows << " (" << src.depth() << ", " << src.channels() << ")" | |
| << ": " << tick.getTimeMilli() << " ms" << endl; | |
| } | |
| cout << cv::getBuildInformation() << endl; | |
| return 0; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment