Ask Your Question

Revision history [back]

Opencv.js Subtract function doesn't give desired output

I am following this tutorial, https://docs.opencv.org/3.4.10/dd/d4d/tutorial_js_image_arithmetics.html

'subtract' function in opencv.js is not working as expected.

let src = cv.imread('imageCanvasInput');
let logo = cv.imread('logoCanvasInput');
let dst = new cv.Mat();
let mask = new cv.Mat();
//cv.subtract(logo,src,dst);
cv.subtract(logo,src,dst,mask,-1);
cv.imshow('canvasOutput', dst);
src.delete(); dst.delete(); logo.delete(); mask.delete();

Whatever I try in subtract function, the "dst" mat always gives as white image.

Is there anything missed here for subtraction.

Note: The add function for the same image set working as expected