'Saving openCV.js destination image
In the code below I want to save dst in image format or get an URL to show in an image tag.
There is a method imwrite() for other languages but I could not find any for javascript.
let imgElement = document.getElementById("ImgViewImage"); // img element with ImgViewImage id
let src = cv.imread(imgElement);
let dst = new cv.Mat();
let hsvPlanes = new cv.MatVector();
let mergedPlanes = new cv.MatVector();
cv.cvtColor(src, src, cv.COLOR_RGB2HSV, 0);
cv.split(src, hsvPlanes);
let H = hsvPlanes.get(0);
let S = hsvPlanes.get(1);
let V = hsvPlanes.get(2);
cv.equalizeHist(V, V);
mergedPlanes.push_back(H);
mergedPlanes.push_back(S);
mergedPlanes.push_back(V);
cv.merge(mergedPlanes, src);
cv.cvtColor(src, dst, cv.COLOR_HSV2RGB, 0);
cv.imshow("canvasOutput", dst); // canavas element with canvasOutput id
src.delete();
dst.delete();
hsvPlanes.delete();
mergedPlanes.delete();
In addition, is there any way to give the image source directly to the src variable in javascript?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
