Image Editing and Filters
Updated: Jan 22
My implementation of a few image filter effects : Motion Blur, Miniaturize and Content Aware Fill
Motion Blur : I converted an action image without motion blur and added motion blur to it giving it a more realistic and compelling look.
Fist step for this is to use the python grab cut function to segment the subjects. In this case they are the runners. This produces an image that extracts the runners. Then I convert it into a transparent image.
Then I add motion blur effect to the back ground original image. And finally overlay the segmented subjects on the motion blurred background. This makes the subjects look sharp while the background is blurred giving it the motion blur look.
Similar technique can also be used to get this background effect to make images appear like a portrait image taken with a long lens.
Miniaturize - This effect makes normal image look like as if they were miniatures or dioramas.
This is obtained by partially blurring the background while keeping the main object in focus. This miniature effect is seen in images because long lens is used in photographing an image can keep only a part of the image in focus while the rest is blurred due to the shallow depth of field.
The effect can be achieved by :
1. Blurring all parts of the the original image using a Gaussian blur
2. Creating a gradual mask at a general part of the image where we need sharp focus.
3. Multiplying 1 and 2
Content Aware Fill or In-painting : This is used to remove scratches, blemishes and other unwanted artifacts in images using a healing effect.
In this technique, I get the user input for what has to be removed, and then create a black and white mask for the portion which has to be removed. Then I use the inpainting function of python, where I pass the mask and the image. The Inpainting technique uses gradient domain which is a 2 Dimensional concept of applying changes in pixel values or derivatives ( rate of change ).
out = cv2.inpaint(image,mask,3,cv2.INPAINT_TELEA)
Original Photo by istockphoto.com/portfolio/AlexBrylov
Et viola ! magically the blue rope the climber was using to climb has vanished ( with marginal noticeable difference ) and it appears that the climber is climbing without a rope for support !