-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBarcodeDecoder.cpp
More file actions
41 lines (32 loc) · 885 Bytes
/
Copy pathBarcodeDecoder.cpp
File metadata and controls
41 lines (32 loc) · 885 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
34
35
36
37
38
39
40
41
#include "BarcodeDecoder.h"
using namespace std;
using namespace cv;
namespace bd
{
BarcodeDecoder::BarcodeDecoder()
{
}
BarcodeDecoder::~BarcodeDecoder()
{
}
wstring BarcodeDecoder::Decode(cv::Mat barcode_img)
{
threshold(barcode_img, barcode_img, THRESHOLD, 255, cv::THRESH_BINARY);
vector<Finder> finder(3);
/* up left finder */
finder[0].bb = Rect(Point(43,43), Point(98, 98));
/* up right finder */
finder[1].bb = Rect(Point(251,43), Point(306, 98));
/* bottom left finder */
finder[2].bb = Rect(Point(43,251), Point(98, 306));
vector<Mat> img(3);
img[0] = barcode_img(finder[0].bb);
img[1] = barcode_img(finder[1].bb);
img[2] = barcode_img(finder[2].bb);
imshow ("up_left_finder", img[0]);
imshow ("up_right_finder", img[1]);
imshow ("bottom_left_finder", img[2]);
waitKey(0);
return wstring();
}
}