How to get the image information??

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

How to get the image information??

Xin ZHOU
Hello, everyone,

I'm trying to seperate some images by their content.
The problem is that I use "ij.process.ImageProcessor.convertToFloat".

I doute this operation lose a lot of information.
Because after that the imageJ cannot seperate clearly the color image
and grey-level image.
However, the SIFT operator seems to be based on it, and nothing can be
changed.

So my question is :
- Did anybody know what happens during the "convertToFloat" operation?
Did color information (usually 3 matrix) lose?
- If so, how to catch the lost information?

cheers, Xin
Reply | Threaded
Open this post in threaded view
|

Otsu

Franklin Shaffer-2
I'm using the Otsu 8 bit filter in ImageJ.  Apparently it applies a global threshold to the entire image.

Is there a version of the Otsu filter that uses a local threshold on subdivisions of the image?

Much thanks,
Frank Shaffer
Senior Research Engineer
DOE National Energy Technology Laboratory
Reply | Threaded
Open this post in threaded view
|

Re: How to get the color information?? (isColorLut and isPseudoColorLut do not help)

Xin ZHOU
In reply to this post by Xin ZHOU
Wayne Rasband a écrit :

>> I'm using ij.jar for programming.
>> How can I know one image is in color so that I can separate it from
>> the others??
> Dear Xin,
>
> RGB color images use a ColorProcessor. The getRGB() of the
> ColorProcessor class returns the image as three byte arrays, which can
> be easily converted into three ByteProcessors.
>
> -wayne
Hello, Wayne, and the others

Thanks a lot for your answers.
But my question is GreyLevel images are mixed with color ones.
How can I separate them? If I use ColorProcessor, this means I know
already they are color ones.
I've tried the methods : isColorLut and isPseudoColorLut.
Surprisingly it doesn't work. It return false to all images, even color
ones.

Any idea for that ??

cheers, Xin
Reply | Threaded
Open this post in threaded view
|

Re: How to get the color information?? (isColorLut and isPseudoColorLut do not help)

Joris FA Meys
try getType() from ImagePlus. If the return is 3 or 4, your image is in
color.
Kind regards
Joris

On Thu, Feb 5, 2009 at 5:31 PM, Xin ZHOU <[hidden email]> wrote:

> Wayne Rasband a écrit :
>
>> I'm using ij.jar for programming.
>>> How can I know one image is in color so that I can separate it from the
>>> others??
>>>
>> Dear Xin,
>>
>> RGB color images use a ColorProcessor. The getRGB() of the ColorProcessor
>> class returns the image as three byte arrays, which can be easily converted
>> into three ByteProcessors.
>>
>> -wayne
>>
> Hello, Wayne, and the others
>
> Thanks a lot for your answers.
> But my question is GreyLevel images are mixed with color ones.
> How can I separate them? If I use ColorProcessor, this means I know already
> they are color ones.
> I've tried the methods : isColorLut and isPseudoColorLut.
> Surprisingly it doesn't work. It return false to all images, even color
> ones.
>
> Any idea for that ??
>
> cheers, Xin
>
Reply | Threaded
Open this post in threaded view
|

Re: How to get the color information?? (isColorLut and isPseudoColorLut do not help)

Xin ZHOU
Hi, thanks a lot Joris.

Unfortunately this only solve half of my problem.
The question is : some grey-level images are saved as color_RGB. That's
awful.
So getType() shows that they are color images. But they are not.
The three values for each pixel are the same.

It there any clever way to identify the image type?

cheers, Xin

joris meys a écrit :

> try getType() from ImagePlus. If the return is 3 or 4, your image is in
> color.
> Kind regards
> Joris
>
> On Thu, Feb 5, 2009 at 5:31 PM, Xin ZHOU <[hidden email]> wrote:
>
>  
>> Wayne Rasband a écrit :
>>
>>    
>>> I'm using ij.jar for programming.
>>>      
>>>> How can I know one image is in color so that I can separate it from the
>>>> others??
>>>>
>>>>        
>>> Dear Xin,
>>>
>>> RGB color images use a ColorProcessor. The getRGB() of the ColorProcessor
>>> class returns the image as three byte arrays, which can be easily converted
>>> into three ByteProcessors.
>>>
>>> -wayne
>>>
>>>      
>> Hello, Wayne, and the others
>>
>> Thanks a lot for your answers.
>> But my question is GreyLevel images are mixed with color ones.
>> How can I separate them? If I use ColorProcessor, this means I know already
>> they are color ones.
>> I've tried the methods : isColorLut and isPseudoColorLut.
>> Surprisingly it doesn't work. It return false to all images, even color
>> ones.
>>
>> Any idea for that ??
>>
>> cheers, Xin
>>
>>    
>
>  
Reply | Threaded
Open this post in threaded view
|

Re: How to get the color information?? (isColorLut and isPseudoColorLut do not help)

Joris FA Meys
Hi Xin,

The only thing I can think about is pick some random pixels and check if the
values in different channels are the same. If they differ, then you have a
color image. If they don't, you have a grey image.

