Skip to content

Instantly share code, notes, and snippets.

View ozgurshn's full-sized avatar

Ozgur Sahin ozgurshn

View GitHub Profile
@ozgurshn
ozgurshn / CVPixelBuffer.swift
Created December 16, 2020 20:02 — forked from giln/CVPixelBuffer.swift
CVPixelBuffer get top most non black pixel values
import CoreVideo
extension CVPixelBuffer {
func searchTopPoint() -> CGPoint? {
// Get width and height of buffer
let width = CVPixelBufferGetWidth(self)
let height = CVPixelBufferGetHeight(self)
let bytesPerRow = CVPixelBufferGetBytesPerRow(self)