How to smooth edges of polygons?

7 Ansichten (letzte 30 Tage)
m975
m975 am 12 Okt. 2017
Kommentiert: m975 am 19 Okt. 2017
I created a image (uint8) with multiple filled polygons. First, I used the vision.ShapeInserter with 'Antialiasing' but this was not enough. Also insertShape + 'SmoothEdges' produced insufficient smooth edges. Are there any other ways how I can fix that?
Looking forward to your suggestions. Thanks!

Antworten (2)

Andrew Chen
Andrew Chen am 12 Okt. 2017
Perhaps imopen with a disk structuring element will provide the functionality you are looking for?
Ex:
se = strel('disk',5);
new_img = imopen(original_image,se);
Hope this helps!
  3 Kommentare
Andrew Chen
Andrew Chen am 13 Okt. 2017
Did Image Analyst's answer get you what you wanted? Otherwise, maybe you could clarify what you mean by "smooth edges". What in your mind constitutes a sufficiently smooth edge?
m975
m975 am 13 Okt. 2017
For example, in this image polygons show proper edges without these awful "stairs" when the shapes get rotated. By the way, this image was drawn in photoshop. But now I have to create a lot of stimuli in MATLAB by using coordinates for my polygons. Consequently, I am looking for a MATLAB routine to generate images of same quality. I hope this explanation helps. Thanks!

Melden Sie sich an, um zu kommentieren.


Image Analyst
Image Analyst am 13 Okt. 2017
You can smooth the edges with a filter. See attached.
  8 Kommentare
m975
m975 am 13 Okt. 2017
I processed the image as follows but it did not work.
level = graythresh(I);
BW = im2bw(I, level);
You can still see these toothed edges:
m975
m975 am 19 Okt. 2017
Finally, the easiest workaround was to create very big images (5000 x 5000 px) and, subsequently, resize them to the favored stimulus size. Now edges look sexy again!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by