Page 1 of 1

-lat doesn't give binary image

Posted: 2015-05-06T16:39:31-07:00
by inwelkin@gmail.com
I have a jpg image that I want to do lat on.
The command I ran is following: convert img.jpg +compress -colorspace Gray -lat 17 img_lat.tif
The output image is grayscale, instead of binary. Please see the images at the links.
https://drive.google.com/file/d/0B1YGJ1 ... sp=sharing
https://drive.google.com/file/d/0B1YGJ1 ... sp=sharing
Please advice!

Re: -lat doesn't give binary image

Posted: 2015-05-06T16:48:35-07:00
by fmw42
try

-lat 17x17+X%

where X is larger than zero.

If you use 0, then it will not seem to do the lat. If X is too small, you will get a lot of noise.

This seems OK to me, but you can vary the X.

Code: Select all

convert Image_01.jpg +compress -colorspace Gray -lat 17x17+5% img_lat.tif

What version of IM and what platform are you using?

Re: -lat doesn't give binary image

Posted: 2015-05-06T16:54:57-07:00
by inwelkin@gmail.com
-lat 17x17+1% gives binary output. Thanks a lot! Any suggestions why the difference?
I am using IM-6.7.8 on linux.

Re: -lat doesn't give binary image

Posted: 2015-05-06T16:57:33-07:00
by fmw42
If you use 0, then it will not seem to do the lat. If X is too small, you will get a lot of noise.

This seems OK to me, but you can vary the X.

Code: Select all

convert Image_01.jpg +compress -colorspace Gray -lat 17x17+5% img_lat.tif

Re: -lat doesn't give binary image

Posted: 2015-05-06T17:04:17-07:00
by fmw42
If you want to see more solid regions, then make your window size (17) larger. Try 25x25 and see the difference. If the window is larger than the largest region, then all of them should be more solid.

Re: -lat doesn't give binary image

Posted: 2015-05-06T17:10:23-07:00
by inwelkin@gmail.com
Yes, I increased the window size to 35. Looks good. Out of curiosity: why is lat not appropriately performed when input X is omitted?

Re: -lat doesn't give binary image

Posted: 2015-05-06T17:17:38-07:00
by fmw42
I do not know for sure, but I assume the default is 0. I can only assume that is a bug. But using 0 will produce too much noise anyway and so not terribly useful. You can report that on the Bugs forum if you wish.