-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageProcessing5.cpp
More file actions
62 lines (48 loc) · 1.21 KB
/
ImageProcessing5.cpp
File metadata and controls
62 lines (48 loc) · 1.21 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
// ImageProcessing5.cpp: îïðåäåëÿåò òî÷êó âõîäà äëÿ êîíñîëüíîãî ïðèëîæåíèÿ.
//
#include "stdafx.h"
#include "segm_line.h"
#include "string.h"
#include <conio.h>
using namespace std;
using namespace cv;
void do_Threshold(Mat & tmp)
{
for (int i = 0;i < tmp.rows;i++)
for (int j = 0;j < tmp.cols;j++)
if (tmp.at<uchar>(i, j) != 255)
{
tmp.at<uchar>(i, j) = 0;
}
}
void load_standart(vector <cv::Mat> & standart_picture)
{
for (int i = 0;i < 32;i++)
{
string str = "Picture" + to_string(i)+".png";
standart_picture.push_back(imread(str));
if (standart_picture[i].empty())
{
cout << "File not found" << endl;
system("pause");
exit(0);
}
cvtColor(standart_picture[i], standart_picture[i], COLOR_BGR2GRAY);
resize(/*sourse*/standart_picture[i], /*destination*/standart_picture[i], cvSize(16, 16));
do_Threshold(standart_picture[i]);
}
namedWindow("Picture_check.png", 0);
imshow("Picture_check.png", standart_picture[16]);
}
int main()
{
setlocale(LC_ALL, "Russian");
vector <cv::Mat> standart_picture;
load_standart(standart_picture);
segm_line a("img.png");
string str=a.Do_segmentation(standart_picture);
cout << str<<endl;
//waitKey(0);
system("pause");
return 0;
}