[Strange things]terminal rotten apples

Source: Internet
Author: User

Share code with ~

1 #pragmaOnce2 #pragmaWarning (disable:4996)3 //#include "convert_image.hpp"4#include <Windows.h>5#include <iostream>6#include <string>7#include <istream>8#include <ostream>9#include <fstream>Ten#include <sstream> One#include <vector> A using namespacestd; -  - classPlay { the  Public: -     Const intTotal =6570; -     voidInit (stringInputPath) { -Ifstream is; +         Chartmp[ the]; - src.clear (); +          for(intK =1; K <= Total; k++) { A              is. Open (InputPath +Gettextfilename (k)); atSrc.push_back (vector<string>()); -size_t n = src.size ()-1; -Src[n].clear (); memset (TMP,0,sizeof(TMP)); -              while( is. getline (TMP, the)) { - Src[n].push_back (TMP); -memset (TMP,0,sizeof(TMP)); in             } -              is. Close (); to         } +     } -     voidShow () { the          for(inti =0; I < src.size (); i++) { *System"CLS"); $              for(intj =0; J < Src[i].size (); J + +) printf ("%s\n", Src[i][j].c_str ());Panax NotoginsengSleep ( -); -         } the     } + protected: Avector<vector<string>>src; the     stringGettextfilename (intx) { + StringStream SS; -         stringfile; $SS << X; SS >>file; $File + =". txt"; -         returnfile; -     } the }; - Wuyi  the intMain () { -     //convertsize::D O (".. /pic/",". /done/", Max.); Wu     //converttype::D O (".. /done/",". /digit/", Max.); - Play player; AboutPlayer. Init (".. /digit/"); $ player. Show (); -}
main.cpp
1#include <iostream>2#include <string>3#include <istream>4#include <ostream>5#include <fstream>6#include <sstream>7#include <vector>8#include <opencv.hpp>9 Ten using namespaceCV; One using namespacestd; A  - classUtils { -  Public: the     Static Const intTotal =6570; -     Static stringGetFileName (intx) { - StringStream SS; -         stringfile; +SS << X; SS >>file; -File + =". jpg"; +         returnfile; A     } at     Static voidSaveImage (stringOutputPath, mat&DST) { - Imwrite (OutputPath, DST); -     } - }; -  - classConvertsize: PublicUtils { in  Public: -     Static voidDo (stringInputPath,stringOutputPath, size_t width, size_t height) { to Mat DST; +         stringfileName, TMP; -          for(inti =1; I <= total; i++) { theFileName =GetFileName (i); *Dealsize (InputPath +FileName, DST, Size (width, height)); $SaveImage (OutputPath +FileName, DST);Panax Notoginseng         } -     } the protected: +     Static voidDealsize (stringInputPath, mat&DST, size size) { AMat src; DST =Mat (); thesrc =Imread (InputPath); + Resize (src, DST, size); -     } $ }; $  - classConverttype: PublicUtils { -  Public: the     Static voidDo (stringInputPath,stringOutputPath, size_t width, size_t height) { -         stringFileName;Wuyi          for(inti =1; I <= total; i++) { theFileName =GetFileName (i); -Dealtype (InputPath + fileName, OutputPath +FileName, Size (width, height)); Wu         } -     } About protected: $     //1:dark 0:light -     Static voidDealtype (stringInputPath,stringoutputPath, size size) { - Outputpath.pop_back (); Outputpath.pop_back (); Outputpath.pop_back (); -OutputPath + ="txt"; AMat src =Imread (InputPath); +vector<vector<Char> >DST; the          for(inti =0; i < src.rows; i++) { -Dst.push_back (vector<Char>()); $              for(intj =0; J < Src.cols; J + +) { theAuto tot = src.at<vec3b> (i, J) [0] + src.at<vec3b> (i, J) [1] + src.at<vec3b> (i, J) [2]; the                 if(Tot/3> $) Dst[i].push_back (' '); the                 ElseDst[i].push_back ('0'); the             } -         } in Ofstream of; the Of.open (outputPath); the          for(inti =0; I < dst.size (); i++) { About              for(intj =0; J < Dst[i].size (); J + +) { theof <<Dst[i][j]; the             } theof <<Endl; +         } - of.close (); the     }Bayi};
convert_image.hpp

[Strange things]terminal rotten apples

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.