Last active
November 1, 2019 19:35
Revisions
-
josephjoeljo revised this gist
Nov 1, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,6 +28,7 @@ guard let monoFormat = vImage_CGImageFormat( } let result = try? destinationBuffer.createCGImage(format: monoFormat) if let result = result { imageView.image = UIImage(cgImage: result) } -
josephjoeljo renamed this gist
Nov 1, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
josephjoeljo revised this gist
Nov 1, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ // vim: syntax=Swift Swift Color matrix let redCoefficient: Float = 0.2126 -
josephjoeljo revised this gist
Nov 1, 2019 . 1 changed file with 31 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,31 @@ Swift Color matrix let redCoefficient: Float = 0.2126 let greenCoefficient: Float = 0.7152 let blueCoefficient: Float = 0.0722 let divisor: Int32 = 0x1000 let fDivisor = Float(divisor) var coefficientsMatrix = [ Int16(redCoefficient * fDivisor), Int16(greenCoefficient * fDivisor), Int16(blueCoefficient * fDivisor) ] let preBias: [Int16] = [0, 0, 0, 0] let postBias: Int32 = 0 guard let monoFormat = vImage_CGImageFormat( bitsPerComponent: 8, bitsPerPixel: 8, colorSpace: CGColorSpaceCreateDeviceGray(), bitmapInfo: CGBitmapInfo(rawValue: CGImageAlphaInfo.none.rawValue), renderingIntent: .defaultIntent) else { return } let result = try? destinationBuffer.createCGImage(format: monoFormat) if let result = result { imageView.image = UIImage(cgImage: result) } -
josephjoeljo created this gist
Nov 1, 2019 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ Swift Color matrix