extractPaper: remove callback, direct return

This commit is contained in:
ColonelParrot 2023-05-10 15:37:30 -04:00
parent 4a6c9964e9
commit 03e7e6932a
2 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/*! jscanify v1.1.0 | (c) ColonelParrot and other contributors | MIT License */
/*! jscanify v1.2.0 | (c) ColonelParrot and other contributors | MIT License */
const { Canvas, createCanvas, Image, ImageData } = require("canvas");
const { JSDOM } = require("jsdom");
@ -143,7 +143,7 @@ class jscanify {
* @param {*} onComplete callback with `HTMLCanvasElement` passed - the unwarped paper
* @param {*} cornerPoints optional custom corner points, in case automatic corner points are incorrect
*/
extractPaper(image, resultWidth, resultHeight, onComplete, cornerPoints) {
extractPaper(image, resultWidth, resultHeight, cornerPoints) {
const canvas = createCanvas();
const img = cv.imread(image);
const maxContour = this.findPaperContour(img);
@ -190,7 +190,7 @@ class jscanify {
img.delete();
warpedDst.delete();
onComplete(canvas);
return canvas;
}
/**

View File

@ -1,4 +1,4 @@
/*! jscanify v1.1.0 | (c) ColonelParrot and other contributors | MIT License */
/*! jscanify v1.2.0 | (c) ColonelParrot and other contributors | MIT License */
(function (global, factory) {
typeof exports === "object" && typeof module !== "undefined"
@ -134,7 +134,7 @@
* @param {*} onComplete callback with `HTMLCanvasElement` passed - the unwarped paper
* @param {*} cornerPoints optional custom corner points, in case automatic corner points are incorrect
*/
extractPaper(image, resultWidth, resultHeight, onComplete, cornerPoints) {
extractPaper(image, resultWidth, resultHeight, cornerPoints) {
const canvas = document.createElement("canvas");
const img = cv.imread(image);
@ -187,7 +187,7 @@
img.delete()
warpedDst.delete()
onComplete(canvas)
return canvas;
}
/**