You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|| Huck Wach on 2015-07-09 23:52
|| Priority: Normal
|| Affected: branch 'master' (3.0-dev)
|| Category: None
|| Tracker: Bug
|| Difficulty:
|| PR:
|| Platform: x64 / Linux
MSER slower in 3.0.0 than 2.4.X
The below simple code can be built with either 2.4.X or 3.0.0 by uncommenting or commenting the #define respectively. It simply opens an image file (I'll let you provide your own) and runs MSER on it. On both my Linux box and my Windows box I see that its 3-4X slower in 3.0.0 than 2.4.X. I have built both versions of OpenCV from source using cmake and stuck with the defaults...I have verified that the build settings are as close as they can be.
<pre>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2\features2d\features2d.hpp"
#include "opencv2\imgproc\imgproc.hpp"
#include <iostream>
#include <chrono>
#include <ctime>
#define USE249
using namespace std;
int main(int argc, char** argv)
{
std::cout << "OpenCV version: "
<< CV_MAJOR_VERSION << "."
<< CV_MINOR_VERSION << "."
<< CV_SUBMINOR_VERSION
<< std::endl;
cv::Mat im = cv::imread("C:/example.jpg", 1);
if (im.empty())
{
cout << "Cannot open image!" << endl;
return -1;
}
cv::Mat gray;
cv::cvtColor(im, gray, cv::COLOR_BGR2GRAY);
int mnArea = 40 * 40;
int mxArea = im.rows*im.cols*0.4;
std::vector< std::vector< cv::Point > > ptblobs;
std::vector<cv::Rect> bboxes;
std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now();
#ifndef USE249
cv::Ptr<cv::MSER> mser = cv::MSER::create(1, mnArea, mxArea, 0.25, 0.2);
mser->detectRegions(gray, ptblobs, bboxes);
#else
cv::MserFeatureDetector mser(1, mnArea, mxArea, 0.25, 0.2);
mser(gray, ptblobs);
#endif
end = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = end - start;
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
std::cout << "finished computation at " << std::ctime(&end_time)
<< "elapsed time: " << elapsed_seconds.count() << "s\n";
cv::namedWindow("image", cv::WINDOW_NORMAL);
cv::imshow("image", im);
cv::waitKey(0);
return 0;
}
</pre>
History
The text was updated successfully, but these errors were encountered:
Transferred from http://code.opencv.org/issues/4478
MSER slower in 3.0.0 than 2.4.X
History
The text was updated successfully, but these errors were encountered: