OPENCV2 realization of multi-picture road Signs Detection _ Computer Vision Big Job 2

Source: Internet
Author: User

Linefinder.h a blog post

Main.cpp

/*------------------------------------------------------------------------------------------*this file contains Material supporting Chapter 7 of the Cookbook:computer Vision programming using the OpenCV Library. by Robert Laganiere, Packt Publishing, the 2011.This program was free software; Permission is hereby granted to use, copy, modify, and distribute this source code, or portions thereof, for any purpose,  Without fee, subject to the restriction so the copyright notice may is removed or altered from any source or altered SOURCE distribution. The software is released on a as-is basis and without any warranties of any kind. In particular, the software are not guaranteed to being fault-tolerant or free from failure. The author disclaims all warranties with regard to this software, any use, and any consequent failure, is purely the RESPO Nsibility of the user. Copyright (C) 2010-2011 Robert laganiere, www.laganiere.name\*----------------------------------------------------- -------------------------------------*/#include <iostream> #include <vector> #include <opencv2/core/core.hpp>// #include <opencv2/imageproc/imageproc.hpp> #include <opencv2/highgui/highgui.hpp> #include <string > #include <sstream> #include "linefinder.h"//#include "Edgedetector.h" using namespace cv;using namespace std;      #define PI 3.1415926int Main () {StringStream ss; String str; for (int i=1;i<=80;i++) {str= "d:\\ University course \ \ Smart Technology 2-2\\ visual job \ \ Visual job \ \ Job 2014\\ job 2\\"//select f:\\ picture \ \ 5 pictures in S          S.clear ();          ss<<str;          ss<<i;          ss<< ". jpg";          ss>>str;  Mat Image=imread (str,1); Read input Image//mat image= imread ("1.jpg", 1); if (!image.data) return 0; /*namedwindow ("Original image"), Imshow ("Original image", image); */mat img=image (Rect (0.4*image.cols,0.58* Image.rows,0.4*image.cols,0.3*image.rows)); Mat contours; Canny (img,contours,80,100); Cv::mat Contoursinv;cv::threshold (CONTOURS,CONTOURSINV,128,255,CV:: THRESH_BINARY_INV);//Display the image of Contours/*cv::namedwindow ("Canny contours"); Cv::imshow ("Canny contours", CONTOURSINV) *///Create linefinder instancelinefinder ld;//Set probabilistic Hough parametersld.setlinelengthandgap ( Ld.setminvote (80,30);vector<vec4i> li= ld.findlines (contours); Ld.drawdetectedlines (IMG);/*namedWindow ( "HOUGHP"); Imshow ("HOUGHP", IMG), *//*namedwindow ("detected Lines with HOUGHP"), Imshow ("detected Lines with HOUGHP", image); */mat Imggry;cvtcolor (Image,imggry,cv_bgr2gray); Gaussianblur (Imggry,imggry,size (5,5), 1.5);vector<vec3f> circles; Houghcircles (Imggry, Circles, cv_hough_gradient, 2,//accumulator resolution (size of the IMAGE/2),//Minimum di Stance between-circles200,//Canny high threshold,//minimum number of votes 25, 50); Min and Max radiuscout << "Circles:" << circles.size () << endl;//Draw the Circlesvector<vec3f&gt ;:: Const_iterator itc= Circles.begin (); while (Itc!=circles.end ()) {Circle(Image, point (*ITC) [0], (*ITC) [1]),//Circle Centre (*ITC) [2],//Circle Radiusscalar (255),//color 2); THICKNESS++ITC;} Namedwindow (str); imshow (str,image);} Waitkey (); return 0;}


OPENCV2 realization of multi-picture road Signs Detection _ Computer Vision Big Job 2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.