Blur and Masking

Moderator: jsachs

Robert Schleif
Posts: 340
Joined: May 1st, 2009, 8:28 pm

Blur and Masking

Post by Robert Schleif »

When an unmasked pixel is being blurred, at least with Gaussian blur, nearby pixels are sampled, whether or not they are masked. Consequently, halos are generated around masked objects. It seems more logical to me, and certainly would be more useful, if blurring would only sample unmasked pixels, or sample pixels in proportion to an amount governed by the mask. Is there some downside to such a method that I'm not seeing?
den
Posts: 856
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Blur and Masking

Post by den »

Please post an illustration....

Gaussian Blur is a radius gradient blur method and a halo might be minimized by a mask edge gradient... where as Bilaterial Sharpen can be used as a blur as well but retain edges without halo's and no mask is generally needed [skin smoothing for example].
Robert Schleif
Posts: 340
Joined: May 1st, 2009, 8:28 pm

Re: Blur and Masking

Post by Robert Schleif »

The maximum blur radius in bilateral sharpen seems to be 20 pixels, and when the radius is set high, it takes very long to perform the transformation. I'd like to use a radius a lot larger than 20. Den, we both agree that blur samples and averages pixels independently of a mask. All that a mask does is determine whether or not a pixel will be replaced with its Gaussian-weighted local average. The image below shows an original image on the left. In the middle is how I would expect the left image to look if the red rectangle were fully masked and a large radius blurr were applied. The right hand image shows what you actually get. Does anyone know an easy way to produce the middle image from the left-hand image with PWP?[/img]
Example2.JPG
Example2.JPG (11.25 KiB) Viewed 7852 times
ksinkel
Posts: 594
Joined: April 2nd, 2009, 11:58 am
Contact:

Re: Blur and Masking

Post by ksinkel »

Robert,

The red area blurs into the white area not because the red is being blurred -- it is not if you have masked it -- but because the white area which is unmasked is being blurred. Remember the white area is as much of a feture as the red area.

There are two ways around this. One is to mask only the black areas and the apply the blur to masked rather than unmasked areas.

The other is to mask the outlines that you want to be unblurred on both sides of the edge. The width of the mask would have to be wider than the blur radius. This second technique would work for this particular image because the areas are solid colors and have no details, but it would not be as generally applicatble as the first method.

Kiril
Kiril Sinkel
Digital Light & Color
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Blur and Masking

Post by jsachs »

The reason masked-out pixels are included in the blur is that there would be a huge performance hit to do so, particularly for large blurring radius. This is the reason bilateral blurring is so much slower than gaussian blurring and advanced sharpen is so much slower than sharpen.
Jonathan Sachs
Digital Light & Color
Robert Schleif
Posts: 340
Joined: May 1st, 2009, 8:28 pm

Re: Blur and Masking

Post by Robert Schleif »

OK, but perhaps blurring that does not draw information from masked areas could be available as an option? I'd like to significantly blur the backgrounds of flowers, and the present behavior makes this difficult.
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Blur and Masking

Post by jsachs »

You could try using Bilateral Sharpen with a mask - with the right settings (see white paper) it can be used to blur and it suppresses halos automatically. Or use Advanced Sharpen and a mask (without the sharpen phase) which is similar.
Jonathan Sachs
Digital Light & Color
MikeG
Posts: 243
Joined: April 25th, 2009, 4:36 pm
What is the make/model of your primary camera?: Panasonic G1
Location: Sydney, Australia

Re: Blur and Masking

Post by MikeG »

Robert,
I like to blur the backgrounds of flowers, too. One method that is not too tedious is to:
1. Mask the flower(s) and blur the background.
2. Crop the flower out of the image and resize 5% larger.
3. Do the same with the mask.
4. Use the composite transform to overlay the 5%-larger-flower over the flower in the blurred image.

Below are the ex camera jpeg.
An image produced as described above. (Not that it matters for this topic but I derived this image from RAW to partially recover blown highlights)
A 1:1 crop from the final image.

Is this the sort of effect you're after? What method do you use?

Mike.
P1150358.JPG
P1150358.JPG (47.07 KiB) Viewed 7680 times
P1150358-1.JPG
P1150358-1.JPG (46.09 KiB) Viewed 7679 times
Attachments
P1150358-1-1.JPG
P1150358-1-1.JPG (44.67 KiB) Viewed 7682 times
den
Posts: 856
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Blur and Masking

Post by den »

MikeG... a great approach for radius background blurs that are less than the upsize scaling although there is a potential for loss of fine detail unless re-captured because of the Resize...

...perhaps for large radius backgound blurs, a drop-shadow mask of the of the composite-blend halo area could be used to adjust the tone/color of the halo to make it less obvious...

(1) create a Mask1 of the flower
(2) blur the original image, Img1, and Mask1; creating Img2 and Mask2
(3) composite-blend Img1 with its blurred version, Img2, using Mask1; creating Img3
(4) click on Img3, open the Mask Tool - Combine Masks and 'lower-left' Apply-Add Mask2 to Img3, then 'lower--left' Apply-Subtract Mask1; leave the Mask Tool 'active' on Img3
(5) click on Img3 and adjust halo tone/color using ColorCurves or ColorCorrect or Remap or a combination to de-emphasize the halo surrounding the flower edges; click OK, creating Img4.
ScrnView01_400px.jpg
ScrnView01_400px.jpg (42.47 KiB) Viewed 7635 times
Charles2
Posts: 225
Joined: November 24th, 2009, 2:00 am
What is the make/model of your primary camera?: Fuji X-Pro 2
Contact:

Re: Blur and Masking

Post by Charles2 »

Thanks to PWP fellow users. These suggestions do more than teach a specific technique. They open eyes to other potential manipulations with PWP.

I must say about this topic that, for blurred background and other reasons, it has been a pleasure to get a couple of legacy manual focus lenses for my Olympus E-P1. They render color transitions in a way that few modern lenses (in my budget price range) seem to match.

As for blur, these lenses produce it gradually going into the distance. Here is a modest example. Shot, by the way, through a polycarbonate (Lexan) window.

http://farm5.static.flickr.com/4011/470 ... 8978_b.jpg
Post Reply