TransWikia.com

Obtaining contours of the image

Mathematica Asked by Wagm on May 28, 2021

I would like to obtain contours(outline) of the image (black and white thin curve version of the original image). Outline that would just look nice.

First attempt

I first try using EdgeDetect however result just doesn’t look very good. The shape of the head and torso looks good, however lips and nose looks quite unnatural.

image = Import[
   "https://i.imgur.com/fFmetq6_d.webp?maxwidth=760&fidelity=grand"];
Thinning[EdgeDetect[image]]

enter image description here

Second attempt

I then thought that maybe I should try to detect contour instead first. However ContourDetect seems to loose a lot of detail even with different delta values.

EdgeDetect[ContourDetect[image, 0.5]]

enter image description here

Do you have any idea how could I obtain pretty looking outline of the image?

One Answer

Edgedetect gives a binary image. Faces really aren't binary. Perhaps GradientFilter is worth a look:

Manipulate[GradientFilter[image, {s, t}] // ImageAdjust, 
                                 {s, {1, 2, 3}}, {t, 0, 5}]

Here I used the Manipulate to find "good" values of the parameters of the gradient.

enter image description here

Answered by bill s on May 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP