-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (26 loc) · 844 Bytes
/
main.cpp
File metadata and controls
33 lines (26 loc) · 844 Bytes
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
#include <iostream>
#include <opencv2/opencv.hpp>
#include "scanner.cpp"
#include "transform.cpp"
int main(int argc,char** argv)
{
std::string path = "test.png";
std::string resultPath = "result.png"; //add overwrite safety
if(argc > 1 )
path = argv[1];
else
std::cout<<"Usage "<<argv[0]<<" [image path] [result path {default result.png (overwrites)}]\n";
cv::Mat img = cv::imread(path); //check read
if(img.empty())
{
std::cout<<"Cannot read or find image\n";
exit(0);
}
std::cout<<img.size()<<" "<<img.channels()<<"\n";
cv::Mat org(img);
auto points = scanner(img);
cv::Mat result = perspectiveTransform(org,points);
cv::imwrite(resultPath,result);
std::cout<<"saved "<<resultPath<<" "<<result.size()<<std::endl;
return 0;
}