I've created a simple green screen with GPUImage library and the following code:
import UIKit
import GPUImage
class CaptureViewController: UIViewController {
var videoCamera:GPUImageVideoCamera?
var filter:GPUImageChromaKeyFilter?
@IBOutlet weak var cameraView: GPUImageView!
override func viewDidLoad() {
super.viewDidLoad()
cameraView.backgroundColor = UIColor.clearColor()
videoCamera = GPUImageVideoCamera(sessionPreset: AVCaptureSessionPreset640x480, cameraPosition: .Back)
videoCamera!.outputImageOrientation = .Portrait;
filter = GPUImageChromaKeyFilter()
filter?.setColorToReplaceRed(0.0, green: 1.0, blue: 0.0)
filter?.thresholdSensitivity = 0.4
videoCamera?.addTarget(filter)
filter?.addTarget(cameraView)
videoCamera?.startCameraCapture()
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
}
}
Now I want to change the color from green to where ever the user taps on the video.
Q: How can I get the pixel data from the tapped location?