@@ -24,38 +24,38 @@ Here we will show how to save the binarized image to your file system and output
2424class MyIntermediateResultReceiver : public CIntermediateResultReceiver
2525{
2626public:
27- virtual void OnBinaryImageUnitReceived(CBinaryImageUnit* pResult, const IntermediateResultExtraInfo* info)
28- {
29- const CImageData* img = pResult->GetImageData();
30- CImageManager* imgManager = new CImageManager;
31- imgManager->SaveToFile(img, "FULL-FILE-PATH", true);
32- delete imgManager, imgManager = NULL;
33- }
34- virtual void OnLocalizedBarcodesReceived(CLocalizedBarcodesUnit* pResult, const IntermediateResultExtraInfo* info)
35- {
36- int count = pResult->GetCount();
37- cout << "Localized " << count << " items" << endl;
38- for (int i = 0; i < count; i++) {
39- const CLocalizedBarcodeElement* locBarcode = pResult->GetLocalizedBarcode(i);
40- CQuadrilateral location = locBarcode->GetLocation();
41- cout << "Result " << i + 1 << endl;
42- cout << " Point 0: [" << location.points[0][0] << ", " << location.points[0][1] << "]" << endl;
43- cout << " Point 1: [" << location.points[1][0] << ", " << location.points[1][1] << "]" << endl;
44- cout << " Point 2: [" << location.points[2][0] << ", " << location.points[2][1] << "]" << endl;
45- cout << " Point 3: [" << location.points[3][0] << ", " << location.points[3][1] << "]" << endl;
46- }
47- }
27+ virtual void OnBinaryImageUnitReceived(CBinaryImageUnit* pResult, const IntermediateResultExtraInfo* info)
28+ {
29+ const CImageData* img = pResult->GetImageData();
30+ CImageManager* imgManager = new CImageManager;
31+ imgManager->SaveToFile(img, "FULL-FILE-PATH", true);
32+ delete imgManager, imgManager = NULL;
33+ }
34+ virtual void OnLocalizedBarcodesReceived(CLocalizedBarcodesUnit* pResult, const IntermediateResultExtraInfo* info)
35+ {
36+ int count = pResult->GetCount();
37+ cout << "Localized " << count << " items" << endl;
38+ for (int i = 0; i < count; i++) {
39+ const CLocalizedBarcodeElement* locBarcode = pResult->GetLocalizedBarcode(i);
40+ CQuadrilateral location = locBarcode->GetLocation();
41+ cout << "Result " << i + 1 << endl;
42+ cout << " Point 0: [" << location.points[0][0] << ", " << location.points[0][1] << "]" << endl;
43+ cout << " Point 1: [" << location.points[1][0] << ", " << location.points[1][1] << "]" << endl;
44+ cout << " Point 2: [" << location.points[2][0] << ", " << location.points[2][1] << "]" << endl;
45+ cout << " Point 3: [" << location.points[3][0] << ", " << location.points[3][1] << "]" << endl;
46+ }
47+ }
4848};
4949int main()
5050{
51- CCaptureVisionRouter* cvr = new CCaptureVisionRouter;
51+ CCaptureVisionRouter* cvr = new CCaptureVisionRouter;
5252 CDirectoryFetcher* dirFetcher = new CDirectoryFetcher;
5353 dirFetcher->SetDirectory("THE-DIRECTORY-THAT-HOLDS-THE-IMAGES");
54- cvr->SetInput(dirFetcher);
55- CIntermediateResultManager* irm = cvr->GetIntermediateResultManager();
56- CIntermediateResultReceiver* irr = new MyIntermediateResultReceiver();
57- irm->AddResultReceiver(irr);
58- cvr->StartCapturing(CPresetTemplate::PT_READ_BARCODES, true);
54+ cvr->SetInput(dirFetcher);
55+ CIntermediateResultManager* irm = cvr->GetIntermediateResultManager();
56+ CIntermediateResultReceiver* irr = new MyIntermediateResultReceiver();
57+ irm->AddResultReceiver(irr);
58+ cvr->StartCapturing(CPresetTemplate::PT_READ_BARCODES, true);
5959}
6060` ` `
6161
0 commit comments