Filtering certain color range

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Filtering certain color range

rasheed-3
This post was updated on .
Hi there everyone,

I would like to know if it is possible to subtract or filter a certain color range. I have attached a photograph of a core(acquired while drilling the hole looking for oil). From the image, three different major features (in terms of color) can be seen, light brown, dark brown and gray.

2010.00-2020.00+m.jpg.

What I would like to do is to know the total height of the sand(light and dark brown) in the image removing the gray stuff which is shale/clay. Therefore, if I could filter the gray stuff out, I can then plot a profile, knowing that the low value(or black) is the shale/clay and the rest is sand.

The problem I have now is, when I plot a gray scale profile, it will not be possible to differentiate the shale from sand as the shale seem to be brighter than the dark brown sand.

Any advice on this matter is very much appreciated. Thanks guys/gals.
Reply | Threaded
Open this post in threaded view
|

Re: Filtering certain color range

Gluender
>Hi there everyone,
>
>I would like to know if it is possible to subtract or filter a certain color
>range. I have attached a photograph of a core(acquired while drilling the
>hole looking for oil). From the image, three different major features (in
>terms of color) can be seen, light brown, dark brown and gray.
>
>http://www.nabble.com/file/p17182225/2010.00-2020.00%2Bm.jpg
>2010.00-2020.00+m.jpg .
>
>What I would like to do is to know the total height of the sand(light and
>dark brown) in the image removing the gray stuff which is shale/clay.
>Therefore, if I could filter the gray stuff out, I can then plot a profile,
>knowing that the low value(or black) is the shale/clay and the rest is sand.
>
>The problem I have now is, when I plot a gray scale profile, it will not be
>possible to differentiate the shale from sand as the shale seem to be
>brighter than the dark brown sand.
>
>Any advice on this matter is very much appreciated. Thanks guys/gals.
>--
>View this message in context:
>http://www.nabble.com/Filtering-certain-color-range-tp17182225p17182225.html
>Sent from the ImageJ mailing list archive at Nabble.com.


Surely you may "filter" your images but be aware that with RGB-images
there is no spectral filtering as you may know it from filtering
coloured light. With this respect it is even questionable whether the
term "filter" is adequate.

First you should realize what RGB means, then you may look for
certain combinations in the three colour channels that characterize
the relevant regions of your images. Then you can separately treat
these regions...

HTH
--

                   Herbie

          ------------------------
          <http://www.gluender.de>
Reply | Threaded
Open this post in threaded view
|

Re: Filtering certain color range

Duane and Julie
In reply to this post by rasheed-3
First of all, yes, you can filter a certain color range.

For your particular problem, I converted the image to L*a*b* space and  
then used the a* channel.

The new image is now noticeably bimodal in the center of the histogram  
with some spikes at either end.  I thresholded the image to leave the  
bimodal section and then drew a line for the profile.  It seemed to be  
effective.

If you were to spend more than the 60 seconds I did, you would  
probably get pretty good results.

    duane

On May 12, 2008, at 10:36 PM, rasheed wrote:

> Hi there everyone,
>
> I would like to know if it is possible to subtract or filter a  
> certain color
> range. I have attached a photograph of a core(acquired while  
> drilling the
> hole looking for oil). From the image, three different major  
> features (in
> terms of color) can be seen, light brown, dark brown and gray.
>
> http://www.nabble.com/file/p17182225/2010.00-2020.00%2Bm.jpg
> 2010.00-2020.00+m.jpg .
>
> What I would like to do is to know the total height of the  
> sand(light and
> dark brown) in the image removing the gray stuff which is shale/clay.
> Therefore, if I could filter the gray stuff out, I can then plot a  
> profile,
> knowing that the low value(or black) is the shale/clay and the rest  
> is sand.
>
> The problem I have now is, when I plot a gray scale profile, it will  
> not be
> possible to differentiate the shale from sand as the shale seem to be
> brighter than the dark brown sand.
>
> Any advice on this matter is very much appreciated. Thanks guys/gals.
> --
> View this message in context: http://www.nabble.com/Filtering-certain-color-range-tp17182225p17182225.html
> Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Filtering certain color range

Fabrice Senger
In reply to this post by rasheed-3
rasheed a écrit :

> Hi there everyone,
>
> I would like to know if it is possible to subtract or filter a certain color
> range. I have attached a photograph of a core(acquired while drilling the
> hole looking for oil). From the image, three different major features (in
> terms of color) can be seen, light brown, dark brown and gray.
>
> http://www.nabble.com/file/p17182225/2010.00-2020.00%2Bm.jpg
> 2010.00-2020.00+m.jpg .
>
> What I would like to do is to know the total height of the sand(light and
> dark brown) in the image removing the gray stuff which is shale/clay.
> Therefore, if I could filter the gray stuff out, I can then plot a profile,
> knowing that the low value(or black) is the shale/clay and the rest is sand.
>
> The problem I have now is, when I plot a gray scale profile, it will not be
> possible to differentiate the shale from sand as the shale seem to be
> brighter than the dark brown sand.
>
> Any advice on this matter is very much appreciated. Thanks guys/gals.
>  
hi,

