<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vImage/PixelBuffer/applyMorphology(operation:destination:)-5al25",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate6vImageO11PixelBufferVA2A013MultiplePlaneC6FormatRzs5UInt8V13ComponentTypeRtzAH06PlanarcG0_AIRTzrlE15applyMorphology9operation11destinationyAC0M9OperationOy_AHG_AEy_xGtF"
  },
  "title" : "applyMorphology(operation:destination:)"
}
-->

# applyMorphology(operation:destination:)

Applies a morphology operation to the buffer.

```
func applyMorphology(operation: vImage.MorphologyOperation<Format.ComponentType>, destination: vImage.PixelBuffer<Format>)
```

## Parameters

`operation`

The operation that the function applies.

`destination`

The destination pixel buffer.

## Discussion> Precondition: Source and destination buffer must be the same size.

> Precondition: The kernel size width and height must be positive, odd integers in the range

> Precondition: `dilate` and `erode` user defined kernels must contain `width * height` elements.

> Precondition: Source and destination buffers must point to different underlying memory.

---

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)