mirror of
https://github.com/ColonelParrot/jscanify.git
synced 2025-12-31 06:31:54 +00:00
Compare commits
1 Commits
9749c97498
...
1138b6216e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1138b6216e |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "jscanify",
|
||||
"version": "1.3.3",
|
||||
"version": "1.2.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "jscanify",
|
||||
"version": "1.3.3",
|
||||
"version": "1.2.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"canvas": "^2.11.2",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jscanify",
|
||||
"version": "1.3.3",
|
||||
"version": "1.3.2",
|
||||
"description": "Open-source Javascript mobile document scanner.",
|
||||
"main": "src/jscanify-node.js",
|
||||
"directories": {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*! jscanify v1.3.3 | (c) ColonelParrot and other contributors | MIT License */
|
||||
/*! jscanify v1.3.2 | (c) ColonelParrot and other contributors | MIT License */
|
||||
|
||||
const { Canvas, createCanvas, Image, ImageData } = require("canvas");
|
||||
const { JSDOM } = require("jsdom");
|
||||
@ -80,10 +80,7 @@ class jscanify {
|
||||
}
|
||||
}
|
||||
|
||||
const maxContour =
|
||||
maxContourIndex >= 0 ?
|
||||
contours.get(maxContourIndex) :
|
||||
null;
|
||||
const maxContour = contours.get(maxContourIndex);
|
||||
|
||||
imgGray.delete();
|
||||
imgBlur.delete();
|
||||
@ -141,9 +138,6 @@ class jscanify {
|
||||
|
||||
/**
|
||||
* Extracts and undistorts the image detected within the frame.
|
||||
*
|
||||
* Returns `null` if no paper is detected.
|
||||
*
|
||||
* @param {*} image image to process
|
||||
* @param {*} resultWidth desired result paper width
|
||||
* @param {*} resultHeight desired result paper height
|
||||
@ -154,11 +148,6 @@ class jscanify {
|
||||
const canvas = createCanvas();
|
||||
const img = cv.imread(image);
|
||||
const maxContour = this.findPaperContour(img);
|
||||
|
||||
if(maxContour == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
const {
|
||||
topLeftCorner,
|
||||
topRightCorner,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*! jscanify v1.3.3 | (c) ColonelParrot and other contributors | MIT License */
|
||||
/*! jscanify v1.3.2 | (c) ColonelParrot and other contributors | MIT License */
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === "object" && typeof module !== "undefined"
|
||||
@ -71,10 +71,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
const maxContour =
|
||||
maxContourIndex >= 0 ?
|
||||
contours.get(maxContourIndex) :
|
||||
null;
|
||||
const maxContour = contours.get(maxContourIndex);
|
||||
|
||||
imgGray.delete();
|
||||
imgBlur.delete();
|
||||
@ -132,9 +129,6 @@
|
||||
|
||||
/**
|
||||
* Extracts and undistorts the image detected within the frame.
|
||||
*
|
||||
* Returns `null` if no paper is detected.
|
||||
*
|
||||
* @param {*} image image to process
|
||||
* @param {*} resultWidth desired result paper width
|
||||
* @param {*} resultHeight desired result paper height
|
||||
@ -143,12 +137,10 @@
|
||||
*/
|
||||
extractPaper(image, resultWidth, resultHeight, cornerPoints) {
|
||||
const canvas = document.createElement("canvas");
|
||||
const img = cv.imread(image);
|
||||
const maxContour = this.findPaperContour(img);
|
||||
|
||||
if(maxContour == null){
|
||||
return null;
|
||||
}
|
||||
const img = cv.imread(image);
|
||||
|
||||
const maxContour = this.findPaperContour(img);
|
||||
|
||||
const {
|
||||
topLeftCorner,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user