Abhishek V. Pai
Abhishek V. Pai

Reputation: 351

smoothing rough edges contour opencv

I have this image

enter image description here

when you zoom it you can see the rough edges like this

enter image description here

I want to smoothen the rough edges such that they form an almost perfect curve/line,some what like this enter image description here

I tried this method Image edge smoothing But I can't seem to save it as a bmp file. I tried Gaussian blur too but didn't get any much affect. The outlines are contours extracted from a binary image. Increasing the thickness of the contours removes the rough edges to a point but it changes the clear definition of the boundaries.

EDIT:-How about filled binary images?

This

enter image description here

to

enter image description here

Dilating would change the boundary too much.

Upvotes: 0

Views: 4487

Answers (1)

Humam Helfawi
Humam Helfawi

Reputation: 20304

What you are looking for is not possible in the manner you are thinking of. As @Miki stated, Digital images have an upper limit of resolution that you can not go further than it.

The solution is to represent your curves as vectorized curves. Then you can render at any resolution you want. One possible solution is to use Bezier Curves to represent the contours (or Spline). Then you may simply draw them with any resize fraction you want.

Here you can find some resources:

Upvotes: 2

Related Questions