Login  Register

Re: binary image inversion irritation

Posted by ctrueden on Sep 09, 2013; 3:57pm
URL: http://imagej.273.s1.nabble.com/binary-image-inversion-irritation-tp5004727p5004730.html

Hi Rainer,

> Is there a way to make an image binary with an expression or formula,
> all pixels darker 128 become 0, brighter ones become white?

If you have an active threshold set, the "Make Binary" command will respect
it when converting to a binary image. So in a macro, you can do something
like:

IJ.setThreshold(imp, 85, 170);
IJ.run(imp, "Make Binary", "thresholded remaining black");
// be careful whether your data has a black background or a white one,
though.

You can also have total control over the binarization using a custom macro.
Run Process > Math > Macro and try e.g.:

if (v<=104) v=0; else v=255

HTH,
Curtis


On Mon, Sep 9, 2013 at 9:11 AM, Rainer M. Engel <[hidden email]> wrote:

> Dear all,
>
> I have to convert my 8bit images to binary images, containing only black
> and white (0 & 255) pixels. That is OK and offers a wide range of
> processing possibilities.
>
> Imagine I have these two images (both are binary)
> https://dl.dropboxusercontent.com/u/414433/imagej/bitbin/09.png
> https://dl.dropboxusercontent.com/u/414433/imagej/bitbin/12.png
>
> I didn't forget the settings..
> //important values to set
> run("Colors...", "foreground=white background=black selection=yellow");
> run("Options...", "iterations=1 black edm=Overwrite count=1");
>
> But image 12.png is inverted if I make it binary again. This happens
> even if I blur it before that. I understand that Making Binary is some
> sort of threshold process, which may in some situation swap or invert my
> image.
>
> Is there a way to make an image binary with an expression or formula,
> all pixels darker 128 become 0, brighter ones become white?
>
> Best Regards,
> Rainer
>
>
> --
> Rainer M. Engel, Dipl. Digital Artist
> scientific|Media GbR
> Pichelsdorfer Str. 143
> 13595 Berlin
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html