you might try in different color spaces, i guess your images are RGB, I
would give a try in CIELab...try the color space converter plugin.

Cheers,

Fabrice.

--
Senger Fabrice
Reply | Threaded
Open this post in threaded view
|

Re: Filtering certain color range

Sami Badawi-2
In reply to this post by rasheed-3
Hi Rasheed,

It should be pretty straightforward to write this filter as an ImageJ
PlugInFilter:

1: Find the color that you want to filter. Just put the mouse over it
in ImageJ and it will give you 3 coordinates for the RGB components.
2: Select a max distance of what colors will be considered the same as
the filter color you chose
3: Run through all the pixels in the image and see if the color on a
given pixel has a smaller distance to your filter color, if so replace
that pixel with black.

This seem like it could be useful, I will put a filter like this in
the next version of my little plugin ShapeLogic.

Here is a little code that might be useful for your to write it yourself filter:

public class ColorUtil {

        public static final int BLUE_MASK = 0xff;
        public static final int GREEN_MASK = 0xff00;
        public static final int RED_MASK = 0xff0000;

        //Saving in this sequence gives the option of saving alpha too
        public static final int RED_POS = 2;
        public static final int GREEN_POS = 1;
        public static final int BLUE_POS = 0;

        public static final int GREEN_OFFSET = 8;
        public static final int RED_OFFSET = 16;

        /** Split color coded as int into 3 int. */
        static public int[] splitColor(int colorIn) {
                int[] iArray = new int[3];
                iArray[RED_POS] = (colorIn&RED_MASK)>>RED_OFFSET; //red
                iArray[GREEN_POS] = (colorIn&GREEN_MASK)>>GREEN_OFFSET; //green
                iArray[BLUE_POS] = colorIn&BLUE_MASK; //blue
                return iArray;
        }

        /** Split color coded as int into 3 int. */
        static public int[] splitColor(int colorIn, int[] iArray) {
                if (iArray == null)
                        iArray = new int[3];
                iArray[RED_POS] = (colorIn&RED_MASK)>>RED_OFFSET; //red
                iArray[GREEN_POS] = (colorIn&GREEN_MASK)>>GREEN_OFFSET; //green
                iArray[BLUE_POS] = colorIn&BLUE_MASK; //blue
                return iArray;
        }

        /** Distance between 2 colors split into arrays of int. */
        static public double distance(int[] color1, int[] color2) {
                int minLength = Math.min(color1.length, color2.length);
                if (minLength == 0)
                        return 0.;
                double distanceResult = 0.;
                for (int i = 0; i < minLength; i++) {
                        distanceResult += Math.abs(color1[i] - color2[i]);
                }
                return distanceResult / minLength;
        }

-Sami Badawi
http://www.shapelogic.org
Reply | Threaded
Open this post in threaded view
|

Re: Filtering certain color range

Sami Badawi-2
Hi again Rasheed,

I got a better look at your image, and I do not think that you can use
a simple color distance filter, since the gray in your image has big
brightness variations. You could make the simple distance filter and
first filter one small gray color area. Save the image and select a
new small gray color and filter that.

Otherwise you could translate each of the RGB pixels to HSB and try to
filter on a interval in that space.

The class java.awt.Color has a method for that:

static float[] RGBtoHSB(int r, int g, int b, float[] hsbvals)

-Sami Badawi
http://www.shapelogic.org
Reply | Threaded
Open this post in threaded view
|

Re: Filtering certain color range

Robert Dougherty
In reply to this post by rasheed-3
Rasheed,

Check out the plugin Threshold_Colour on Gabriel Landini's site:
http://www.dentistry.bham.ac.uk/landinig/software/software.html

Bob

Robert P. Dougherty, Ph.D.
President, OptiNav, Inc.
[hidden email]
Phone (425) 467-1118
Cell (425) 891-4883
Fax (425) 467-1119
www.optinav.com
-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
rasheed


I would like to know if it is possible to subtract or filter a certain color
range.
Reply | Threaded
Open this post in threaded view
|

Re: Filtering certain color range

Carl Sebeny
In reply to this post by rasheed-3
Consider the following expression:

