Augmented reality using sky segmentation
An AR client device generates and uses a background model to identify portions of images that depict the sky. A background model is a model that represents where the sky is visible for the client device. To identify a sky background portion of an image, a client device can map an image onto the background model and thereby determine which portion of the image represents the sky. The client device can use the identified sky background portion to augment the image to include AR content in the sky. To generate the background model, the client device applies a background detection model to a set of images to generate background probability images. The background probability images are mapped onto a background model using orientation data captured by the client device to update the background model based on the background probability image.
1 . A non-transitory computer-readable medium storing instructions that, when executed by a computing system, causes the computing system to perform operations comprising:
accessing a plurality of images captured by a client device, wherein the plurality of images comprises a first subset of images and a second subset of images;
identifying a sky background portion for each image in the first subset of images by applying a background detection model to the image, wherein the background detection model is a machine-learning model that is trained to identify pixels in an image that correspond to a sky background portion of the image;
identifying a sky background portion for each image in the second subset of images by, for each image in the second subset:
accessing a background model associated with the client device, wherein the background model is a model that indicates where sky is visible by the client device;
accessing orientation data describing an orientation of the client device when the image was captured; and
mapping the image onto the background model based on the orientation data;
augmenting each image of the plurality of images by modifying the identified sky background portion of each image of the plurality of images to include augmented-reality content; and
displaying each of the augmented images to a user through the client device.
2 . The computer-readable medium of claim 1 , wherein the plurality of images comprises frames of a video captured by the client device.
3 . The computer-readable medium of claim 2 , the operations further comprising:
assigning images of the plurality of images to the first subset of images based on a regular interval of frames in the video.
4 . The computer-readable medium of claim 1 , wherein mapping the image onto the background model comprises:
determining a field of view of the image based on the orientation data.
5 . The computer-readable medium of claim 1 , wherein the background model comprises a 3D structure that is located a set distance from the client device.
6 . The computer-readable medium of claim 1 , wherein the background model comprises a rectangular prism.
7 . The computer-readable medium of claim 1 , the operations further comprising:
updating the background model based on the identified sky background portions of the first subset of images.
8 . The computer-readable medium of claim 1 , wherein identifying a sky background portion for each image in the second subset of images comprises:
detecting an occlusion by an object based on the image; and
modifying the identified sky background portion based on the detected occlusion.
9 . The computer-readable medium of claim 8 , wherein detecting an occlusion comprises:
computing a color distribution of pixels in the identified sky background portion.
10 . The computer-readable medium of claim 8 , wherein detecting an occlusion comprises:
comparing pixel color values of pixels in the identified sky background portion to a set of reference pixel color values.
11 . A computer-implemented method comprising:
accessing a plurality of images captured by a client device, wherein the plurality of images comprises a first subset of images and a second subset of images;
identifying a sky background portion for each image in the first subset of images by applying a background detection model to the image, wherein the background detection model is a machine-learning model that is trained to identify pixels in an image that correspond to a sky background portion of the image;
identifying a sky background portion for each image in the second subset of images by, for each image in the second subset:
accessing a background model associated with the client device, wherein the background model is a model that indicates where sky is visible by the client device;
accessing orientation data describing an orientation of the client device when the image was captured; and
mapping the image onto the background model based on the orientation data;
augmenting each image of the plurality of images by modifying the identified sky background portion of each image of the plurality of images to include augmented-reality content; and
displaying each of the augmented images to a user through the client device.
12 . The computer-implemented method of claim 11 , wherein the plurality of images comprises frames of a video captured by the client device.
13 . The computer-implemented method of claim 12 , the operations further comprising:
assigning images of the plurality of images to the first subset of images based on a regular interval of frames in the video.
14 . The computer-implemented method of claim 11 , wherein mapping the image onto the background model comprises:
determining a field of view of the image based on the orientation data.
15 . The computer-implemented method of claim 11 , wherein the background model comprises a 3D structure that is located a set distance from the client device.
16 . The computer-implemented method of claim 11 , wherein the background model comprises a rectangular prism.
17 . The computer-implemented method of claim 11 , the operations further comprising:
updating the background model based on the identified sky background portions of the first subset of images.
18 . The computer-implemented method of claim 11 , wherein identifying a sky background portion for each image in the second subset of images comprises:
detecting an occlusion by an object based on the image; and
modifying the identified sky background portion based on the detected occlusion.
19 . The computer-implemented method of claim 18 , wherein detecting an occlusion comprises:
computing a color distribution of pixels in the identified sky background portion.
20 . The computer-implemented method of claim 18 , wherein detecting an occlusion comprises:
comparing pixel color values of pixels in the identified sky background portion to a set of reference pixel color values.