The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Counting pixels

IgnusIgnus Registered User regular
edited January 2012 in Help / Advice Forum
For this research project I'm working on I'm trying to determine the percentage of area stained on bone histology coupes. I'm using this program called NIS elements to edit, measure and do calculations on my digitalized coupes. But it doesn't really feature everything I'd like it to.

Basicly I'm trying to isolate the colour red in an image. So far thresholding with hue, saturation and intensity works a lot better than RGB thresholding. But NIS elements doesn't allow for very precise selection using HSI. Are there any programs that would allow me to do is, and maybe make a detailed histogram using HSI?

Its a bit hard to explain for me, what it is I'm trying to do here, my english is lacking more than I thought.

Ignus on

Posts

  • MagicToasterMagicToaster JapanRegistered User regular
    If you're trying to just see the red components of an image Photoshop can do that.

    You can turn off the other colors and leave only the red channel open. Also, it has a histogram tool that you can use and compare against other colors or see each individual color channel independently. While you can access a color mixer that works with HSI (or HSB, as Photoshop calls it), you can’t set the color mode to HIS because it’s not additive nor subtractive color theory, which are the base of how Photoshop creates color.

    If you have access to PS and you’re not familiar with how to access these windows, let me know and I’ll set up some print screens for you. It’s very straight forward.

    Note:
    I don’t know how familiar you are with the color gamut, but keep in mind that when working with color histograms that require precision your information may vary slightly depending on how the software is interpreting the color space. An example that comes to mind is Adobe’s 1998 RGB vs sRGB

    chromaticity_diagram_gamut.jpg

    As you can see, Adobe’s 1998 RGB’s color space is much larger than sRGB and therefore reference the color differently. You will get a different histogram if your color spaces don’t match.

  • RookRook Registered User regular
    If you could upload an image, it would probably be very helpful.

    Otherwise, there's a program called ImageJ which is pretty commonly used for image analysis. There's a bunch of plugins that people have developed to help, (http://www.dentistry.bham.ac.uk/landinig/software/software.html) but in this case I think threshold colors (direct link) might help?

  • IgnusIgnus Registered User regular
    Thanks! Colour space and everything isn't at all my field, so i'm reading up on that. I'll keep the gamut thing in mind when comparing histograms.

    I'm going to check out a trial version of photoshop and ImageJ!

    kleuring.jpg

    This is a sample of the coupes I'm working with. Sadly the staining isn't as red as this in every slide. In some its hard to differentiate between light blue and light red, since both approach grey.

    I'll let you know how it goes.

  • DrunkMcDrunkMc Registered User regular
    For some quick prototyping of algorithms to do what you're trying to do, I'd got MATLAB. If you're in school, usually they have it for a sick discount. You should be able to isolate the different channels and apply different stretches to your images to see what makes "red" stand out the most.

  • shutzshutz Registered User regular
    A few ideas:

    - figure out the exact hue of your "red" coloring. Is it really a "pure" RGB red? If not, there are tools in Photoshop (or even GIMP, if you don't have access to Photoshop and need something free) that can help you "rotate" the colors to align your red hue to pure RGB red. After that, you can tweak saturation, and then do some simple operations on color layers to eliminate the blue and grey, and keep only red. Basically, what you'd do is take the red layer, and try to subtract the blue and green layers from that, but the Photoshop experts here can probably explain it better.

    - using Photoshop or GIMP, tweak the colors to get the best contrast for your NIS software.

    - Look into your scanner's settings, to see if you can get more meaningful images, or possibly, raw images with more bit depth. Many scanners will scan using more bits per pixel than the resulting image you get (which will usually be 24-bit, 8 bits each for R, G and B). That extra precision could make it easier to discern the red pixels. For instance, if your scanner software lets you output images at a higher bit-depth, use that. If the software lets you adjust colors within the driver, try to adjust the gamma of the red component to use as much precision as possible for the range of red intensities that most interest you. That way, when the driver calculates a 24-bit color value from the higher bit-depth, it'll provide you with the most significant values that you need. You might then be able to input that directly into your NIS software without further tweaks, and get the data you need.

    Creativity begets criticism.
    Check out my new blog: http://50wordstories.ca
    Also check out my old game design blog: http://stealmygamedesigns.blogspot.com
Sign In or Register to comment.