Ask Your Question

How to refine the edges of an image?

asked 2017-01-05 00:28:18 -0500

AJ94 gravatar image

updated 2017-01-10 00:41:11 -0500

berak gravatar image

Hi all,

I extracted the following object using grabcut alogrithm.

image description

However, i wish to have more refined edges of the extracted object. Is there any filer which can be used here? I tried with bilateral filter,but the output was not satisfactory.

I am using opencv and python. Thanks in advance

edit retag flag offensive close merge delete


How about making a binary mask first, then smooth that mask and use it as some sort of alpha channel for transparency? That might make it more appealing. How about this.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-01-05 06:29:14 -0500 )edit

@StevenPuttemans Hey thanks for the answer. But this is not what i was looking for. Turns out that,the image was of very low resolution,hence the distortion in the edges.

AJ94 gravatar imageAJ94 ( 2017-01-09 01:26:38 -0500 )edit

Hmmm you can also take a look at the work of Michal Irani, she has worked on edge preservation and noise/blurring removal to sharpen up images and get the edges back stronger and undeformed.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-01-10 00:30:59 -0500 )edit

Thanks. I'll take a look into it

AJ94 gravatar imageAJ94 ( 2017-01-10 22:29:21 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-03-28 15:39:04 -0500

updated 2017-03-28 15:46:11 -0500

blur = cv2.GaussianBlur(img,(5,5),0)
smooth = cv2.addWeighted(blur,1.5,img,-0.5,0)

this will do the work, you can adjust the kernel size for the blur according to your requirement..

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-01-05 00:28:18 -0500

Seen: 12,824 times

Last updated: Mar 28 '17