-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (26 loc) · 813 Bytes
/
Copy pathmain.cpp
File metadata and controls
35 lines (26 loc) · 813 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 "Boustrophedon.h"
#include "utils.h"
using namespace std;
using namespace cv;
int main() {
//must input binary gray image.
Mat img= imread("../yard3.png", 0);
if(img.empty()){
cout << "Load image failed!" << endl;
return 0;
}
// hist(img);
imshow("Gray_Window", img);
Mat img_b;
threshold(img, img_b, 1, 255, THRESH_BINARY_INV);//通过阈值操作把灰度图变成二值图
imshow("Bin_Window", img_b);
int cells=0;
Boustrophedon niu;
Mat separate_map= niu.Calcbcd(img_b, cells);
cout << "Separate image sucessed! " << cells << endl;
Mat display_mat= niu.DisplaySeparateMap(separate_map, cells);
cout << "Display Separate image sucessed!" << endl;
imshow("BCD_Window", display_mat);
waitKey();
return 0;
}