Skip to content

Instantly share code, notes, and snippets.

@aminbenarieb
Created March 21, 2020 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aminbenarieb/aeb7415ac41ce35cab65a2cc74e83002 to your computer and use it in GitHub Desktop.
Save aminbenarieb/aeb7415ac41ce35cab65a2cc74e83002 to your computer and use it in GitHub Desktop.
private func activeArea(pixelBuffer: CVPixelBuffer) -> CGRect {
let width = CVPixelBufferGetWidth(pixelBuffer)
let height = CVPixelBufferGetHeight(pixelBuffer)
let verticalInset = Double(height) * self.activeInsetProcent
let horizontalInset = Double(width) * self.activeInsetProcent
return CGRect(x: horizontalInset,
y: verticalInset,
width: Double(width) - 2*horizontalInset,
height: Double(height) - 2*verticalInset)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment