How can I delete Red channel from image and use only Green merged to blue?
I need to get an image and extract the color channels(RGB) and then merge Green and Blue ones, what am I doing wrong(Using OpenCV.js)
<button type="button" onclick="filter('Aneritra')">Aneritra</button>
<script>
function filter(filter_name){
if(filter_name == 'Aneritra'){
let src = cv.imread('Selected_Image');
let dst = new cv.Mat();
let rgbaPlanes = new cv.MatVector();
// Split the src
cv.split(src, rgbaPlanes);
// Get G channel
let G = rgbaPlanes.get(1);
// Get B channel
let B = rgbaPlanes.get(2);
// Merge G & B channels
cv.merge((G,B), dst);
cv.imshow('canvasOutput', dst);
src.delete();
dst.delete();
rgbaPlanes.delete();
}
}
</script>
It would be easier to see what you do wrong if you tell what happens wrong...
Uncaught BindingErrormessage: "Expected null or instance of MatVector, got an instance of Mat"name: "BindingError"stack: "BindingError: Expected null or instance of MatVector, got an instance of Mat↵ at BindingError.<anonymous> (http://localhost:81/admin/opencv.js:2... at new BindingError (eval at createNamedFunction (http://localhost:81/admin/opencv.js:2...), <anonymous>:4:34)↵ at throwBindingError (http://localhost:81/admin/opencv.js:2... at upcastPointer (http://localhost:81/admin/opencv.js:2... at RegisteredPointer.nonConstNoSmartPtrRawPointerToWireType [as toWireType] (http://localhost:81/admin/opencv.js:2... at Object.merge (eval at new_ (http://localhost:81/admin/opencv.js:2...), <anonymous>:7:26)↵ at filtro (http://lo</anonymous></anonymous></anonymous>