How to make an avatar from photo

How to make an avatar from a photo like in facebook spaces. What are the basic steps for this?

This can get complicated. To create such a thing you will need something like OpenCv that recognizes the facial features. just search for the search term “opencv haarcascade” and you will get an idea. By that you can get the position of the nose, eyes, hears and so on. After that you will have to design a few facial features in different styles. For example long hair, short hair with different hair colors, different noses, different mouths, etc. After that you can create the avatar with all the informations from opencv.
Good luck!