Hiding certain channel of an image with C#

1.4k Views Asked by At

i have an image processing application that is able to getpixel, anyone know how can i hide or show the RGB channel of my image? For example when i click a button call "RED" it will hide red channel and show only blue and green. i m using C# btw thanks alot

2

There are 2 best solutions below

2
On BEST ANSWER

Try the AForge.NET library. Use the AForge.Imaging.Filters.ChannelFiltering filter.

0
On

Allocate a blank image (1 channel) of the same size as the original image. Then, when handling a button press for RED, do the following:

  • split your original image into R, G and B
  • compose a new image using blank, G, B (in that order, as the order of channels is important). This leaves out the red channel
  • display the composed image

Handle button presses for BLUE and GREEN in similar fashion.

split, compose and display methods are common in imaging libraries. Their exact names may differ depending on the library you are using, but their overall functionality should generally be the same. By the way, what library are you using? You didn't mention it in your question.

If you're not using any library to achieve what you're doing, you will have to write your own split and compose functions (or something along those lines). You would have to say more about the data structures you are using to get help in that direction.