I have a tfjs web application where I want to smoothen the image before passing it into the model. I am using a simple bilateral filter for this. Code as follows
let src = cv.imread(imgElement);
let dst = new cv.Mat();
cv.cvtColor(src, src, cv.COLOR_RGBA2RGB, 0);
cv.bilateralFilter(src, dst, 9, 75, 75, cv.BORDER_DEFAULT);
cv.imshow('canvasOutput', dst);
src.delete(); dst.delete();
When I import opencv.js (for example https://docs.opencv.org/3.4.0/opencv.js) its a large ~11MB file which I think is overkill for my application. Is there a way to only import relevant codes from that package and how to do that? simple grep of the file opencv.js does not show the existence of any of these functions. A follow up question on how to convert cv image to a tfjs tensor for feeding into my network?