A Look Cameras Once Needed Big Lenses For
Professional portraits often have a sharp subject against a soft, creamy blur. For a long time, that effect required a proper camera with a large lens, because of the physics of how such lenses focus light. Phone cameras have tiny lenses and sensors, which naturally keep almost everything in focus. So when a phone produces that same blurred-background portrait, it is not doing it the way a big camera does. It is recreating the look by other means.
Why Real Blur Happens
In a traditional camera, the blur comes from something called depth of field. A large lens with a wide opening can bring one distance into sharp focus while everything nearer or farther falls out of focus and goes soft. The bigger the lens and opening, the stronger the effect. A phone's little lens simply cannot create much of this on its own, which is why an ordinary phone photo tends to be sharp from front to back.
How a Phone Fakes It
Portrait mode solves this with information and software rather than optics. The phone first works out which parts of the scene are close and which are far away, building a rough depth map of the picture. It may do this using two cameras viewing the scene from slightly different angles, a dedicated depth sensor, or clever software that recognizes the shape of a person. Once the phone knows what is the subject and what is background, it keeps the subject sharp and digitally blurs everything behind it, imitating the soft fall-off of a big lens.
Where It Slips Up
Because the blur is calculated rather than captured, it is not perfect. The phone has to guess exactly where the subject ends and the background begins, and fine, complicated edges are hard. Stray strands of hair, the gap inside a mug handle, or the arms of a pair of glasses are common places where the effect goes slightly wrong, leaving a wisp of hair blurred or a background sliver left sharp. As the depth-sensing and software improve, these mistakes grow rarer, but they reveal that the blur is being painted on, not formed by the lens.
Source
This article was written using information from Wikipedia.