        (R*R + G*G + B*B) - (R*G + R*B +G*B)

If R, G and B are the red, green and blue intensity levels for a pixel then the expression will be nil for any shade of grey (black thru white) and not nil for non-grey pixels. By coding a routine to compute the above expression for each pixel within an image and counting the occurrences of nil values, one can determine the number of grey and non-grey pixels within an image.

Carl Sebeny
Applied Vision, Inc.
eMail: [hidden email]


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of rasheed
Sent: Monday, May 12, 2008 10:37 PM
To: [hidden email]
Subject: Filtering certain color range

Hi there everyone,

I would like to know if it is possible to subtract or filter a certain color
range. I have attached a photograph of a core(acquired while drilling the
hole looking for oil). From the image, three different major features (in
terms of color) can be seen, light brown, dark brown and gray.

http://www.nabble.com/file/p17182225/2010.00-2020.00%2Bm.jpg
2010.00-2020.00+m.jpg .

What I would like to do is to know the total height of the sand(light and
dark brown) in the image removing the gray stuff which is shale/clay.
Therefore, if I could filter the gray stuff out, I can then plot a profile,
knowing that the low value(or black) is the shale/clay and the rest is sand.

The problem I have now is, when I plot a gray scale profile, it will not be
possible to differentiate the shale from sand as the shale seem to be
brighter than the dark brown sand.

Any advice on this matter is very much appreciated. Thanks guys/gals.
--
View this message in context: http://www.nabble.com/Filtering-certain-color-range-tp17182225p17182225.html
Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Filtering certain color range

Barthel, Kai Uwe
In reply to this post by rasheed-3
Hello,

you can try different color spaces and segmentation approaches with  
the "3D Color Inspector" plugin
http://rsb.info.nih.gov/ij/plugins/color-inspector.html
Take a small copy of your image, open it with the plugin and then  
select any segmentation mode.
You can change the segmentation by changing the depth slider and by  
rotating the color space. Try different color spaces to find out which  
approach might be the best.

  Kai

Am 13.05.2008 um 04:36 schrieb rasheed:

> Hi there everyone,
>
> I would like to know if it is possible to subtract or filter a  
> certain color
> range. I have attached a photograph of a core(acquired while  
> drilling the
> hole looking for oil). From the image, three different major  
> features (in
> terms of color) can be seen, light brown, dark brown and gray.
>
> http://www.nabble.com/file/p17182225/2010.00-2020.00%2Bm.jpg
> 2010.00-2020.00+m.jpg .
>
> What I would like to do is to know the total height of the  
> sand(light and
> dark brown) in the image removing the gray stuff which is shale/clay.
> Therefore, if I could filter the gray stuff out, I can then plot a  
> profile,
> knowing that the low value(or black) is the shale/clay and the rest  
> is sand.
>
> The problem I have now is, when I plot a gray scale profile, it will  
> not be
> possible to differentiate the shale from sand as the shale seem to be
> brighter than the dark brown sand.
>
> Any advice on this matter is very much appreciated. Thanks guys/gals.
> --
Reply | Threaded
Open this post in threaded view
|

Re: Filtering certain color range

Michael Schmid
In reply to this post by Carl Sebeny
Hi,

This looks like a problem for Principal Component Analysis (PCA)
to me - you will find such plugins by searching the web for
"ImageJ plugin pca" or
"ImageJ plugin Principal-Component-Analysis".

PCA will automatically select a suitable way to segment the
color space.

To reduce image noise, you can try preprocessing by an
edge-conserving smoothing algorithm:
Anisotropic Diffusion or Sigma filter, on the ImageJ web site,
   http://rsb.info.nih.gov/ij/plugins/
Thresholded Blur or Surface Blur on the Documentation wiki
   http://imagejdocu.tudor.lu/imagej-documentation-wiki/plugins

Michael
________________________________________________________________

On 14 May 2008, at 14:25, Carl Sebeny wrote:

> Consider the following expression:
>
>         (R*R + G*G + B*B) - (R*G + R*B +G*B)
>
> If R, G and B are the red, green and blue intensity levels for a  
> pixel then the expression will be nil for any shade of grey (black  
> thru white) and not nil for non-grey pixels. By coding a routine to  
> compute the above expression for each pixel within an image and  
> counting the occurrences of nil
>  values, one can determine the number of grey and non-grey pixels  
> within an image.
>
> Carl Sebeny
> Applied Vision, Inc.
> eMail: [hidden email]
>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf  
> Of rasheed
> Sent: Monday, May 12, 2008 10:37 PM
> To: [hidden email]
> Subject: Filtering certain color range
>
> Hi there everyone,
>
> I would like to know if it is possible to subtract or filter a  
> certain color
> range. I have attached a photograph of a core(acquired while  
> drilling the
> hole looking for oil). From the image, three different major  
> features (in
> terms of color) can be seen, light brown, dark brown and gray.
>
> http://www.nabble.com/file/p17182225/2010.00-2020.00%2Bm.jpg
> 2010.00-2020.00+m.jpg .
>
> What I would like to do is to know the total height of the sand
> (light and
> dark brown) in the image removing the gray stuff which is shale/clay.
> Therefore, if I could filter the gray stuff out, I can then plot a  
> profile,
> knowing that the low value(or black) is the shale/clay and the rest  
> is sand.
>
> The problem I have now is, when I plot a gray scale profile, it  
> will not be
> possible to differentiate the shale from sand as the shale seem to be
> brighter than the dark brown sand.
>
> Any advice on this matter is very much appreciated. Thanks guys/gals.
> --
> View this message in context: http://www.nabble.com/Filtering- 
> certain-color-range-tp17182225p17182225.html
> Sent from the ImageJ mailing list archive at Nabble.com.