Skip to content

Commit fdd67ed

Browse files
committed
Update shared libraries
1 parent 9f40c66 commit fdd67ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+169
-55
lines changed

camera_async_api.py

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import argparse
2+
import docscanner
3+
import sys
4+
import numpy as np
5+
import cv2
6+
import time
7+
8+
g_results = None
9+
g_normalized_images = []
10+
11+
12+
def callback(results):
13+
global g_results
14+
g_results = results
15+
16+
17+
def showNormalizedImage(name, normalized_image):
18+
mat = docscanner.convertNormalizedImage2Mat(normalized_image)
19+
cv2.imshow(name, mat)
20+
return mat
21+
22+
23+
def process_video(scanner):
24+
scanner.addAsyncListener(callback)
25+
26+
cap = cv2.VideoCapture(0)
27+
while True:
28+
ret, image = cap.read()
29+
30+
ch = cv2.waitKey(1)
31+
if ch == 27:
32+
break
33+
elif ch == ord('n'): # normalize image
34+
if g_results != None:
35+
g_normalized_images = []
36+
index = 0
37+
for result in g_results:
38+
x1 = result.x1
39+
y1 = result.y1
40+
x2 = result.x2
41+
y2 = result.y2
42+
x3 = result.x3
43+
y3 = result.y3
44+
x4 = result.x4
45+
y4 = result.y4
46+
47+
normalized_image = scanner.normalizeBuffer(
48+
image, x1, y1, x2, y2, x3, y3, x4, y4)
49+
g_normalized_images.append(
50+
(str(index), normalized_image))
51+
mat = showNormalizedImage(str(index), normalized_image)
52+
index += 1
53+
elif ch == ord('s'): # save image
54+
for data in g_normalized_images:
55+
# cv2.imwrite('images/' + str(time.time()) + '.png', image)
56+
cv2.destroyWindow(data[0])
57+
data[1].save(str(time.time()) + '.png')
58+
print('Image saved')
59+
60+
g_normalized_images = []
61+
62+
if image is not None:
63+
scanner.detectMatAsync(image)
64+
65+
if g_results != None:
66+
for result in g_results:
67+
x1 = result.x1
68+
y1 = result.y1
69+
x2 = result.x2
70+
y2 = result.y2
71+
x3 = result.x3
72+
y3 = result.y3
73+
x4 = result.x4
74+
y4 = result.y4
75+
76+
cv2.drawContours(
77+
image, [np.intp([(x1, y1), (x2, y2), (x3, y3), (x4, y4)])], 0, (0, 255, 0), 2)
78+
79+
cv2.putText(image, 'Press "n" to normalize image',
80+
(10, 30), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 0, 255), 2)
81+
cv2.putText(image, 'Press "s" to save image', (10, 60),
82+
cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 0, 255), 2)
83+
cv2.putText(image, 'Press "ESC" to exit', (10, 90),
84+
cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 0, 255), 2)
85+
cv2.imshow('Document Scanner', image)
86+
87+
88+
docscanner.initLicense(
89+
"DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==")
90+
91+
scanner = docscanner.createInstance()
92+
ret = scanner.setParameters(docscanner.Templates.color)
93+
process_video(scanner)

include/DynamsoftCore.h

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef __DYNAMSOFT_CORE_H__
22
#define __DYNAMSOFT_CORE_H__
33

4-
#define DYNAMSOFT_CORE_VERSION "2.0.0.0508"
4+
#define DYNAMSOFT_CORE_VERSION "2.0.1.0929"
55

66
/**Successful. */
77
#define DM_OK 0
@@ -81,17 +81,20 @@
8181
#define DMERR_GET_MODE_ARGUMENT_ERROR -10055
8282

8383
/**No content has been detected.*/
84-
#define DDN_CONTENT_NOT_FOUND -10056
84+
#define DDNERR_CONTENT_NOT_FOUND -50001
8585

