main_contour.cpp
Go to the documentation of this file.
1 #include <cstdio>
2 #include <stdlib.h>
3 #include <iostream>
4 #include <string>
5 
6 #include <opencv/cv.h>
7 #include <opencv/highgui.h>
8 #include "tuw_utils/contour.h"
9 
10 
11 
12 int main(int argc, char *argv[]) {
13  if ( argc != 2 ) {
14  printf ( "usage: %s <image>\n", argv[0] );
15  return 1;
16  }
17  printf ( "%s\n", argv[1] );
18 
19  cv::Mat imgGray = cv::imread(argv[1], 0);
20  cv::Mat imgGauss, imgCanny, imgLinkedEdges(imgGray.rows, imgGray.cols, CV_8UC3);
21  cv::namedWindow("img",1);
22  cv::namedWindow("canny",1);
23  cv::namedWindow("linked_edges",1);
24  V4R::Contour el;
25  el.Init(imgGray.cols, imgGray.rows);
26 
27 
28  do {
29  cv::GaussianBlur(imgGray, imgGauss, cv::Size(7,7), 1.5, 1.5);
30  cv::Canny(imgGauss, imgCanny, 0, 30, 3);
31  el.Perform(imgCanny.data, V4R::Contour::MODE_SIMPLE);
32  el.Draw(imgLinkedEdges.data);
33  cv::imshow("img", imgGray);
34  cv::imshow("canny", imgCanny);
35  cv::imshow("linked_edges", imgLinkedEdges);
36  } while (cv::waitKey(30) < 0) ;
37  // the camera will be deinitialized automatically in VideoCapture destructor
38  return 0;
39 }
40 
void Canny(const cv::Mat &image, cv::Mat &edges, cv::Mat &gradient, cv::Mat &direction, cv::Mat &sobel_dx, cv::Mat &sobel_dy, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false)
Definition: canny.cpp:363
int main(int argc, char *argv[])


tuw_ellipses
Author(s): Markus Bader
autogenerated on Mon Jun 10 2019 15:42:10