Time series Identification code debug version 1

Source: Internet
Author: User

#include <iostream>//#include <stdio.h>#include <fstream>#include<iomanip>#include<opencv2/core/core.hpp>#include<opencv2/highgui/highgui.hpp>//#include <opencv2/ml/ml.hpp>//#include <opencv2/features2d/features2d.hpp>//#include <opencv2/objdetect.hpp>//#include <opencv2/gpu/gpu.hpp>#include<opencv2/imgproc/imgproc.hpp>#include<opencv2/objdetect/objdetect.hpp>#include<opencv2/xobjdetect/xobjdetect.hpp>using namespacestd;using namespaceCV;//FeatureevaluatorintMain () {/************************************************************************************ parameter Settings ******************** *****************************************************************/    //Some parameters:    intPositive_num = +; intNegative_num =9000; Vector<String>v_positive_img; Vector<String>v_negative_img; //first consider training 0    intTest_char =0; //positive cases and negative examples    stringAll_class_path ="c:\\users\\cong\\desktop\\ Research a real combat \ \ Project The time digital recognition in the image \\OCR\\result\\"; stringImg_txt;  for(inti =0; I <Ten; i++)    {        //Numeric to characterStringStream SS; SS<<i; stringTest_char_str =Ss.str (); Img_txt= All_class_path +"result"+ Test_char_str +". txt"; stringpath;        Ifstream Finpos (img_txt); if(Test_char = =i) {//vector<mat> channels; //n channels used to load a picture; not initialized yet.getline (finpos, path); //The number of pictures in the file should also be recorded, due to the data set, the number of 0~9, so you can consider not to do this first            intImg_num =0;//Turn path, the first line of characters into numbers, not yet complete             for(intj =0; J<positive_num && getline (finpos, path); J + +) {v_positive_img.push_back (path); //cout << path<<endl;            }        }        Else        {            //vector<mat> channels; //n channels used to load a picture; not initialized yet.getline (finpos, path); //The number of pictures in the file should also be recorded, due to the data set, the number of 0~9, so you can consider not to do this first            intImg_num =0;//Turn path, the first line of characters into numbers, not yet complete             for(intj =0; J<negative_num && getline (finpos, path); J + +) {v_negative_img.push_back (path); //cout << path << Endl;            }        }    }    //Training: Random Forest//do you need to adjust the number of positive and negative samples above? Cv::xobjdetect::icfdetectorparams Myicfdetctorparams;    Cv::xobjdetect::icfdetector Myicfdetector;    Myicfdetector.train (v_positive_img, v_negative_img, myicfdetctorparams); //test, scale problem? //Parameters//Mat img_test = imread ("c:\\users\\cong\\desktop\\ research a real combat \ \ Project \ \ Image time digital recognition \\OCR\\one\\3.jpg"); //vector<rect> Myrect; //float Scalefactor; //Size minSize; //Size maxSize; //float threshold; //int slidingstep; //vector<float> values; //Myicfdetector.detect (Img_test, Myrect, Scalefactor, ten, Threshold, slidingstep, values);    /*    C + +: void Icfdetector::d etect (const mat& image, vector<rect>& objects, float scalefactor, Size minSize, Size maxSize, float threshold, int slidingstep, std::vector<float>& values) C + +: Detect (const mat& IMG, s td::vector<rect>& objects, float minscalefactor, float maxscalefactor, float factorstep, float threshold, int s Lidingstep, std::vector<float>& values) parameters:image–image for detection objects–output AR Ray of bounding boxes scalefactor–scale between layers in detection pyramid minsize–min size of objects in pixel s Maxsize–max size of objects in pixels minscalefactor–min factor by which the image would be resized Maxscale Factor–max Factor by which the image would be resized factorstep–scaling Factor are incremented each pyramid layer AC     Cording to the Parameter slidingstep–sliding window step values–output vector with values of positive samples*/    return 0;}

Time series Identification code debug version 1

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.