Fix OpenCV Mat leak when stitching/connecting PCB images

This commit is contained in:
Taras Greben 2026-06-26 14:33:12 +03:00
commit 70104b33ac

View file

@ -105,7 +105,9 @@ class CVManager {
const { mat, scale, width, height } = await this.createSmallMat(blob); const { mat, scale, width, height } = await this.createSmallMat(blob);
const kp = new cv.KeyPointVector(); const kp = new cv.KeyPointVector();
const des = new cv.Mat(); const des = new cv.Mat();
this.detector.detectAndCompute(mat, new cv.Mat(), kp, des); const mask = new cv.Mat();
this.detector.detectAndCompute(mat, mask, kp, des);
mask.delete();
mat.delete(); mat.delete();
return { kp, des, scale, w: width, h: height }; return { kp, des, scale, w: width, h: height };
} }