Ask Your Question

Revision history [back]

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>
click to hide/show revision 2
None

updated 2020-05-18 14:17:55 -0600

berak gravatar image

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>

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>