<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/PhotogrammetrySample/objectMask",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation20PhotogrammetrySampleV10objectMaskSo11CVBufferRefaSgvp"
  },
  "title" : "objectMask"
}
-->

# objectMask

The image’s object mask.

```
var objectMask: CVPixelBuffer? { get set }
```

## Discussion

When a photograph of an object includes surrounding objects, such as
plants, buildings, or people in an outdoor space, you can create an
object mask to exclude the portions of the image that don’t contain the
object. Masking extraneous image data reduces the number of landmarks
RealityKit attempts to match, speeds up the object-creation process, and
produces a more accurate 3D model.

Provide the object mask in
<doc://com.apple.documentation/documentation/CoreVideo/kCVPixelFormatType_OneComponent8>
format and with the same height and width as
[`image`](/documentation/RealityKit/PhotogrammetrySample/image). RealityKit ignores any pixel in
[`image`](/documentation/RealityKit/PhotogrammetrySample/image) when the corresponding pixel in
[`objectMask`](/documentation/RealityKit/PhotogrammetrySample/objectMask) has a value of `0.0` (black) unless
[`isObjectMaskingEnabled`](/documentation/RealityKit/PhotogrammetrySession/Configuration-swift.struct/isObjectMaskingEnabled)
is set to `False` in the session’s configuration.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)