<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShaders",
  "identifier" : "/documentation/MetalPerformanceShaders/MPSCNNLocalContrastNormalization/init(device:kernelWidth:kernelHeight:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Metal Performance Shaders"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSCNNLocalContrastNormalization(im)initWithDevice:kernelWidth:kernelHeight:"
  },
  "title" : "init(device:kernelWidth:kernelHeight:)"
}
-->

# init(device:kernelWidth:kernelHeight:)

Initializes a local contrast normalization kernel.

```
init(device: any MTLDevice, kernelWidth: Int, kernelHeight: Int)
```

## Parameters

`device`

The device the kernel will run on.

`kernelWidth`

The width of the kernel.

`kernelHeight`

The height of the kernel.

## Return Value

A valid [`MPSCNNLocalContrastNormalization`](/documentation/MetalPerformanceShaders/MPSCNNLocalContrastNormalization) object or `nil`, if failure.

## Discussion

> Note:
> The value of `kernelWidth` must be equal to the value of `kernelHeight`.

---

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)