-#include "opencv2/imgproc/imgproc.hpp"
-#include "opencv2/highgui/highgui.hpp"
+#include <opencv2/core/utility.hpp>
+#include "opencv2/imgproc.hpp"
+#include "opencv2/highgui.hpp"
#include <stdio.h>
+using namespace std;
using namespace cv;
-int maskSize0 = CV_DIST_MASK_5;
+int maskSize0 = DIST_MASK_5;
int voronoiType = -1;
int edgeThresh = 100;
-int distType0 = CV_DIST_L1;
+int distType0 = DIST_L1;
// The output and temporary images
Mat gray;
Scalar(255,0,255)
};
- int maskSize = voronoiType >= 0 ? CV_DIST_MASK_5 : maskSize0;
- int distType = voronoiType >= 0 ? CV_DIST_L2 : distType0;
+ int maskSize = voronoiType >= 0 ? DIST_MASK_5 : maskSize0;
+ int distType = voronoiType >= 0 ? DIST_L2 : distType0;
Mat edge = gray >= edgeThresh, dist, labels, dist8u;
const char* keys =
{
- "{1| |stuff.jpg|input image file}"
+ "{@image |stuff.jpg|input image file}"
};
int main( int argc, const char** argv )
{
help();
CommandLineParser parser(argc, argv, keys);
- string filename = parser.get<string>("1");
+ string filename = parser.get<string>(0);
gray = imread(filename.c_str(), 0);
if(gray.empty())
{
voronoiType = -1;
if( c == 'c' || c == 'C' )
- distType0 = CV_DIST_C;
+ distType0 = DIST_C;
else if( c == '1' )
- distType0 = CV_DIST_L1;
+ distType0 = DIST_L1;
else if( c == '2' )
- distType0 = CV_DIST_L2;
+ distType0 = DIST_L2;
else if( c == '3' )
- maskSize0 = CV_DIST_MASK_3;
+ maskSize0 = DIST_MASK_3;
else if( c == '5' )
- maskSize0 = CV_DIST_MASK_5;
+ maskSize0 = DIST_MASK_5;
else if( c == '0' )
- maskSize0 = CV_DIST_MASK_PRECISE;
+ maskSize0 = DIST_MASK_PRECISE;
else if( c == 'v' )
voronoiType = 0;
else if( c == 'p' )
else if( voronoiType == 1 )
{
voronoiType = -1;
- maskSize0 = CV_DIST_MASK_3;
- distType0 = CV_DIST_C;
+ maskSize0 = DIST_MASK_3;
+ distType0 = DIST_C;
}
- else if( distType0 == CV_DIST_C )
- distType0 = CV_DIST_L1;
- else if( distType0 == CV_DIST_L1 )
- distType0 = CV_DIST_L2;
- else if( maskSize0 == CV_DIST_MASK_3 )
- maskSize0 = CV_DIST_MASK_5;
- else if( maskSize0 == CV_DIST_MASK_5 )
- maskSize0 = CV_DIST_MASK_PRECISE;
- else if( maskSize0 == CV_DIST_MASK_PRECISE )
+ else if( distType0 == DIST_C )
+ distType0 = DIST_L1;
+ else if( distType0 == DIST_L1 )
+ distType0 = DIST_L2;
+ else if( maskSize0 == DIST_MASK_3 )
+ maskSize0 = DIST_MASK_5;
+ else if( maskSize0 == DIST_MASK_5 )
+ maskSize0 = DIST_MASK_PRECISE;
+ else if( maskSize0 == DIST_MASK_PRECISE )
voronoiType = 0;
}
}