2017-04-08 84 views
1

無法捕捉到圖像,請大家幫忙 相機活躍,但不保存在點擊按鈕圖像(SWIFT)如何捕捉圖像GPUIMAGE 2

var rendeView = RenderView() 
var filter = RGBAdjustment() 

override func viewDidLoad() { 
    rendeView = RenderView(frame: CGRect(x: 0, y: 179, width: UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height - 179)) 

    do { 
     var camera = try Camera(sessionPreset:AVCaptureSessionPreset640x480) 
     filter.red = 0.0 
     camera --> filter --> rendeView 
     camera.startCapture() 
     view.addSubview(rendeView) 
    } catch { 
     fatalError("Could not initialize rendering pipeline: \(error)") 
    } 
    view.bringSubview(toFront: takePhotobutton) 
    view.bringSubview(toFront: testimview) 
} 


@IBAction func takeApicture(_ sender: UIButton) 
{ 
    code? 

}


如何捕捉圖像和顯示的ViewController

回答

-1
@IBAction func takeApicture(_ sender: UIButton) 
{ 


let pictureOutput = PictureOutput() 
pictureOutput.encodedImageFormat = .JPEG 
pictureOutput.encodedImageAvailableCallback = {imageData in 

// Do something with the NSData 
//Convert this NSData to UIImage and place this image to your imageView to the next screen. 

} 
filter --> pictureOutput 
} 

希望這會有所幫助。

+0

如果您不知道,請不要嘗試分散注意力。 –