Make imgproc.hpp independent from C API
This commit is contained in:
@@ -271,7 +271,7 @@ int main( int argc, char** argv )
|
||||
{
|
||||
vector<Point2f> ptvec;
|
||||
imageSize = view.size();
|
||||
cvtColor(view, viewGray, CV_BGR2GRAY);
|
||||
cvtColor(view, viewGray, COLOR_BGR2GRAY);
|
||||
bool found = findChessboardCorners( view, boardSize, ptvec, CV_CALIB_CB_ADAPTIVE_THRESH );
|
||||
|
||||
drawChessboardCorners( view, boardSize, Mat(ptvec), found );
|
||||
@@ -359,7 +359,7 @@ int main( int argc, char** argv )
|
||||
continue;
|
||||
|
||||
Mat rview = canvas.colRange(k2*imageSize.width, (k2+1)*imageSize.width);
|
||||
remap(view, rview, map1[k1], map2[k1], CV_INTER_LINEAR);
|
||||
remap(view, rview, map1[k1], map2[k1], INTER_LINEAR);
|
||||
}
|
||||
printf("%s %s %s\n", imageList[i*3].c_str(), imageList[i*3+1].c_str(), imageList[i*3+2].c_str());
|
||||
resize( canvas, small_canvas, Size(1500, 1500/3) );
|
||||
|
@@ -509,7 +509,7 @@ static void build3dmodel( const Ptr<FeatureDetector>& detector,
|
||||
for( size_t i = 0; i < nimages; i++ )
|
||||
{
|
||||
Mat img = imread(imageList[i], 1), gray;
|
||||
cvtColor(img, gray, CV_BGR2GRAY);
|
||||
cvtColor(img, gray, COLOR_BGR2GRAY);
|
||||
|
||||
vector<KeyPoint> keypoints;
|
||||
detector->detect(gray, keypoints);
|
||||
|
@@ -462,7 +462,7 @@ int main( int argc, char** argv )
|
||||
flip( view, view, 0 );
|
||||
|
||||
vector<Point2f> pointbuf;
|
||||
cvtColor(view, viewGray, CV_BGR2GRAY);
|
||||
cvtColor(view, viewGray, COLOR_BGR2GRAY);
|
||||
|
||||
bool found;
|
||||
switch( pattern )
|
||||
|
@@ -41,7 +41,7 @@ int main( int argc, const char** argv )
|
||||
return -1;
|
||||
}
|
||||
Mat cimg;
|
||||
cvtColor(img, cimg, CV_GRAY2BGR);
|
||||
cvtColor(img, cimg, COLOR_GRAY2BGR);
|
||||
|
||||
// if the image and the template are not edge maps but normal grayscale images,
|
||||
// you might want to uncomment the lines below to produce the maps. You can also
|
||||
|
@@ -144,7 +144,7 @@ static int test_FaceDetector(int argc, char *argv[])
|
||||
LOGD("\n\nSTEP n=%d from prev step %f ms\n", n, t_ms);
|
||||
m=images[n-1];
|
||||
CV_Assert(! m.empty());
|
||||
cvtColor(m, gray, CV_BGR2GRAY);
|
||||
cvtColor(m, gray, COLOR_BGR2GRAY);
|
||||
|
||||
fd.process(gray);
|
||||
|
||||
|
@@ -7,10 +7,10 @@
|
||||
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;
|
||||
@@ -31,8 +31,8 @@ static void onTrackbar( int, void* )
|
||||
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;
|
||||
|
||||
@@ -140,17 +140,17 @@ int main( int argc, const char** argv )
|
||||
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' )
|
||||
@@ -162,18 +162,18 @@ int main( int argc, const char** argv )
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ int main( int argc, const char** argv )
|
||||
return -1;
|
||||
}
|
||||
cedge.create(image.size(), image.type());
|
||||
cvtColor(image, gray, CV_BGR2GRAY);
|
||||
cvtColor(image, gray, COLOR_BGR2GRAY);
|
||||
|
||||
// Create a window
|
||||
namedWindow("Edge map", 1);
|
||||
|
@@ -41,7 +41,7 @@ static void onMouse( int event, int x, int y, int, void* )
|
||||
int lo = ffillMode == 0 ? 0 : loDiff;
|
||||
int up = ffillMode == 0 ? 0 : upDiff;
|
||||
int flags = connectivity + (newMaskVal << 8) +
|
||||
(ffillMode == 1 ? CV_FLOODFILL_FIXED_RANGE : 0);
|
||||
(ffillMode == 1 ? FLOODFILL_FIXED_RANGE : 0);
|
||||
int b = (unsigned)theRNG() & 255;
|
||||
int g = (unsigned)theRNG() & 255;
|
||||
int r = (unsigned)theRNG() & 255;
|
||||
@@ -53,7 +53,7 @@ static void onMouse( int event, int x, int y, int, void* )
|
||||
|
||||
if( useMask )
|
||||
{
|
||||
threshold(mask, mask, 1, 128, CV_THRESH_BINARY);
|
||||
threshold(mask, mask, 1, 128, THRESH_BINARY);
|
||||
area = floodFill(dst, mask, seed, newVal, &ccomp, Scalar(lo, lo, lo),
|
||||
Scalar(up, up, up), flags);
|
||||
imshow( "mask", mask );
|
||||
@@ -81,7 +81,7 @@ int main( int argc, char** argv )
|
||||
}
|
||||
help();
|
||||
image0.copyTo(image);
|
||||
cvtColor(image0, gray, CV_BGR2GRAY);
|
||||
cvtColor(image0, gray, COLOR_BGR2GRAY);
|
||||
mask.create(image0.rows+2, image0.cols+2, CV_8UC1);
|
||||
|
||||
namedWindow( "image", 0 );
|
||||
@@ -106,7 +106,7 @@ int main( int argc, char** argv )
|
||||
if( isColor )
|
||||
{
|
||||
cout << "Grayscale mode is set\n";
|
||||
cvtColor(image0, gray, CV_BGR2GRAY);
|
||||
cvtColor(image0, gray, COLOR_BGR2GRAY);
|
||||
mask = Scalar::all(0);
|
||||
isColor = false;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ int main( int argc, char** argv )
|
||||
case 'r':
|
||||
cout << "Original image is restored\n";
|
||||
image0.copyTo(image);
|
||||
cvtColor(image, gray, CV_BGR2GRAY);
|
||||
cvtColor(image, gray, COLOR_BGR2GRAY);
|
||||
mask = Scalar::all(0);
|
||||
break;
|
||||
case 's':
|
||||
|
@@ -64,7 +64,7 @@ void processImage(int /*h*/, void*)
|
||||
vector<vector<Point> > contours;
|
||||
Mat bimage = image >= sliderPos;
|
||||
|
||||
findContours(bimage, contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);
|
||||
findContours(bimage, contours, RETR_LIST, CHAIN_APPROX_NONE);
|
||||
|
||||
Mat cimage = Mat::zeros(bimage.size(), CV_8UC3);
|
||||
|
||||
|
@@ -27,10 +27,10 @@ int main(int argc, char** argv)
|
||||
|
||||
Mat cimg;
|
||||
medianBlur(img, img, 5);
|
||||
cvtColor(img, cimg, CV_GRAY2BGR);
|
||||
cvtColor(img, cimg, COLOR_GRAY2BGR);
|
||||
|
||||
vector<Vec3f> circles;
|
||||
HoughCircles(img, circles, CV_HOUGH_GRADIENT, 1, 10,
|
||||
HoughCircles(img, circles, HOUGH_GRADIENT, 1, 10,
|
||||
100, 30, 1, 30 // change the last two parameters
|
||||
// (min_radius & max_radius) to detect larger circles
|
||||
);
|
||||
|
@@ -27,7 +27,7 @@ int main(int argc, char** argv)
|
||||
|
||||
Mat dst, cdst;
|
||||
Canny(src, dst, 50, 200, 3);
|
||||
cvtColor(dst, cdst, CV_GRAY2BGR);
|
||||
cvtColor(dst, cdst, COLOR_GRAY2BGR);
|
||||
|
||||
#if 0
|
||||
vector<Vec2f> lines;
|
||||
|
@@ -49,7 +49,7 @@ int main( int argc, char** argv )
|
||||
return -1;
|
||||
|
||||
Mat img_yuv;
|
||||
cvtColor(img, img_yuv, CV_BGR2YCrCb); // convert image to YUV color space. The output image will be created automatically
|
||||
cvtColor(img, img_yuv, COLOR_BGR2YCrCb); // convert image to YUV color space. The output image will be created automatically
|
||||
|
||||
vector<Mat> planes; // Vector is template vector class, similar to STL's vector. It can store matrices too.
|
||||
split(img_yuv, planes); // split the image into separate color planes
|
||||
@@ -107,7 +107,7 @@ int main( int argc, char** argv )
|
||||
// now merge the results back
|
||||
merge(planes, img_yuv);
|
||||
// and produce the output RGB image
|
||||
cvtColor(img_yuv, img, CV_YCrCb2BGR);
|
||||
cvtColor(img_yuv, img, COLOR_YCrCb2BGR);
|
||||
|
||||
// this is counterpart for cvNamedWindow
|
||||
namedWindow("image with grain", CV_WINDOW_AUTOSIZE);
|
||||
|
@@ -17,8 +17,10 @@ static void help()
|
||||
"./laplace [camera #, default 0]\n" << endl;
|
||||
}
|
||||
|
||||
enum {GAUSSIAN, BLUR, MEDIAN};
|
||||
|
||||
int sigma = 3;
|
||||
int smoothType = CV_GAUSSIAN;
|
||||
int smoothType = GAUSSIAN;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
@@ -63,9 +65,9 @@ int main( int argc, char** argv )
|
||||
break;
|
||||
|
||||
int ksize = (sigma*5)|1;
|
||||
if(smoothType == CV_GAUSSIAN)
|
||||
if(smoothType == GAUSSIAN)
|
||||
GaussianBlur(frame, smoothed, Size(ksize, ksize), sigma, sigma);
|
||||
else if(smoothType == CV_BLUR)
|
||||
else if(smoothType == BLUR)
|
||||
blur(frame, smoothed, Size(ksize, ksize));
|
||||
else
|
||||
medianBlur(frame, smoothed, ksize);
|
||||
@@ -76,7 +78,7 @@ int main( int argc, char** argv )
|
||||
|
||||
int c = waitKey(30);
|
||||
if( c == ' ' )
|
||||
smoothType = smoothType == CV_GAUSSIAN ? CV_BLUR : smoothType == CV_BLUR ? CV_MEDIAN : CV_GAUSSIAN;
|
||||
smoothType = smoothType == GAUSSIAN ? BLUR : smoothType == BLUR ? MEDIAN : GAUSSIAN;
|
||||
if( c == 'q' || c == 'Q' || (c & 255) == 27 )
|
||||
break;
|
||||
}
|
||||
|
@@ -37,9 +37,9 @@ static void OpenClose(int, void*)
|
||||
int an = n > 0 ? n : -n;
|
||||
Mat element = getStructuringElement(element_shape, Size(an*2+1, an*2+1), Point(an, an) );
|
||||
if( n < 0 )
|
||||
morphologyEx(src, dst, CV_MOP_OPEN, element);
|
||||
morphologyEx(src, dst, MORPH_OPEN, element);
|
||||
else
|
||||
morphologyEx(src, dst, CV_MOP_CLOSE, element);
|
||||
morphologyEx(src, dst, MORPH_CLOSE, element);
|
||||
imshow("Open/Close",dst);
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,7 @@ int main(int, char* [])
|
||||
do
|
||||
{
|
||||
video >> frame;
|
||||
cvtColor(frame, curr, CV_RGB2GRAY);
|
||||
cvtColor(frame, curr, COLOR_RGB2GRAY);
|
||||
|
||||
if(prev.empty())
|
||||
{
|
||||
|
@@ -125,8 +125,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
Mat grayImage0, grayImage1, depthFlt0, depthFlt1/*in meters*/;
|
||||
cvtColor( colorImage0, grayImage0, CV_BGR2GRAY );
|
||||
cvtColor( colorImage1, grayImage1, CV_BGR2GRAY );
|
||||
cvtColor( colorImage0, grayImage0, COLOR_BGR2GRAY );
|
||||
cvtColor( colorImage1, grayImage1, COLOR_BGR2GRAY );
|
||||
depth0.convertTo( depthFlt0, CV_32FC1, 1./1000 );
|
||||
depth1.convertTo( depthFlt1, CV_32FC1, 1./1000 );
|
||||
|
||||
|
@@ -30,7 +30,7 @@ static void refineSegments(const Mat& img, Mat& mask, Mat& dst)
|
||||
erode(temp, temp, Mat(), Point(-1,-1), niters*2);
|
||||
dilate(temp, temp, Mat(), Point(-1,-1), niters);
|
||||
|
||||
findContours( temp, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE );
|
||||
findContours( temp, contours, hierarchy, RETR_CCOMP, CHAIN_APPROX_SIMPLE );
|
||||
|
||||
dst = Mat::zeros(img.size(), CV_8UC3);
|
||||
|
||||
|
@@ -83,7 +83,7 @@ static void findSquares( const Mat& image, vector<vector<Point> >& squares )
|
||||
}
|
||||
|
||||
// find contours and store them all as a list
|
||||
findContours(gray, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);
|
||||
findContours(gray, contours, RETR_LIST, CHAIN_APPROX_SIMPLE);
|
||||
|
||||
vector<Point> approx;
|
||||
|
||||
|
@@ -121,7 +121,7 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, bool useCalibrated=
|
||||
{
|
||||
cout << filename << endl;
|
||||
Mat cimg, cimg1;
|
||||
cvtColor(img, cimg, CV_GRAY2BGR);
|
||||
cvtColor(img, cimg, COLOR_GRAY2BGR);
|
||||
drawChessboardCorners(cimg, boardSize, corners, found);
|
||||
double sf = 640./MAX(img.rows, img.cols);
|
||||
resize(cimg, cimg1, Size(), sf, sf);
|
||||
@@ -304,10 +304,10 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, bool useCalibrated=
|
||||
for( k = 0; k < 2; k++ )
|
||||
{
|
||||
Mat img = imread(goodImageList[i*2+k], 0), rimg, cimg;
|
||||
remap(img, rimg, rmap[k][0], rmap[k][1], CV_INTER_LINEAR);
|
||||
cvtColor(rimg, cimg, CV_GRAY2BGR);
|
||||
remap(img, rimg, rmap[k][0], rmap[k][1], INTER_LINEAR);
|
||||
cvtColor(rimg, cimg, COLOR_GRAY2BGR);
|
||||
Mat canvasPart = !isVerticalStereo ? canvas(Rect(w*k, 0, w, h)) : canvas(Rect(0, h*k, w, h));
|
||||
resize(cimg, canvasPart, canvasPart.size(), 0, 0, CV_INTER_AREA);
|
||||
resize(cimg, canvasPart, canvasPart.size(), 0, 0, INTER_AREA);
|
||||
if( useCalibrated )
|
||||
{
|
||||
Rect vroi(cvRound(validRoi[k].x*sf), cvRound(validRoi[k].y*sf),
|
||||
|
@@ -31,7 +31,7 @@ int main( int, char** argv )
|
||||
}
|
||||
|
||||
/// Convert to grayscale
|
||||
cvtColor( src, src, CV_BGR2GRAY );
|
||||
cvtColor( src, src, COLOR_BGR2GRAY );
|
||||
|
||||
/// Apply Histogram Equalization
|
||||
equalizeHist( src, dst );
|
||||
|
@@ -74,7 +74,7 @@ void MatchingMethod( int, void* )
|
||||
|
||||
|
||||
/// For SQDIFF and SQDIFF_NORMED, the best matches are lower values. For all the other methods, the higher the better
|
||||
if( match_method == CV_TM_SQDIFF || match_method == CV_TM_SQDIFF_NORMED )
|
||||
if( match_method == TM_SQDIFF || match_method == TM_SQDIFF_NORMED )
|
||||
{ matchLoc = minLoc; }
|
||||
else
|
||||
{ matchLoc = maxLoc; }
|
||||
|
@@ -28,7 +28,7 @@ int main( int, char** argv )
|
||||
/// Read the image
|
||||
src = imread( argv[1], 1 );
|
||||
/// Transform it to HSV
|
||||
cvtColor( src, hsv, CV_BGR2HSV );
|
||||
cvtColor( src, hsv, COLOR_BGR2HSV );
|
||||
|
||||
/// Use only the Hue value
|
||||
hue.create( hsv.size(), hsv.depth() );
|
||||
|
@@ -31,7 +31,7 @@ int main( int, char** argv )
|
||||
/// Read the image
|
||||
src = imread( argv[1], 1 );
|
||||
/// Transform it to HSV
|
||||
cvtColor( src, hsv, CV_BGR2HSV );
|
||||
cvtColor( src, hsv, COLOR_BGR2HSV );
|
||||
|
||||
/// Show the image
|
||||
namedWindow( window_image, CV_WINDOW_AUTOSIZE );
|
||||
|
@@ -33,9 +33,9 @@ int main( int argc, char** argv )
|
||||
src_test2 = imread( argv[3], 1 );
|
||||
|
||||
/// Convert to HSV
|
||||
cvtColor( src_base, hsv_base, CV_BGR2HSV );
|
||||
cvtColor( src_test1, hsv_test1, CV_BGR2HSV );
|
||||
cvtColor( src_test2, hsv_test2, CV_BGR2HSV );
|
||||
cvtColor( src_base, hsv_base, COLOR_BGR2HSV );
|
||||
cvtColor( src_test1, hsv_test1, COLOR_BGR2HSV );
|
||||
cvtColor( src_test2, hsv_test2, COLOR_BGR2HSV );
|
||||
|
||||
hsv_half_down = hsv_base( Range( hsv_base.rows/2, hsv_base.rows - 1 ), Range( 0, hsv_base.cols - 1 ) );
|
||||
|
||||
|
@@ -37,7 +37,7 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert the image to Gray
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_RGB2GRAY );
|
||||
|
||||
/// Create a window to display results
|
||||
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
|
||||
|
@@ -58,7 +58,7 @@ int main( int, char** argv )
|
||||
dst.create( src.size(), src.type() );
|
||||
|
||||
/// Convert the image to grayscale
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
|
||||
/// Create a window
|
||||
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
|
||||
|
@@ -26,7 +26,7 @@ int main(int, char** argv)
|
||||
{ return -1; }
|
||||
|
||||
/// Convert it to gray
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
|
||||
/// Reduce the noise so we avoid false circle detection
|
||||
GaussianBlur( src_gray, src_gray, Size(9, 9), 2, 2 );
|
||||
@@ -34,7 +34,7 @@ int main(int, char** argv)
|
||||
vector<Vec3f> circles;
|
||||
|
||||
/// Apply the Hough Transform to find the circles
|
||||
HoughCircles( src_gray, circles, CV_HOUGH_GRADIENT, 1, src_gray.rows/8, 200, 100, 0, 0 );
|
||||
HoughCircles( src_gray, circles, HOUGH_GRADIENT, 1, src_gray.rows/8, 200, 100, 0, 0 );
|
||||
|
||||
/// Draw the circles detected
|
||||
for( size_t i = 0; i < circles.size(); i++ )
|
||||
|
@@ -46,7 +46,7 @@ int main( int, char** argv )
|
||||
}
|
||||
|
||||
/// Pass the image to gray
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_RGB2GRAY );
|
||||
|
||||
/// Apply Canny edge detector
|
||||
Canny( src_gray, edges, 50, 200, 3 );
|
||||
@@ -85,7 +85,7 @@ void help()
|
||||
void Standard_Hough( int, void* )
|
||||
{
|
||||
vector<Vec2f> s_lines;
|
||||
cvtColor( edges, standard_hough, CV_GRAY2BGR );
|
||||
cvtColor( edges, standard_hough, COLOR_GRAY2BGR );
|
||||
|
||||
/// 1. Use Standard Hough Transform
|
||||
HoughLines( edges, s_lines, 1, CV_PI/180, min_threshold + s_trackbar, 0, 0 );
|
||||
@@ -112,7 +112,7 @@ void Standard_Hough( int, void* )
|
||||
void Probabilistic_Hough( int, void* )
|
||||
{
|
||||
vector<Vec4i> p_lines;
|
||||
cvtColor( edges, probabilistic_hough, CV_GRAY2BGR );
|
||||
cvtColor( edges, probabilistic_hough, COLOR_GRAY2BGR );
|
||||
|
||||
/// 2. Use Probabilistic Hough Transform
|
||||
HoughLinesP( edges, p_lines, 1, CV_PI/180, min_threshold + p_trackbar, 30, 10 );
|
||||
|
@@ -34,7 +34,7 @@ int main( int, char** argv )
|
||||
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT );
|
||||
|
||||
/// Convert the image to grayscale
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_RGB2GRAY );
|
||||
|
||||
/// Create window
|
||||
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
|
||||
|
@@ -47,7 +47,7 @@ int main( int, char** argv )
|
||||
|
||||
/// Update map_x & map_y. Then apply remap
|
||||
update_map();
|
||||
remap( src, dst, map_x, map_y, CV_INTER_LINEAR, BORDER_CONSTANT, Scalar(0, 0, 0) );
|
||||
remap( src, dst, map_x, map_y, INTER_LINEAR, BORDER_CONSTANT, Scalar(0, 0, 0) );
|
||||
|
||||
// Display results
|
||||
imshow( remap_window, dst );
|
||||
|
@@ -33,7 +33,7 @@ int main( int, char** argv )
|
||||
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT );
|
||||
|
||||
/// Convert it to gray
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_RGB2GRAY );
|
||||
|
||||
/// Create window
|
||||
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
|
||||
|
@@ -30,7 +30,7 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert image to gray and blur it
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
blur( src_gray, src_gray, Size(3,3) );
|
||||
|
||||
/// Create Window
|
||||
@@ -57,7 +57,7 @@ void thresh_callback(int, void* )
|
||||
/// Detect edges using canny
|
||||
Canny( src_gray, canny_output, thresh, thresh*2, 3 );
|
||||
/// Find contours
|
||||
findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
|
||||
findContours( canny_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );
|
||||
|
||||
/// Draw contours
|
||||
Mat drawing = Mat::zeros( canny_output.size(), CV_8UC3 );
|
||||
|
@@ -30,7 +30,7 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert image to gray and blur it
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
blur( src_gray, src_gray, Size(3,3) );
|
||||
|
||||
/// Create Window
|
||||
@@ -57,7 +57,7 @@ void thresh_callback(int, void* )
|
||||
/// Detect edges using Threshold
|
||||
threshold( src_gray, threshold_output, thresh, 255, THRESH_BINARY );
|
||||
/// Find contours
|
||||
findContours( threshold_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
|
||||
findContours( threshold_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );
|
||||
|
||||
/// Approximate contours to polygons + get bounding rects and circles
|
||||
vector<vector<Point> > contours_poly( contours.size() );
|
||||
|
@@ -30,7 +30,7 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert image to gray and blur it
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
blur( src_gray, src_gray, Size(3,3) );
|
||||
|
||||
/// Create Window
|
||||
@@ -57,7 +57,7 @@ void thresh_callback(int, void* )
|
||||
/// Detect edges using Threshold
|
||||
threshold( src_gray, threshold_output, thresh, 255, THRESH_BINARY );
|
||||
/// Find contours
|
||||
findContours( threshold_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
|
||||
findContours( threshold_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );
|
||||
|
||||
/// Find the rotated rectangles and ellipses for each contour
|
||||
vector<RotatedRect> minRect( contours.size() );
|
||||
|
@@ -30,7 +30,7 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert image to gray and blur it
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
blur( src_gray, src_gray, Size(3,3) );
|
||||
|
||||
/// Create Window
|
||||
@@ -59,7 +59,7 @@ void thresh_callback(int, void* )
|
||||
threshold( src_gray, threshold_output, thresh, 255, THRESH_BINARY );
|
||||
|
||||
/// Find contours
|
||||
findContours( threshold_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
|
||||
findContours( threshold_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );
|
||||
|
||||
/// Find the convex hull object for each contour
|
||||
vector<vector<Point> >hull( contours.size() );
|
||||
|
@@ -30,7 +30,7 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert image to gray and blur it
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
blur( src_gray, src_gray, Size(3,3) );
|
||||
|
||||
/// Create Window
|
||||
@@ -57,7 +57,7 @@ void thresh_callback(int, void* )
|
||||
/// Detect edges using canny
|
||||
Canny( src_gray, canny_output, thresh, thresh*2, 3 );
|
||||
/// Find contours
|
||||
findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
|
||||
findContours( canny_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );
|
||||
|
||||
/// Get the moments
|
||||
vector<Moments> mu(contours.size() );
|
||||
|
@@ -40,7 +40,7 @@ int main( int, char** argv )
|
||||
{
|
||||
/// Load source image and convert it to gray
|
||||
src = imread( argv[1], 1 );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
|
||||
/// Set some parameters
|
||||
int blockSize = 3; int apertureSize = 3;
|
||||
|
@@ -31,7 +31,7 @@ int main( int, char** argv )
|
||||
{
|
||||
/// Load source image and convert it to gray
|
||||
src = imread( argv[1], 1 );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
|
||||
/// Create a window and a trackbar
|
||||
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
|
||||
|
@@ -32,7 +32,7 @@ int main( int, char** argv )
|
||||
{
|
||||
/// Load source image and convert it to gray
|
||||
src = imread( argv[1], 1 );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
|
||||
/// Create Window
|
||||
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
|
||||
|
@@ -32,7 +32,7 @@ int main( int, char** argv )
|
||||
{
|
||||
/// Load source image and convert it to gray
|
||||
src = imread( argv[1], 1 );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
|
||||
/// Create Window
|
||||
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
|
||||
|
@@ -291,7 +291,7 @@ int main(int argc, char* argv[])
|
||||
if( s.calibrationPattern == Settings::CHESSBOARD)
|
||||
{
|
||||
Mat viewGray;
|
||||
cvtColor(view, viewGray, CV_BGR2GRAY);
|
||||
cvtColor(view, viewGray, COLOR_BGR2GRAY);
|
||||
cornerSubPix( viewGray, pointBuf, Size(11,11),
|
||||
Size(-1,-1), TermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 30, 0.1 ));
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ int main( int argc, char** argv )
|
||||
|
||||
// convert image to YUV color space. The output image will be created automatically.
|
||||
Mat I_YUV;
|
||||
cvtColor(I, I_YUV, CV_BGR2YCrCb);
|
||||
cvtColor(I, I_YUV, COLOR_BGR2YCrCb);
|
||||
|
||||
vector<Mat> planes; // Use the STL's vector structure to store multiple Mat objects
|
||||
split(I_YUV, planes); // split the image into separate color planes (Y U V)
|
||||
@@ -115,7 +115,7 @@ int main( int argc, char** argv )
|
||||
|
||||
|
||||
merge(planes, I_YUV); // now merge the results back
|
||||
cvtColor(I_YUV, I, CV_YCrCb2BGR); // and produce the output RGB image
|
||||
cvtColor(I_YUV, I, COLOR_YCrCb2BGR); // and produce the output RGB image
|
||||
|
||||
|
||||
namedWindow("image with grain", CV_WINDOW_AUTOSIZE); // use this to create images
|
||||
|
@@ -68,7 +68,7 @@ void detectAndDisplay( Mat frame )
|
||||
std::vector<Rect> faces;
|
||||
Mat frame_gray;
|
||||
|
||||
cvtColor( frame, frame_gray, CV_BGR2GRAY );
|
||||
cvtColor( frame, frame_gray, COLOR_BGR2GRAY );
|
||||
equalizeHist( frame_gray, frame_gray );
|
||||
//-- Detect faces
|
||||
face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) );
|
||||
|
@@ -68,7 +68,7 @@ void detectAndDisplay( Mat frame )
|
||||
std::vector<Rect> faces;
|
||||
Mat frame_gray;
|
||||
|
||||
cvtColor( frame, frame_gray, CV_BGR2GRAY );
|
||||
cvtColor( frame, frame_gray, COLOR_BGR2GRAY );
|
||||
equalizeHist( frame_gray, frame_gray );
|
||||
|
||||
//-- Detect faces
|
||||
|
@@ -52,7 +52,7 @@ namespace
|
||||
if (frame.empty())
|
||||
break;
|
||||
cv::Mat gray;
|
||||
cv::cvtColor(frame,gray,CV_RGB2GRAY);
|
||||
cv::cvtColor(frame,gray, COLOR_RGB2GRAY);
|
||||
vector<String> codes;
|
||||
Mat corners;
|
||||
findDataMatrix(gray, codes, corners);
|
||||
|
@@ -161,7 +161,7 @@ int main(int ac, char ** av)
|
||||
if (frame.empty())
|
||||
break;
|
||||
|
||||
cvtColor(frame, gray, CV_RGB2GRAY);
|
||||
cvtColor(frame, gray, COLOR_RGB2GRAY);
|
||||
|
||||
detector.detect(gray, query_kpts); //Find interest points
|
||||
|
||||
|
@@ -59,8 +59,8 @@ int main( int argc, char** argv )
|
||||
namedWindow( "image", 1 );
|
||||
|
||||
img0.copyTo(img);
|
||||
cvtColor(img, markerMask, CV_BGR2GRAY);
|
||||
cvtColor(markerMask, imgGray, CV_GRAY2BGR);
|
||||
cvtColor(img, markerMask, COLOR_BGR2GRAY);
|
||||
cvtColor(markerMask, imgGray, COLOR_GRAY2BGR);
|
||||
markerMask = Scalar::all(0);
|
||||
imshow( "image", img );
|
||||
setMouseCallback( "image", onMouse, 0 );
|
||||
@@ -85,7 +85,7 @@ int main( int argc, char** argv )
|
||||
vector<vector<Point> > contours;
|
||||
vector<Vec4i> hierarchy;
|
||||
|
||||
findContours(markerMask, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);
|
||||
findContours(markerMask, contours, hierarchy, RETR_CCOMP, CHAIN_APPROX_SIMPLE);
|
||||
|
||||
if( contours.empty() )
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user