-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
69 lines (68 loc) · 2.11 KB
/
Copy pathmain.cpp
File metadata and controls
69 lines (68 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include<iostream>
#include<stdlib.h>
#include<string>
using namespace std;
string baseStr="./ocr ";
string concat(string);
string concat(string str){
for(int i=0;i<str.length();++i){
baseStr+=str[i];
if(i==str.length()-1){
baseStr+=' ';
}
}
return baseStr;
}
int main(){
system("clear");
cout<<"------------Welcome to OCR-ENGINE-LITE!!!-----------\n"
<<"____________________________________________________________________________________________"
<<"\nWritten by,\nAkanksha Giri\nDev Raj Parajuli\n"
<<"_______________________________________________________________________________________________"
<<endl;
string compile="g++ -o ocr ocr.cpp -L /usr/lib -lopencv_core -lopencv_videoio -lopencv_highgui -ltesseract -lopencv_imgproc -lopencv_imgcodecs";
cout<<"\n\n------Making Engine ready...takes a bit time!!-----\n\n";
system(compile.data());
cout<<"------OK ITS READY--Press Enter to Continue!!-------\n";
cin.get();
while(true){
char *ch=new char;
cout<<"1.)Capture a image of your document('c')."<<endl
<<"2.)Upload a image file('u')."<<endl
<<"3.)Search your OCR'ed document('s')."<<endl
<<"4.)Exit('q')."<<endl<<endl<<"Enter key!!!"<<endl;
cin>>ch;
if(*ch=='c'){
system("clear");
system(concat("c").data());
}
if(*ch=='u'){
system("clear");
cout<<"Images files in this directory::\n\n";
string st="ls *\".jpg\" *\".png\" *\".jpeg\"";
system(st.data());
string fname;
cout<<"\nEnter image filename::[example.jpg/example.png]:or:full image path::\n"<<endl;
cin>>fname;
concat("u");
system(concat(fname).data());
}
if(*ch=='s'){
system("clear");
cout<<"Images files in this directory::\n\n";
string st="ls *\".jpg\" *\".png\" *\".jpeg\"";
system(st.data());
cout<<"\nEnter filename::[example or example.jpg.]::"<<endl;
cin>>st;
concat("s");
system(concat(st).data());
}
if(*ch=='q'){
exit(1);
}
baseStr="./ocr ";
system("clear");
delete(ch);
}
return 0;
}