Compare commits

..

1 Commits

Author SHA1 Message Date
ColonelParrot
1138b6216e
Update README.md 2025-01-27 20:05:13 -05:00
4 changed files with 11 additions and 30 deletions

4
package-lock.json generated
View File

@ -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",

View File

@ -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": {

View File

@ -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,

View File

@ -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,10 +129,7 @@
/**
* Extracts and undistorts the image detected within the frame.
*
* Returns `null` if no paper is detected.
*
* @param {*} image image to process
* @param {*} image image to process
* @param {*} resultWidth desired result paper width
* @param {*} resultHeight desired result paper height
* @param {*} cornerPoints optional custom corner points, in case automatic corner points are incorrect
@ -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,