<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Vision",
  "identifier" : "/documentation/Vision/VNInstanceMaskObservation",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Vision"
    ],
    "preciseIdentifier" : "c:objc(cs)VNInstanceMaskObservation"
  },
  "title" : "VNInstanceMaskObservation"
}
-->

# VNInstanceMaskObservation

An observation that contains an instance mask that labels instances in the mask.

```
class VNInstanceMaskObservation
```

## Topics

### Accessing Instances

[`allInstances`](/documentation/Vision/VNInstanceMaskObservation/allInstances)

The collection that contains all instances, excluding the background.

[`instanceMask`](/documentation/Vision/VNInstanceMaskObservation/instanceMask)

The resulting mask that represents all instances.

### Creating a Mask

[`generateMask(forInstances:)`](/documentation/Vision/VNInstanceMaskObservation/generateMask(forInstances:))

Creates a low-resolution mask from the instances you specify.

[`generateMaskedImage(ofInstances:from:croppedToInstancesExtent:)`](/documentation/Vision/VNInstanceMaskObservation/generateMaskedImage(ofInstances:from:croppedToInstancesExtent:))

Creates a high-resolution image where everything becomes transparent black, except for the instances you specify.

[`generateScaledMaskForImage(forInstances:from:)`](/documentation/Vision/VNInstanceMaskObservation/generateScaledMaskForImage(forInstances:from:))

Creates a high-resolution mask where everything becomes transparent black, except for the instances you specify.



---

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)