Image Color

Combined Grayscale and Color Images
Download

Image Color Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Freeware
  • Publisher Name:
  • Matthew Baugher
  • Publisher web site:
  • http://www.codeproject.com/Members/mbaugher
  • Operating Systems:
  • Windows All
  • File Size:
  • 19 KB

Image Color Tags


Image Color Description

The Image Color application was developed to be a program for making combined grayscale and color images. After growing tired of spending hours zoomed in at 800% magnification using the polygon lasso tool to create combined grayscale and color images in Macromedia Fireworks, I decided that there had to be a better way. Thus I embarked upon creating this application to make my life and hopefully that of others easier. This is a first attempt, and if I receive positive feedback that others would actually like to use this application, I will expand the features available when time permits. Most images consist of three bands: red, green and blue. Sometimes a fourth "alpha" band is used for transparency, but that is not relevant to this article. Each band contains a value between 0 and 255 for each pixel for a possible 16777216 colors. Therefore, selecting a color to keep in an image is not as simple as just picking a pixel and turning all other pixels that do not match that color to grayscale. Instead, some tolerance level must be used. However, this level can vary greatly depending upon the amount of color variance in the image and what colors the user desires to keep.I have found that one of the more effective methods of dealing with this is to use a ratio value between the pixel's colors. Once users select a pixel from the image that they would like to keep, the program computes the difference in value between the red and green band, red and blue band, and green and blue band. This then is a ratio that can be used over the entire image to find similar colored pixels, even though the light level may be very different. For example, this would match a pixel that had the values red = 50, green = 80, and blue = 110 to a pixel that had the values red = 180, green = 210, and blue = 240 because the difference between red and green in each is 30, etc.However, even using the ratio method described above still does not match very many pixels, a maximum of 256. To get a decent color selection, error values must be used on each band difference. Therefore, the program provides three text boxes for the user to provide an error value for the red and green difference, red and blue difference, and green and blue difference. By adding and subtracting this error value from the difference number, a much broader range of colors are included in the match. For example, if the difference between the red and green pixels is 25, and the user enters an error value of 20, all pixels with a difference between the red and green bands of anywhere from 5 to 45 will be within this range.Another useful feature is that many times the color exists in several locations on the image and the user only wants to keep it in one section. Therefore, some boundary needs to be supplied allowing the user to select a small area from the image to keep in color. For this example program, I have just added simple code for a rectangle, although it could be expanded to any shape. I implemented just the drawing part of "The Secret of Marching Ants" program from The Code Project so that users can see the rectangle as they draw it. This necessitated drawing the image directly onto the form instead of using a picturebox where scrollbars could easily be added.


Image Color Related Software