---
title: perspectiveCorrection()
framework: coreimage
role: symbol
role_heading: Type Method
path: coreimage/cifilter-swift.class/perspectivecorrection()
---

# perspectiveCorrection()

Transforms an image’s perspective.

## Declaration

```swift
class func perspectiveCorrection() -> any CIFilter & CIPerspectiveCorrection
```

## Return Value

Return Value The adjusted image.

## Discussion

Discussion This method applies the perspective correction filter to an image. The effect applies a perspective correction transforming nonrectangular area in the source image to a rectangular output image. The perspective correction filter uses the following properties: The following code creates a filter that corrects the perspective to appear straight: func perspectiveCorrection(inputImage: CIImage) -> CIImage {     let perspectiveCorrectionFilter = CIFilter.perspectiveCorrection()     perspectiveCorrectionFilter.inputImage = inputImage     perspectiveCorrectionFilter.topRight = CGPoint(x: 0, y: 3024)     perspectiveCorrectionFilter.topLeft = CGPoint(x: 4032, y: 3024)     perspectiveCorrectionFilter.bottomRight = CGPoint(x: 200, y: 0)     perspectiveCorrectionFilter.bottomLeft = CGPoint(x: 4032, y: 0)     return perspectiveCorrectionFilter.outputImage! }

## See Also

### Filters

- [bicubicScaleTransform()](coreimage/cifilter-swift.class/bicubicscaletransform().md)
- [edgePreserveUpsample()](coreimage/cifilter-swift.class/edgepreserveupsample().md)
- [keystoneCorrectionCombined()](coreimage/cifilter-swift.class/keystonecorrectioncombined().md)
- [keystoneCorrectionHorizontal()](coreimage/cifilter-swift.class/keystonecorrectionhorizontal().md)
- [keystoneCorrectionVertical()](coreimage/cifilter-swift.class/keystonecorrectionvertical().md)
- [lanczosScaleTransform()](coreimage/cifilter-swift.class/lanczosscaletransform().md)
- [perspectiveRotate()](coreimage/cifilter-swift.class/perspectiverotate().md)
- [perspectiveTransform()](coreimage/cifilter-swift.class/perspectivetransform().md)
- [perspectiveTransformWithExtent()](coreimage/cifilter-swift.class/perspectivetransformwithextent().md)
- [straighten()](coreimage/cifilter-swift.class/straighten().md)
