Ask Your Question

Revision history [back]

Different run time for Morphological operations in OpenCV 2410 and OpenCV 310

Hello,

I'm running the same code for morphological "OPEN" operation as below:

include "opencv.hpp"

include <chrono>

using namespace cv;

void main() { Mat Image; Image = Mat::zeros(5000, 5000, CV_8UC3) ;

Mat element = getStructuringElement(MORPH_RECT, Size(1000, 1), Point(-1,-1));


auto begin = std::chrono::high_resolution_clock::now();
morphologyEx(Image, Image, MORPH_OPEN, element);
auto end = std::chrono::high_resolution_clock::now();
std::cout << std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin).count()/1000000 << "ms" << std::endl;

}

However, the same code runs very different in terms of runtime with OPENCV 2410 and OPENCV 310. (both 64 bit) In 2410 it takes ~500ms, but in 310 it akes more than 5 seconds! 2410 also outperforms the 310 for other different kernel sizes.

Would appreciate if someone has seen such a problem...

Thank you, Alex.