Split On QR Code

This commit is contained in:
Felix Kaspar
2023-10-28 19:30:12 +02:00
parent 013a3f7e1b
commit f7e5fd3aef
3 changed files with 47 additions and 13 deletions

View File

@@ -29,7 +29,7 @@ export async function detectEmptyPages(snapshot, whiteThreashold, PDFJS, OpenCV)
}
async function areImagesBlank(page, threshold) {
const images = getImagesOnPage(page, PDFJS);
const images = await getImagesOnPage(page, PDFJS);
for (const image of images) {
if(!isImageBlank(image, threshold))
return false;
@@ -37,7 +37,7 @@ export async function detectEmptyPages(snapshot, whiteThreashold, PDFJS, OpenCV)
return true;
}
async function isImageBlank(image, threshold) {
function isImageBlank(image, threshold) {
const src = new OpenCV.cv.Mat(image.width, image.height, OpenCV.cv.CV_8UC4);
src.data.set(image.data);
// Convert the image to grayscale