Closed JuniperPhoton closed 8 years ago
Hi,
Have you given taken a look at the DepthOfField Extras? We realized that the smooth transition lens blur is an effect that is hard to achieve, so we created several samples to help developers. They can be found right here on GitHub, and will show you how to achieve a smooth transition between kernels and how to generate a mask with the SDK, without having to worry about the WriteableBitmap.
For your case in particular we have written the EllipticFocusDepthOfFieldEffect (https://github.com/Microsoft/Lumia-imaging-sdk/blob/master/Extras/Lumia.Imaging.Extras.ImageProviders/Lumia.Imaging.Extras.ImageProviders.Shared/DepthOfField/EllipticFocusDepthOfFieldEffect.cs). You can use that as inspiration, or include it as source code in your application, or just use pieces of it!
Please take a look at the entire concepts, including tests: https://github.com/Microsoft/Lumia-imaging-sdk/tree/master/Extras/Lumia.Imaging.Extras.ImageProviders/Lumia.Imaging.Extras.ImageProviders.Shared/DepthOfField
As for your sample code in particular, I see two obvious shortcomings:
Please note that the size of the kernels themselves should also depend on the size of your image.
Thanks for replying. EllipticFocusDepthOfFieldEffect does help :-D !
I want there is a
smooth transition
between the focus area and the unfocus area. However, whatever I try, the transition between those two area isarbitrary
.Here is my code: