Filter a color

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

Filter a color

AnnaKlaus
Hello dear community,

I made vidoes to understand the flow better in a shear chamber.
Already converting the images in grayframes, I tried to analyse them in Matlab. But it didn' work that fine.
So, I though about filtering the pink color. See the image below.



The problem is I have no idea how to do this:(!
I would be really grateful about any help, because I really work since some days on it, but can not get a good solution!

Thank you very much!!!!!!!!!!!!!!!
Reply | Threaded
Open this post in threaded view
|

Re: Filter a color

Stephan Saalfeld
Hi AnnaKlaus,

have a look at Gabriel Landini's Colour Deconvolution

http://www.dentistry.bham.ac.uk/landinig/software/cdeconv/cdeconv.html

or check the outcome of the CMYK-transfer

http://rsbweb.nih.gov/ij/plugins/cmyk/index.html

It's not clear to me if you want to see or not see the pink color.

Best,
Stephan




On Mon, 2010-09-20 at 04:38 -0700, AnnaKlaus wrote:

> Hello dear community,
>
> I made vidoes to understand the flow better in a shear chamber.
> Already converting the images in grayframes, I tried to analyse them in
> Matlab. But it didn' work that fine.
> So, I though about filtering the pink color. See the image below.
>
> http://imagej.588099.n2.nabble.com/file/n5550044/Colour0010.png 
>
> The problem is I have no idea how to do this:(!
> I would be really grateful about any help, because I really work since some
> days on it, but can not get a good solution!
>
> Thank you very much!!!!!!!!!!!!!!!
Reply | Threaded
Open this post in threaded view
|

Re: Filter a color

Stephan Saalfeld
In reply to this post by AnnaKlaus
The color being so obvious, you could also find it in HSB.  This is a
simple macro that creates a mask of that pink circle:

setForegroundColor(0, 20, 0);
newImage("green", "RGB Black", 250, 187, 1);
run("Select All");
run("Fill", "slice");
imageCalculator("Add create", "Colour0010.png","green");
run("HSB Stack");
run("Next Slice [>]");
run("Delete Slice");
run("Next Slice [>]");
run("Delete Slice");
setThreshold(0, 200);
run("Convert to Mask");
run("Despeckle");

Best,
Stephan



On Mon, 2010-09-20 at 04:38 -0700, AnnaKlaus wrote:

> Hello dear community,
>
> I made vidoes to understand the flow better in a shear chamber.
> Already converting the images in grayframes, I tried to analyse them in
> Matlab. But it didn' work that fine.
> So, I though about filtering the pink color. See the image below.
>
> http://imagej.588099.n2.nabble.com/file/n5550044/Colour0010.png 
>
> The problem is I have no idea how to do this:(!
> I would be really grateful about any help, because I really work since some
> days on it, but can not get a good solution!
>
> Thank you very much!!!!!!!!!!!!!!!
Reply | Threaded
Open this post in threaded view
|

Re: Filter a color

AnnaKlaus
Hello Stephan,

thank you very much for posting me the macro.
I run the macro on ImageJ, but...just see:
and
Did I do something wrong!

At the end of the filter I want to have the area which is covered by the pink colour, seperated from the background!
Thank you very much Stephan!
Because I am kind of lost!

AnnaKlaus:)!
Reply | Threaded
Open this post in threaded view
|

Re: Filter a color

Gabriel Landini
On Monday 20 Sep 2010  16:06:30 AnnaKlaus <[hidden email]> wrote:
> At the end of the filter I want to have the area which is covered by the
> pink colour, seperated from the background!

I would use the transmittance method:

Keep a copy of your image, then
Process a Max filter of size 4 or so to it,
Process a Min filter of size 4 or so to the above (this is greyscale closing)
Now the result should be an image with no pink ring (or almost).
Now use the Calculator_Plus (not the Image calculator!!) to Divide the
original by the closed image.  Use the value of 255 in the first box

a macro to do this is:

run("Duplicate...", "title=closed");
run("Maximum...", "radius=4");
run("Minimum...", "radius=4");
run("Calculator Plus", "i1=Colour0010.png i2=closed operation=[Divide: i2 =
(i1/i2) x k1 + k2] k1=255 k2=0 create");

Now edit the image and paint everything which is not the pink ring with white.

You could use that image to remove the ring from other images (assuming that
the ring does not move in the other images by doing this:

run("Calculator Plus", "i1=Colour0010.png i2=Result operation=[Divide: i2 =
(i1/i2) x k1 + k2] k1=255 k2=0 create");

I attached the result I get with that.
Regards

Gabriel

Result.png (131K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Filter a color

AnnaKlaus
Thank you Gabriel....

but the thing is that I specially want to see the pink ring!
Because it gives me information how fast the ring gets bigger during the rotation of the device.
I am sorry that I could not explain my problem very well!
...Do you thing there is an opportunity to do this?

Best regards

AnnaKlaus
Reply | Threaded
Open this post in threaded view
|

Re: Filter a color

Gabriel Landini
On Monday 20 Sep 2010  17:14:29 you wrote:
> but the thing is that I specially want to see the pink ring!
> Because it gives me information how fast the ring gets bigger during the
> rotation of the device.
> I am sorry that I could not explain my problem very well!
> ...Do you thing there is an opportunity to do this?

You can try the Threshold_Colour in my page (not the one built in IJ because
it cannot record macros).

http://www.dentistry.bham.ac.uk/landinig/software/thresholdcolour.zip

With that, I recorded this, whcih may help:

// Colour Thresholding v1.12-------
// Autogenerated macro, single images only!
// G Landini 19/Dec/2009.
//
min=newArray(3);
max=newArray(3);
filter=newArray(3);
a=getTitle();
run("HSB Stack");
run("Convert Stack to Images");
selectWindow("Hue");
rename("0");
selectWindow("Saturation");
rename("1");
selectWindow("Brightness");
rename("2");
min[0]=194;
max[0]=241;
filter[0]="pass";
min[1]=38;
max[1]=255;
filter[1]="pass";
min[2]=140;
max[2]=255;
filter[2]="pass";
for (i=0;i<3;i++){
  selectWindow(""+i);
  setThreshold(min[i], max[i]);
  run("Convert to Mask");
  if (filter[i]=="stop")  run("Invert");
}
imageCalculator("AND create", "0","1");
imageCalculator("AND create", "Result of 0","2");
for (i=0;i<3;i++){
  selectWindow(""+i);
  close();
}
selectWindow("Result of 0");
close();
selectWindow("Result of Result of 0");
rename(a);
// Colour Thresholding-------------
Reply | Threaded
Open this post in threaded view
|

Re: Filter a color

Gluender-4
In reply to this post by AnnaKlaus
Anna,

I just tried the "Colour Transform" PlugIn with Colour space "Lab".

Scroll to the "a"-channel and adjust B&C. This should do the job, at
least as a first step.

You may save the Lab-stack, then open it, then delete the "L" and the
"b"-channels and work with the remaining image.


>Thank you Gabriel....
>
>but the thing is that I specially want to see the pink ring!
>Because it gives me information how fast the ring gets bigger during the
>rotation of the device.
>I am sorry that I could not explain my problem very well!
>...Do you thing there is an opportunity to do this?
>
>Best regards
>
>AnnaKlaus
>--
>View this message in context:
>http://imagej.588099.n2.nabble.com/Filter-a-color-tp5550044p5550984.html
>Sent from the ImageJ mailing list archive at Nabble.com.

HTH
--

                   Herbie

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

Re: Filter a color

AnnaKlaus
In reply to this post by Gabriel Landini
Dear Gabriel,

thank you very, very much!!!!
I think this macros works pretty well!
Now, ääähm, I am sorry, but I do not have much experience with ImageJ.
Could you maybe explain me, what the program does?
Is it possible to view the images after each step?
Thanks a lot again! You are a great help!

Reply | Threaded
Open this post in threaded view
|

Re: Filter a color

Stephan Saalfeld
In reply to this post by AnnaKlaus
Hi AnnaKlaus,

surprising!  With the image that you've posted, I get that result:

http://fly.mpi-cbg.de/~saalfeld/test/Result%20of%20Colour0010.png

May be, you've tried it with another image where the clumsiness of the
macro actually matters ;)

In any case, you got a serious solution by Gabriel now!

Best,
Stephan



On Mon, 2010-09-20 at 07:59 -0700, AnnaKlaus wrote:

> Hello Stephan,
>
> thank you very much for posting me the macro.
> I run the macro on ImageJ, but...just see:
> http://imagej.588099.n2.nabble.com/file/n5550813/green.png 
> and
> http://imagej.588099.n2.nabble.com/file/n5550813/Result_of_Colour0010.png 
> Did I do something wrong!
>
> At the end of the filter I want to have the area which is covered by the
> pink colour, seperated from the background!
> Thank you very much Stephan!
> Because I am kind of lost!
>
> AnnaKlaus:)!
Reply | Threaded
Open this post in threaded view
|

Re: Filter a color

Gluender-4
In reply to this post by Gabriel Landini
Gabriel,

having taken the opportunity to try your PlugIn "thresholdcolour"
just for the reason of pure curiosity, I should like to tell you that
I judge it an excellent piece of software.

Thanks

                   Herbie

          ------------------------
          <http://www.gluender.de>

>On Monday 20 Sep 2010  17:14:29 you wrote:
>>  but the thing is that I specially want to see the pink ring!
>>  Because it gives me information how fast the ring gets bigger during the
>>  rotation of the device.
>>  I am sorry that I could not explain my problem very well!
>>  ...Do you thing there is an opportunity to do this?
>
>You can try the Threshold_Colour in my page (not the one built in IJ because
>it cannot record macros).
>
>http://www.dentistry.bham.ac.uk/landinig/software/thresholdcolour.zip
>
>With that, I recorded this, whcih may help:
>
>// Colour Thresholding v1.12-------
>// Autogenerated macro, single images only!
>// G Landini 19/Dec/2009.
>//
>min=newArray(3);
>max=newArray(3);
>filter=newArray(3);
>a=getTitle();
>run("HSB Stack");
>run("Convert Stack to Images");
>selectWindow("Hue");
>rename("0");
>selectWindow("Saturation");
>rename("1");
>selectWindow("Brightness");
>rename("2");
>min[0]=194;
>max[0]=241;
>filter[0]="pass";
>min[1]=38;
>max[1]=255;
>filter[1]="pass";
>min[2]=140;
>max[2]=255;
>filter[2]="pass";
>for (i=0;i<3;i++){
>   selectWindow(""+i);
>   setThreshold(min[i], max[i]);
>   run("Convert to Mask");
>   if (filter[i]=="stop")  run("Invert");
>}
>imageCalculator("AND create", "0","1");
>imageCalculator("AND create", "Result of 0","2");
>for (i=0;i<3;i++){
>   selectWindow(""+i);
>   close();
>}
>selectWindow("Result of 0");
>close();
>selectWindow("Result of Result of 0");
>rename(a);
>// Colour Thresholding-------------
Reply | Threaded
Open this post in threaded view
|

Re: Filter a color

Gabriel Landini
On Tuesday 21 Sep 2010  11:01:15 Gluender wrote:
> having taken the opportunity to try your PlugIn "thresholdcolour"
> just for the reason of pure curiosity, I should like to tell you that
> I judge it an excellent piece of software.

Thanks Herbie!
The plugin is based on a Hue band pass filter that Bob Dougherty wrote some
time ago, so thanks to Bob too.

Regards

Gabriel