it would be something like

     boolean grey = true;
     int x = 0; in y = 0;
     in count=0
     while (grey & count<100){
          x = Round(Math.random()*img.getWidth());
          y = Round(Math.random()*img.getHeight());
          red=img.getPixel(x,y)[0];
          green=img.getPixel(x,y)[1];
          blue=img.getPixel(x,y)[2];
          if(red!=green | red !=blue | green=!blue) grey=false;
          count++;
     }

I use the random method as I believe that in quite some images the first x
rows will be the same, as they're often black. If the values are the same
for 100 random pixels, it should be a grey image.

Hope this works.

Kind regards
Joris

On Thu, Feb 5, 2009 at 9:56 PM, Xin ZHOU <[hidden email]> wrote:

> Hi, thanks a lot Joris.
>
> Unfortunately this only solve half of my problem.
> The question is : some grey-level images are saved as color_RGB. That's
> awful.
> So getType() shows that they are color images. But they are not.
> The three values for each pixel are the same.
>
> It there any clever way to identify the image type?
>
> cheers, Xin
>
> joris meys a écrit :
>
>  try getType() from ImagePlus. If the return is 3 or 4, your image is in
>> color.
>> Kind regards
>> Joris
>>
>> On Thu, Feb 5, 2009 at 5:31 PM, Xin ZHOU <[hidden email]> wrote:
>>
>>
>>
>>> Wayne Rasband a écrit :
>>>
>>>
>>>
>>>> I'm using ij.jar for programming.
>>>>
>>>>
>>>>> How can I know one image is in color so that I can separate it from the
>>>>> others??
>>>>>
>>>>>
>>>>>
>>>> Dear Xin,
>>>>
>>>> RGB color images use a ColorProcessor. The getRGB() of the
>>>> ColorProcessor
>>>> class returns the image as three byte arrays, which can be easily
>>>> converted
>>>> into three ByteProcessors.
>>>>
>>>> -wayne
>>>>
>>>>
>>>>
>>> Hello, Wayne, and the others
>>>
>>> Thanks a lot for your answers.
>>> But my question is GreyLevel images are mixed with color ones.
>>> How can I separate them? If I use ColorProcessor, this means I know
>>> already
>>> they are color ones.
>>> I've tried the methods : isColorLut and isPseudoColorLut.
>>> Surprisingly it doesn't work. It return false to all images, even color
>>> ones.
>>>
>>> Any idea for that ??
>>>
>>> cheers, Xin
>>>
>>>
>>>
>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to get the color information?? (isColorLut and isPseudoColorLut do not help)

Gabriel Landini
In reply to this post by Xin ZHOU
On Thursday 05 February 2009 20:56:00 Xin ZHOU wrote:
> Unfortunately this only solve half of my problem.
> The question is : some grey-level images are saved as color_RGB. That's
> awful.
> So getType() shows that they are color images. But they are not.
> The three values for each pixel are the same.

But are they? Imagine you digitise/scan a radiograph, the colour of the film
base (sometimes bluish) will probably be in the final image, so the 3 channels
do not have the same data. Yet the data could be claimed to be monochromatic.
Or an old b/w photo in sepia tones. Those do not have the same data in the RGB
channels either.
I wonder if this would work: convert the images to HSB and see what
information is in the hue channel, taking care that unsaturated pixels might
have a random hue.
So you will need to do some more programming, I do not think that there is a
single function that tells whether an image is rgb or monochrome encoded as
rgb.

Cheers,
G.
Reply | Threaded
Open this post in threaded view
|

Re: How to get the color information?? (isColorLut and isPseudoColorLut do not help)

Gabriel Landini
In reply to this post by Joris FA Meys
On Thursday 05 February 2009 21:35:17 joris meys wrote:
> The only thing I can think about is pick some random pixels and check if
> the values in different channels are the same. If they differ, then you
> have a color image. If they don't, you have a grey image.

That would not work. If you hit a black/grey/white pixel in a colour image one
would wrongly assume that it is grey, when it is not.

G.
Reply | Threaded
Open this post in threaded view
|

Re: How to get the color information?? (isColorLut and isPseudoColorLut do not help)

Joris FA Meys
On Thu, Feb 5, 2009 at 11:01 PM, Gabriel Landini <[hidden email]>wrote:

> On Thursday 05 February 2009 21:35:17 joris meys wrote:
> > The only thing I can think about is pick some random pixels and check if
> > the values in different channels are the same. If they differ, then you
> > have a color image. If they don't, you have a grey image.
>
> That would not work. If you hit a black/grey/white pixel in a colour image
> one
> would wrongly assume that it is grey, when it is not.
>
> G.
>
That's true, if you would check 1 pixel. But if you check 100 of them,
chances are unlikely they all are going to be black or grey when they're
not.

You have a point though with the sepia images or scanned pictures. There
this would not work at all. I would think about a statistical routine based
on the difference between the channels (one would expect the mean difference
to be bigger in color images), but that's a lot of work. If it's not a huge
set of pictures, it might not be worth the effort.

Kind regards
Joris