Skip to content

Commit f221fd4

Browse files
committed
v0.8
1 parent a906023 commit f221fd4

File tree

13 files changed

+1121
-820
lines changed

13 files changed

+1121
-820
lines changed

README.md

Lines changed: 96 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [Javascript BCR Library](https://github.com/syneo-tools-gmbh/Javascript-BCR-Library) 0.0.6
1+
# [Javascript BCR Library](https://github.com/syneo-tools-gmbh/Javascript-BCR-Library) 0.0.8
22
## Authors: Gaspare Ferraro, Renzo Sala, Simone Ponte, Paolo Macco
33

44
BCR Library is a javascript library, using the OCR engine Tesseract.JS, that extracts name, company name, job, address, phone numbers, email and web address out of a business card picture.
@@ -22,17 +22,91 @@ If you use cordova, you can add the `browser` platform and run it (it works on o
2222
# Reference
2323

2424
## Methods
25-
### Init method
26-
`bcr.initialize();`
25+
### Init methods
26+
`bcr.initialize(crop, language, width, height);`
27+
28+
Initialize the bcr reader.
29+
30+
Where:
31+
32+
- **STRING** `crop`: the crop strategy (see [languages](#languages)), default `languages.GERMAN`.
33+
- **STRING** `language`: the language trained data (see [cropStrategy](#cropStrategy)), default `cropStrategy.SMART`.
34+
- **NUMBER** `width`: max internal width, default `2160`.
35+
- **NUMBER** `height`: max internal height, default `1440`.
36+
- Return Promise about JS loading.
37+
38+
---------------
39+
40+
`initializeForBCR(dynamicInclude);`
41+
42+
Initialize bcr reader given the ocr from google mobile vision text recognition API (cordova-plugin-mobile-ocr).
43+
44+
Where:
45+
- **BOOL** `dynamicInclude`: if the references are not included externally (default `true`).
46+
- Return Promise about JS loading.
47+
2748

2849
### Recognize business card
50+
2951
`bcr.recognizeBcr(base64image, displayResultCallback, displayProgressCallback);`
3052

3153
Where:
3254

33-
- `base64image` is the base64 string of the image to analyze.
34-
- `displayResultCallback(result_data)` is a function called when the analysis of the business card is completed.
35-
- `displayProgressCallback(progress_data)` is a function called after each progress in the analysis.
55+
- **STRING** `base64image`: base64 string of the image to analyze.
56+
- **FUNCTION** `displayResultCallback(result_data)` function called when the analysis of the business card is completed.
57+
- **FUNCTION** `displayProgressCallback(progress_data)` function called after each progress in the analysis.
58+
59+
-----------------
60+
61+
`bcr.recognizeBcrFromOcr(ocr, displayResultCallback, displayProgressCallback);`
62+
63+
Where:
64+
65+
- **OBJECT** `ocr`: object containing ocr results data.
66+
- **FUNCTION** `displayResultCallback(result_data)` function called when the analysis of the business card is completed.
67+
- **FUNCTION** `displayProgressCallback(progress_data)` function called after each progress in the analysis.
68+
69+
### Getter methods
70+
71+
`cropStrategy()`
72+
73+
- Return the strategy label internally set.
74+
75+
------------
76+
77+
`maxWidth()`
78+
79+
- Return the value of the max width used internally to normalize the resolution.
80+
81+
------------
82+
83+
`maxHeight()`
84+
85+
- Return the value of the max height used internally to normalize the resolution.
86+
87+
------------
88+
89+
`language()`
90+
91+
- Return the value of the language trained data.
92+
93+
------------
94+
95+
`tesseract()`
96+
97+
- Return the initialized tesseract worker.
98+
99+
------------
100+
101+
`ocr()`
102+
103+
- Return the ocr passed.
104+
105+
------------
106+
107+
`onlyBCR()`
108+
109+
- Return if only BCR should be performed.
36110

37111
## Object
38112

@@ -83,6 +157,22 @@ JSON object in the format:
83157
}
84158
```
85159

160+
## ENUM
161+
162+
### languages
163+
164+
- `languages.DANISH`: Danish language
165+
- `languages.GERMAN`: German language
166+
- `languages.ENGLISH`: English language
167+
- `languages.FRENCH`: French language
168+
- `languages.ITALIAN`: Italian language
169+
- `languages.SPANISH`: Spanish language
170+
- `languages.SWEDISH`: Swedish language
171+
172+
### cropStrategy
173+
174+
- `cropStrategy.SMART`: clean the image
175+
86176
## JS Libraries used
87177

88178
* [Tesseract.JS](https://github.com/naptha/tesseract.js) - 1.0.19<br/>

sample/js/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
3-
Cordova BCR Library 0.0.4
3+
Cordova BCR Library 0.0.8
44
Authors: Gaspare Ferraro, Renzo Sala
55
Contributors: Simone Ponte, Paolo Macco
66
Filename: bcr.js
@@ -16,7 +16,7 @@ async function init() {
1616

1717
// app init
1818
$(document).ready(function() {
19-
init();
19+
init().finally();
2020
});
2121

2222

0 commit comments

Comments
 (0)