react-native-rectangle-doc-scanner 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DocScanner.js +5 -2
- package/package.json +1 -1
- package/src/DocScanner.tsx +6 -2
package/dist/DocScanner.js
CHANGED
|
@@ -143,7 +143,7 @@ const DocScanner = ({ onCapture, overlayColor = '#e7a649', autoCapture = true, m
|
|
|
143
143
|
step = `contour_${i}_area`;
|
|
144
144
|
reportStage(step);
|
|
145
145
|
const { value: area } = react_native_fast_opencv_1.OpenCV.invoke('contourArea', contour, false);
|
|
146
|
-
if (area < width * height * 0.
|
|
146
|
+
if (area < width * height * 0.02) {
|
|
147
147
|
continue;
|
|
148
148
|
}
|
|
149
149
|
step = `contour_${i}_arcLength`;
|
|
@@ -152,11 +152,14 @@ const DocScanner = ({ onCapture, overlayColor = '#e7a649', autoCapture = true, m
|
|
|
152
152
|
const approx = react_native_fast_opencv_1.OpenCV.createObject(react_native_fast_opencv_1.ObjectType.PointVector);
|
|
153
153
|
step = `contour_${i}_approxPolyDP`;
|
|
154
154
|
reportStage(step);
|
|
155
|
-
react_native_fast_opencv_1.OpenCV.invoke('approxPolyDP', contour, approx, 0.
|
|
155
|
+
react_native_fast_opencv_1.OpenCV.invoke('approxPolyDP', contour, approx, 0.012 * perimeter, true);
|
|
156
156
|
step = `contour_${i}_toJS`;
|
|
157
157
|
reportStage(step);
|
|
158
158
|
const approxValue = react_native_fast_opencv_1.OpenCV.toJSValue(approx);
|
|
159
159
|
const approxArray = Array.isArray(approxValue?.array) ? approxValue.array : [];
|
|
160
|
+
if (__DEV__) {
|
|
161
|
+
reportStage(`${step}_length_${approxArray.length}`);
|
|
162
|
+
}
|
|
160
163
|
if (approxArray.length !== 4) {
|
|
161
164
|
continue;
|
|
162
165
|
}
|
package/package.json
CHANGED
package/src/DocScanner.tsx
CHANGED
|
@@ -163,7 +163,7 @@ export const DocScanner: React.FC<Props> = ({
|
|
|
163
163
|
reportStage(step);
|
|
164
164
|
const { value: area } = OpenCV.invoke('contourArea', contour, false);
|
|
165
165
|
|
|
166
|
-
if (area < width * height * 0.
|
|
166
|
+
if (area < width * height * 0.02) {
|
|
167
167
|
continue;
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -174,13 +174,17 @@ export const DocScanner: React.FC<Props> = ({
|
|
|
174
174
|
|
|
175
175
|
step = `contour_${i}_approxPolyDP`;
|
|
176
176
|
reportStage(step);
|
|
177
|
-
OpenCV.invoke('approxPolyDP', contour, approx, 0.
|
|
177
|
+
OpenCV.invoke('approxPolyDP', contour, approx, 0.012 * perimeter, true);
|
|
178
178
|
|
|
179
179
|
step = `contour_${i}_toJS`;
|
|
180
180
|
reportStage(step);
|
|
181
181
|
const approxValue = OpenCV.toJSValue(approx);
|
|
182
182
|
const approxArray = Array.isArray(approxValue?.array) ? approxValue.array : [];
|
|
183
183
|
|
|
184
|
+
if (__DEV__) {
|
|
185
|
+
reportStage(`${step}_length_${approxArray.length}`);
|
|
186
|
+
}
|
|
187
|
+
|
|
184
188
|
if (approxArray.length !== 4) {
|
|
185
189
|
continue;
|
|
186
190
|
}
|