Blur and Masking

Moderator: jsachs

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... had a thought and am curious regarding your technique for your illustrated image...

What happens to the fine detail of the flower petals IF... instead of Resizing the main subject [the flower] to be 5% larger, the background is Resized 5% smaller?

That way the Resize softening occurs in the blurred background rather than in the main subject. Of course, there may be a mask 'Invert' consideration required depending upon how you set up the final Composite-Blend and the resulting image would either have the reduced background pixel dimensions or require a crop to those dimensions... perhaps also a 1point shift alignment needed to center the smaller image on the larger... but the main subject size would not be changed from its original.
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 »

Den,
I've tried both of your suggestions and they both give excellent results. However I can only see the difference between the results of these techniques and my basic 'just-make-the-flower-bigger' approach on the closest inspection.
If I've understood correctly, your concern, and the purpose of the two approches you suggested, is to completely retain the original pixel detail of the subject of the image, in this case the flower.
Given the choice between two techniques of similar ease-of-use, the one that completely preserves this orignal detail is obviously the one to prefer.
Your second suggestions fits the bill, to my mind, but I do have one reservation and that is the result is a 'non-standard' sized image in pixels.

Now every time that I crop a 4,000 x 3,000 image and resize back to 4,000 x 3,000 I'll feel a little bit guilty! Well, maybe for the first half-dozen...

Mike.
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 »

Yep... you are right... a 5% scaling change for an image's dimensions or for its masked image area does not seem to have much softening unless you deeply 'pixel peek' and when you take into account 'Output Sharpening' for printing... the 'softening' concern appears moot... at least for a couple of my test images.

Over the years, I have recognized that changing an image's dimensions or dimensions of a portion of its image area is not a 'lossless' manipulation because of the needed algorithms used by image editors, so generally avoid Resize, Warp, Rotation, 2-point (shift/rotate/scale), Level, etc... whenever possible or at least performed with a follow-up step of a "Sharpen with Amount = 20->40%".

As for an image's final dimensions, I will 'crop for composition' with a specific aspect ratio [width/height] and generally use a minimum of 200 dpi [or ppi] to determine maximum print size.... for some reason, I don't seem to be able to consistently 'compose' with the camera's viewfinder... feeling fortunate at times to capture a fast moving critter anywhere in-frame!

'Combined Composition Guides' suggested/posted here may be of renewed interest: http://www.dl-c.com/board/viewtopic.php?f=4&t=15 where 'Combing' should read 'Combining Composition Guides'.
Robert Schleif
Posts: 340
Joined: May 1st, 2009, 8:28 pm

Re: Blur and Masking

Post by Robert Schleif »

Mike's expansion method is particularly elegant, and sufficiently simple that I can reproduce it by remembering to expand the flower over the halo generated by blurring. Charles2 however, points out the virtue of a big lens and that a gradual transition between objects in focus and out of focus looks more natural. In light of that, perhaps it is time for program architects to "focus" on transforms that can help make images generated by small lenses look a big lens was used. For example, Gaussian blurring with a radius determined by mask intensity or a adjustable bokeh transform.
Robert Schleif
Posts: 340
Joined: May 1st, 2009, 8:28 pm

Re: Blur and Masking

Post by Robert Schleif »

The expansion solution by MikeG is lovely, and sufficiently simple that I can remember it. The example by Charles2 however, points out the value of a large aperture lens and that images look more natural if they pass smoothly from regions of high sharpness to regions of high blur. This new point raises the question that perhaps it is time for architects of image processing programs to provide more tools for making an image generated by an inexpensive small aperture lens look like the image from an expensive, large aperture lens. For example, blurring in which the blur radius is proportional to mask intensity, and an adjustable bokeh transform.
tomczak
Posts: 1370
Joined: April 25th, 2009, 12:56 am
What is the make/model of your primary camera?: Fuji X-E2
Contact:

Re: Blur and Masking

Post by tomczak »

A bit off original topic, but related to restricting DOF artificially: there is a simple technique of blurring foreground and background artificially which should work in most landscape-like images:

- make a 3-point vertical gradient, setting the two end points to black and the midpoint to white. To make the DOF asymmetric and thereby more natural, add 2 more gray points around the mid point.
- position the midpoint to the area of the image that needs to be in focus.
- gaussian blur the image through the mask.

