main_contour.cpp
Go to the documentation of this file.
00001 #include <cstdio>
00002 #include <stdlib.h>
00003 #include <iostream>
00004 #include <string>
00005 
00006 #include <opencv/cv.h>
00007 #include <opencv/highgui.h>
00008 #include "tuw_utils/contour.h"
00009 
00010 
00011 
00012 int main(int argc, char *argv[]) {
00013     if ( argc != 2 ) {
00014         printf ( "usage: %s <image>\n", argv[0] );
00015         return 1;
00016     }
00017     printf ( "%s\n", argv[1] );
00018 
00019     cv::Mat imgGray = cv::imread(argv[1], 0);
00020     cv::Mat imgGauss, imgCanny, imgLinkedEdges(imgGray.rows, imgGray.cols, CV_8UC3);
00021     cv::namedWindow("img",1);
00022     cv::namedWindow("canny",1);
00023     cv::namedWindow("linked_edges",1);
00024     V4R::Contour el;
00025     el.Init(imgGray.cols, imgGray.rows);
00026 
00027 
00028     do {
00029         cv::GaussianBlur(imgGray, imgGauss, cv::Size(7,7), 1.5, 1.5);
00030         cv::Canny(imgGauss, imgCanny, 0, 30, 3);
00031         el.Perform(imgCanny.data, V4R::Contour::MODE_SIMPLE);
00032         el.Draw(imgLinkedEdges.data);
00033         cv::imshow("img", imgGray);
00034         cv::imshow("canny", imgCanny);
00035         cv::imshow("linked_edges", imgLinkedEdges);
00036     } while (cv::waitKey(30) < 0) ;
00037     // the camera will be deinitialized automatically in VideoCapture destructor
00038     return 0;
00039 }
00040 


tuw_ellipses
Author(s):
autogenerated on Sun May 29 2016 02:50:24