8686
/*The quardrilateral is invalid*/
87-
#define DDN_QUADRILATERAL_INVALID -10057
87+
#define DMERR_QUADRILATERAL_INVALID -10057
8888

8989
/**Failed to save file.*/
9090
#define DMERR_FILE_SAVE_FAILED -10058
9191

9292
/**The stage type is invalid.*/
9393
#define DMERR_STAGE_TYPE_INVALID -10059
9494

95+
/**The image orientation is invalid.*/
96+
#define DMERR_IMAGE_ORIENTATION_INVALID -10060
97+
9598
#ifndef _COMMON_PART1_
9699
#define _COMMON_PART1_
97100

@@ -390,13 +393,13 @@ typedef enum BarcodeFormat
390393
{
391394
/**All supported formats in BarcodeFormat group 1*/
392395
#if defined(_WIN32) || defined(_WIN64)
393-
BF_ALL = 0xFE1FFFFF,
396+
BF_ALL = 0xFE3FFFFF,
394397
#else
395-
BF_ALL = -31457281,
398+
BF_ALL = -29360129,
396399
#endif
397400

398-
/**Combined value of BF_CODABAR, BF_CODE_128, BF_CODE_39, BF_CODE_39_Extended, BF_CODE_93, BF_EAN_13, BF_EAN_8, INDUSTRIAL_25, BF_ITF, BF_UPC_A, BF_UPC_E, BF_MSI_CODE; */
399-
BF_ONED = 0x001007FF,
401+
/**Combined value of BF_CODABAR, BF_CODE_128, BF_CODE_39, BF_CODE_39_Extended, BF_CODE_93, BF_EAN_13, BF_EAN_8, INDUSTRIAL_25, BF_ITF, BF_UPC_A, BF_UPC_E, BF_MSI_CODE ,BF_ONED; */
402+
BF_ONED = 0x003007FF,
400403

401404
/**Combined value of BF_GS1_DATABAR_OMNIDIRECTIONAL, BF_GS1_DATABAR_TRUNCATED, BF_GS1_DATABAR_STACKED, BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL, BF_GS1_DATABAR_EXPANDED, BF_GS1_DATABAR_EXPANDED_STACKED, BF_GS1_DATABAR_LIMITED*/
402405
BF_GS1_DATABAR = 0x0003F800,
@@ -489,6 +492,10 @@ typedef enum BarcodeFormat
489492
/**MSI Code*/
490493
BF_MSI_CODE = 0x100000,
491494

495+
/*Code 11*/
496+
BF_CODE_11 = 0x200000,
497+
498+
492499
/**No barcode format in BarcodeFormat group 1*/
493500
BF_NULL = 0x00
494501

@@ -506,35 +513,38 @@ typedef enum BarcodeFormat_2
506513
/**No barcode format in BarcodeFormat group 2*/
507514
BF2_NULL = 0x00,
508515

509-
/**Combined value of BF2_USPSINTELLIGENTMAIL, BF2_POSTNET, BF2_PLANET, BF2_AUSTRALIANPOST, BF2_RM4SCC.
510-
When you set this barcode format, the library will automatically add LM_STATISTICS_POSTAL_CODE to LocalizationModes if you doesn't set it.*/
516+
/**Combined value of BF2_USPSINTELLIGENTMAIL, BF2_POSTNET, BF2_PLANET, BF2_AUSTRALIANPOST, BF2_RM4SCC.*/
511517
BF2_POSTALCODE = 0x01F00000,
512518

513519
/**Nonstandard barcode */
514520
BF2_NONSTANDARD_BARCODE = 0x01,
515521

516-
/**USPS Intelligent Mail.
517-
When you set this barcode format, the library will automatically add LM_STATISTICS_POSTAL_CODE to LocalizationModes if you doesn't set it.*/
522+
/**USPS Intelligent Mail.*/
518523
BF2_USPSINTELLIGENTMAIL = 0x00100000,
519524

520-
/**Postnet.
521-
When you set this barcode format, the library will automatically add LM_STATISTICS_POSTAL_CODE to LocalizationModes if you doesn't set it.*/
525+
/**Postnet.*/
522526
BF2_POSTNET = 0x00200000,
523527

524-
/**Planet.
525-
When you set this barcode format, the library will automatically add LM_STATISTICS_POSTAL_CODE to LocalizationModes if you doesn't set it.*/
528+
/**Planet.*/
526529
BF2_PLANET = 0x00400000,
527530

528-
/**Australian Post.
529-
When you set this barcode format, the library will automatically add LM_STATISTICS_POSTAL_CODE to LocalizationModes if you doesn't set it.*/
531+
/**Australian Post.*/
530532
BF2_AUSTRALIANPOST = 0x00800000,
531533

532-
/**Royal Mail 4-State Customer Barcode.
533-
When you set this barcode format, the library will automatically add LM_STATISTICS_POSTAL_CODE to LocalizationModes if you doesn't set it.*/
534+
/**Royal Mail 4-State Customer Barcode.*/
534535
BF2_RM4SCC = 0x01000000,
535536

536-
/**DotCode. When you set this barcode format, the library will automatically add LM_STATISTICS_MARKS to LocalizationModes if you doesn't set it.*/
537-
BF2_DOTCODE = 0x02
537+
/**DotCode.*/
538+
BF2_DOTCODE = 0x02,
539+
540+
/**_PHARMACODE_ONE_TRACK.*/
541+
BF2_PHARMACODE_ONE_TRACK = 0x04,
542+
543+
/**PHARMACODE_TWO_TRACK.*/
544+
BF2_PHARMACODE_TWO_TRACK = 0x08,
545+
546+
/**PHARMACODE.*/
547+
BF2_PHARMACODE = 0x0C
538548
}BarcodeFormat_2;
539549

