Page 1 of 1

ImageJ Unsharp mask in ImageMagick

Posted: 2016-06-18T18:03:21-07:00
by bhim.rathor
Can somebody please help achieving the ImageJ unsharp mask in ImageMagick. Its available in IMageJ->Process->Filters->UnsharpMask. I need to be able to provide exact same parameters as in this filter i.e. Radius(Sigma) and and Mask Weight(0.1-0.9)

Thanks

Re: ImageJ Unsharp mask in ImageMagick

Posted: 2016-06-18T18:58:12-07:00
by fmw42
for ImageJ sigma=1, mask weight=0.6, try

Code: Select all

-unsharp 0x1+1.6

Re: ImageJ Unsharp mask in ImageMagick

Posted: 2016-06-20T14:56:30-07:00
by bhim.rathor
Thanks for help.

I ran this, however the result is completely different than what ImageJ gives. I tried sigma =100 and mask weight =0.9. I have uploaded in and out images at https://drive.google.com/open?id=0B9dG4 ... 25vX0pSeHM . This is the command i used

convert -unsharp 0x100+1.9 C:\Unsharp\US_IM.tiff C:\Unsharp\US_IM_After.tiff

How do i make it give the same result.

Thanks
Bhim

Re: ImageJ Unsharp mask in ImageMagick

Posted: 2016-06-20T16:07:11-07:00
by fmw42
100 is way too large for a sigma value in IM when ImageJ uses a value of 1.
convert -unsharp 0x100+1.9 C:\Unsharp\US_IM.tiff C:\Unsharp\US_IM_After.tiff
In IM, proper syntax is to read the input before doing any operations on it. See http://www.imagemagick.org/Usage/basics/#syntax and http://legacy.imagemagick.org/script/co ... essing.php.

So try

Code: Select all

convert C:\Unsharp\US_IM.tiff -unsharp 0x1+1.9+0 C:\Unsharp\US_IM_After.tiff

Input:
Image

I get pretty close results for:

ImageJ: sigma=1 and weight 0.6

Image


And IM:

Code: Select all

convert lena.jpg -unsharp 0x1+1.6+0 -depth 8 lena_IM_us_1x1p6x0.tif
Image

Code: Select all

compare -metric rmse lena_IJ_us_1x0p6.tif lena_IM_us_1x1p6x0.tif null:
953.629 (0.0145514)
So only 1.45% different

Without knowing exactly what radius and threshold ImageJ is using, one would have to test quite a bit more to get closer. You can try adjusting the values in IM. See http://legacy.imagemagick.org/script/co ... hp#unsharp