Search found 18 matches

by Casper
2016-05-21T18:57:22-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

Yes, I forgot about the default .05 threshold when I originally posted, but have changed the post to set the threshold to 0 exactly. See my previous post and http://www.imagemagick.org/script/command-line-options.php#unsharp. So my compare rmse value is now even smaller. Good stuff! That's great ...
by Casper
2016-05-21T18:29:34-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

Here is another way to do O+(O-GB)-inv(O+inv(GB)) It is a bit simpler in that it adds the 3 parts in one step. That one looks even more different than any of the previous ones. So either IM is not working as expected, because the result is not equivalent to your more complex approach, or then there ...
by Casper
2016-05-21T16:53:24-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

I didn't test it with Scale 2 yet. The only steps I did where the steps for "O+(O-GB)-inv(O+inv(GB))" this replicates PS USM 100, 3, 0, and closest match for IM was your "-unsharp 0x3" example in that case.

If you like I can make a video showing how I do it if that would help?
by Casper
2016-05-21T16:29:13-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

Where is this scale in the PS unsharp masking? I only see amount, radius and threshold. It's in the PS menu "Image/Apply Image...", then select Subtract or Add and you will see Scale and Offset as additional options. You use Apply Image to do the addition and subtraction operations of the formula ...
by Casper
2016-05-21T16:11:44-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

I'll try the whole operation tomorrow manually in PS with Scale 2, and we'll see what we get.
Running out of steam a bit for tonight..:-/
by Casper
2016-05-21T16:08:20-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

I do not know what you mean by "averaging". Do you mean that we need a gain factor of 2? O + 2*(O-GB) rather than O + 1*(O-GB) Yes. That's along the lines I was thinking. Maybe it's worth a shot if you still have the PS blur as source? I think I'm wrong though, like you say it doesn't really make ...
by Casper
2016-05-21T16:00:53-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

Casper wrote:This one looks identical to your IM version which used the PS GS as source,
Bah..forget what I just said. Even with Amount 50% the PS USM version has more contrast.
Maybe I should do 100/3 = 33% since IM is doing 3 math operations.
by Casper
2016-05-21T15:57:45-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

I think I found the answer! This one looks identical to your IM version which used the PS GS as source, Check this out Lena3 PS USM 50, 3, 0: http://i.imgur.com/Aky26Gf.png I think the IM addition and subtraction is doing what PS "Apply Image" does with the "Scale" setting at 2 instead of 1. This ...
by Casper
2016-05-21T15:44:00-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

Ok I took your source and did PS USM to it. You can compare this to the image you created above. It's really strange. There is a big difference in contrast. Almost like the IM addition and subtraction is clipping too much, not allowing the difference to get pronounced enough. Anyway..I don't have ...
by Casper
2016-05-21T15:16:05-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

If I do the gaussian blur of rad=3 in PS and substitute that in my IM script, I get This is really weird. This image should be identical to the PS USM one, but it severely lacks contrast and sharpness compared to PS USM. How can there be such a big difference, since the only steps we are doing now ...
by Casper
2016-05-21T15:12:31-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

Ok..interesting stuff. Some next steps perhaps? 1) Can you post a link to your source image? I'd like to get the exact same one so we're both using the same. Makes it easier to do binary compares then too. 2) Can you post an image using IM for all steps, with clipping (since PS is clipping too ...
by Casper
2016-05-21T14:14:26-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

I did a Gaussian Blur, radius = 3, in PS of a 1 pixel vertical black line on white background. I then looked at a horizontal "cross section" of this blurred vertical line, and the resulting blurred image had the following pixel values (from left to right): 255, 254, 253, 250, 246, 241, 234, 228, 223 ...
by Casper
2016-05-21T13:19:01-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

Woow...well then. That seems to indicate the difference between PS and IM is how GB is calculated(?)
I'll post GB(3) next.
by Casper
2016-05-21T13:11:53-07:00
Forum: Digital Image Processing
Topic: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur
Replies: 50
Views: 117926

Re: The Math Behind Photoshop's Unsharp Mask and Gaussian Blur

Can you reproduce that using PS unsharp mask and if so what values are you using. Presumably the above formula would be for amount=100, and threshold=0. But I do not know what radius 3 means in terms of a gaussian blur the uses radius x sigma values. Here. PS USM, amount = 100, radius = 3 ...