540550

@@ -579,6 +589,9 @@ typedef struct tagImageData
579589

580590
/**The image pixel format used in the image byte array.*/
581591
ImagePixelFormat format;
592+
593+
/**The image orientation.*/
594+
int orientation;
582595
}ImageData;
583596

584597

@@ -708,10 +721,10 @@ namespace dynamsoft
708721
int height;
709722
int stride;
710723
ImagePixelFormat format;
711-
724+
int orientation;
712725
public:
713726
CImageData();
714-
CImageData(int _l, unsigned char* _b, int _w, int _h, int _s, ImagePixelFormat _f);
727+
CImageData(int _l, unsigned char* _b, int _w, int _h, int _s, ImagePixelFormat _f, int _o = 0);
715728
~CImageData();
716729

717730
const unsigned char* const GetBytes() const;
@@ -720,10 +733,11 @@ namespace dynamsoft
720733
int GetHeight() const;
721734
int GetStride() const;
722735
ImagePixelFormat GetImagePixelFormat() const;
736+
int GetOrientation() const;
723737

724738
private:
725-
CImageData(const CImageData&);
726-
CImageData& operator=(const CImageData&);
739+
CImageData(const CImageData&) = delete;
740+
CImageData& operator=(const CImageData&) = delete;
727741
};
728742

729743
#pragma pack(pop)

include/DynamsoftDocumentNormalizer.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#else
1717
#include "DynamsoftCore.h"
1818
#endif
19-
#define DDN_VERSION "1.0.0.0124"
19+
#define DDN_VERSION "1.0.30.0602"
2020

2121
#pragma pack(push)
2222
#pragma pack(1)
@@ -74,7 +74,7 @@ extern "C" {
7474

7575
DDN_API void DDN_FreeDetectedQuadResultArray(DetectedQuadResultArray** results);
7676

77-
DDN_API int DDN_SaveImageDataToFile(const ImageData* imageData, const char * filePath);
77+
DDN_API int NormalizedImageResult_SaveToFile(const NormalizedImageResult* normalizedImageResult, const char* filePath);
7878

7979
#ifdef __cplusplus
8080
}
@@ -138,7 +138,7 @@ namespace dynamsoft
138138
public:
139139
CNormalizedImageResult(core::CImageData* img);
140140
~CNormalizedImageResult();
141-
141+
int SaveToFile(const char* filePath);
142142
const core::CImageData* GetImageData();
143143