This works, but it is not interactive (i.e. the position of the focal plane and the range of the depth of field has to be premade semi blindly). Since this and other gradients are often used as masks, would it be possible to add the possibility of creating gradients within the mask tool and make the process interactive?
Maciej Tomczak
Phototramp.com
tomczak
Posts: 1370
Joined: April 25th, 2009, 12:56 am
What is the make/model of your primary camera?: Fuji X-E2
Contact:

Re: Blur and Masking

Post by tomczak »

There is an article on PS lens blur:

http://www.digital-image.co.nz/PDF%20fi ... 0Focus.pdf

It argues that the lens blur looks more natural (plus it has other useful options all in one transformation). I did a simple experiment on the artificial image from the article, and it looks to me that blurring with bilateral sharpen (but not with the advanced sharpen which I can't convince to blur the pure b&w image) renders similarly-looking results.

Would people be willing to help in experimenting with it a bit more and exchange the results on the board?

p.s. How different, numerically, is the blurring in bilateral sharpen, without any thresholds, from a gaussian blur?
Maciej Tomczak
Phototramp.com
Dieter Mayr
Posts: 453
Joined: April 24th, 2009, 11:47 am
What is the make/model of your primary camera?: Nikon D700
Location: Salzburg / Austria

Re: Blur and Masking

Post by Dieter Mayr »

I played around a bit with the images in the article that Maciej posted.
I like the effect of Bilateral Sharpen, but for my taste the transition between the blurred region it's background is too harsh, so i tried to paut a soft Gaussian Blur afterwards.
I took the "lines and dots" image form the article and used the following settings:
Bilateral Sharpen : Radius 9 and Threshold 100%, Sharpen sliders both to 0.
followed by:
Gaussian Blur with Radius 2, Amount and Threshold 100%.

I cropped the upper left region of the boy's picture in the PDF and used the same values as above:
Just the Bilateral Sharpen:
BS_Test.png
BS_Test.png (41.02 KiB) Viewed 5696 times
and with additional Gaussian Blur:
BSplusGB_Test.png
BSplusGB_Test.png (35.43 KiB) Viewed 5695 times
The later has to my taste and opinion a nicer, softer virtual "Bokeh".
Dieter Mayr
Robert Schleif
Posts: 340
Joined: May 1st, 2009, 8:28 pm

Re: Blur and Masking

Post by Robert Schleif »

The 20 pixel radius of Bilateral Sharpening is too small for blurring a background, and it would be nice to be able to blur with a Guassian radius of 25 to 100 pixels in which a mask could prevent sampling from certain areas. Earlier, Jonathan pointed out the very high computational load that would be imposed by allowing masks to limit the pixels being sampled. Blurring need not be "pixel perfect" however. Therefore, the following might reduce the computational load to the point where Large Radius Maskable Blurring could be feasible.

1. Compute the value of a blurred pixel by sampling only 1/25 or less of the adjacent pixels, e.g. the central pixel in a 5 x 5 square, that is employ sparse sampling rather than full sampling. For large blurring radii, this should be fine.
2. Compute the blurred pixel value for only a small fraction of the pixels, say 1/25 or less.
3. Consider masks to be all or none, i.e. 0, or 1, no intermediate values.
4. After the sparsly blurred image is generated, compute the values of the missing pixels by the same algorithm that is used for upsizing.

Steps 1 and 2 combine to speed calculations by a factor approach 25 x 25 = 625. Step 3 will slow things somewhat, but step 4 takes only a few seconds. Overall, it looks like it may be feasible to provide a large radius maskable blurring transformation.
tonygamble
Posts: 112
Joined: April 26th, 2009, 7:00 am

Re: Blur and Masking

Post by tonygamble »

Now I am a committed m4/3 user I had started to forget about the speckled, sparkly, bokeh I used to enjoy. These two shots were taken with a telephoto zoom but the effect rarely appears with normal lenses (and never with wide angle)

Image
Image

I tried to get a 'bokeh' thread on DPR to think beyond the bounds of making the out of focus area 'misty' or 'foggy' - but to no avail.

Does anyone around here have some suggestions as to how I could achieve this with PWP?

Tony
Post Reply