Welcome to Atalasoft Community Sign in | Join | Help

#9 – If nougat and soy were ever to touch, we’d all be vaporized – the ReplaceChannelCommand

Ingredients:

  • 2 AtalaImages (one continuous color, one grayscale)
  • 1 ReplaceChannelCommand
  • Salt and pepper to taste

Directions:

In a Visual Studio project, create two AtalaImages, one for the color image and one for the grayscale image.  Set aside.  Create one ReplaceChannelCommand.  With the grayscale AtalaImage, set it to the channel property you wish to replace (you can choose any combination of the four channels, or set them to null if you don’t wish to change them).  Apply to the continuous color AtalaImage.  Display in viewer, or save to a file.  Enjoy.

The ReplaceChannelCommand replaces the channel values of a color image with the values from an 8-bit grayscale image.  The images don’t have to match – it just uses the values from the gray image – but they should be the same size.  One application of this would be to set the alpha channel of an image for masking.

Here is an example of this in use for sharpening an image:

Color Image:

city_color

Gray Application:

city_gray

Results, replacing channel 2:

replacechannel2

Notice how much easier it is now to see the streets of the city.  And what city would it be?  The first five people to email me the correct city win an Atalasoft T-shirt.  Employees (past and present) and family members of Atalasoft are ineligible.  Email me at Training at Atalasoft dot com (don’t forget to put an address of where to ship the shirt and the shirt size you prefer).

Published Tuesday, July 28, 2009 10:57 AM by Elaine

Comments

No Comments
Anonymous comments are disabled