144144
private:
@@ -181,7 +181,6 @@ namespace dynamsoft
181181

182182
static void FreeString(char** content);
183183

184-
static int SaveImageDataToFile(const core::CImageData* imageData, const char * filePath);
185184

186185
private:
187186
CDocumentNormalizer(const CDocumentNormalizer& r);

lib/linux/libDynamicImage.so

4.54 MB
Binary file not shown.

lib/linux/libDynamicPdf.so

6.3 MB
Binary file not shown.

lib/linux/libDynamicPdfCore.so

4.57 MB
Binary file not shown.

lib/linux/libDynamsoftCore.so

-1.06 KB
Binary file not shown.
-5.23 KB
Binary file not shown.
410 KB
Binary file not shown.
0 Bytes
Binary file not shown.

lib/win/DynamicImagex64.dll

2.19 MB
Binary file not shown.

lib/win/DynamicPdfCorex64.dll

2.93 MB
Binary file not shown.

lib/win/DynamicPdfx64.dll

4.48 MB
Binary file not shown.

lib/win/DynamsoftCorex64.dll

-22.5 KB
Binary file not shown.

lib/win/DynamsoftCorex64.lib

284 Bytes
Binary file not shown.
-15.5 KB
Binary file not shown.
-86 Bytes
Binary file not shown.
78 KB
Binary file not shown.
-10 KB
Binary file not shown.
-17.7 KB
Binary file not shown.
-17.7 KB
Binary file not shown.
-20.2 KB
Binary file not shown.
-18.2 KB
Binary file not shown.
-18.2 KB
Binary file not shown.
-17.7 KB
Binary file not shown.
-29.2 KB
Binary file not shown.
-21.7 KB
Binary file not shown.
-18.2 KB
Binary file not shown.
-19.7 KB
Binary file not shown.
-18.2 KB
Binary file not shown.
-18.2 KB
Binary file not shown.
-28.2 KB
Binary file not shown.
-25.2 KB
Binary file not shown.
-22.2 KB
Binary file not shown.
-23.7 KB
Binary file not shown.
-23.7 KB
Binary file not shown.
-20.2 KB
Binary file not shown.
-18.2 KB
Binary file not shown.

lib/win/concrt140.dll

-327 KB
Binary file not shown.

lib/win/msvcp140.dll

-659 KB
Binary file not shown.

lib/win/msvcp140_1.dll

-31.3 KB
Binary file not shown.

lib/win/msvcp140_2.dll

-191 KB
Binary file not shown.

lib/win/ucrtbase.dll

-896 KB
Binary file not shown.

lib/win/vccorlib140.dll

-359 KB
Binary file not shown.

lib/win/vcruntime140.dll

-85.8 KB
Binary file not shown.

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def copyfiles(src, dst):
5151
else:
5252
shutil.copy2(src, dst)
5353

54+
5455
class CustomBuildExt(build_ext.build_ext):
5556
def run(self):
5657
build_ext.build_ext.run(self)
@@ -111,6 +112,8 @@ def run(self):
111112
"Programming Language :: Python :: 3.8",
112113
"Programming Language :: Python :: 3.9",
113114
"Programming Language :: Python :: 3.10",
115+
"Programming Language :: Python :: 3.11",
116+
"Programming Language :: Python :: 3.12",
114117
"Programming Language :: C++",
115118
"Programming Language :: Python :: Implementation :: CPython",
116119
"Topic :: Scientific/Engineering",

0 commit comments

Comments
 (0)