maplemaple
maplemaple

Reputation: 1715

How to implement radial motion blur by Python OpenCV?

I can find motion blur kernel in horizontal and vertical direction, e.g. this link.

However, how can I implement radial motion blur like following pictures? I can find this functionality in Photoshop etc. I cannot find any kernel reference in website. How can I implement it by python opencv? Thanks

enter image description here

Upvotes: 1

Views: 1120

Answers (1)

Cris Luengo
Cris Luengo

Reputation: 60614

I don't think OpenCV has something like this built-in, but DIPlib has: dip.AdaptiveGauss(). It blurs the image with a different Gaussian at every pixel. One image indicates the orientation of the Gaussian, another one indicates the scaling.

This is how I replicated your blurred image:

import diplib as dip

img = dip.ImageRead('rose.jpg')

scale = dip.CreateRadiusCoordinate(img.Sizes()) / 100
angle = dip.CreatePhiCoordinate(img.Sizes())
out = dip.AdaptiveGauss(img, [angle, scale], [1,5])

dip.Show(out)

rose blurred with radial motion blur

Disclaimer: I'm an author of DIPlib.

Upvotes: 3

Related Questions