简体   繁体   English

如何捕获图像GPUIMAGE 2

[英]How to capture image GPUIMAGE 2

I can not capture the image. 我无法捕捉到图像。 camera active but not save image on click button 相机处于活动状态但未在单击按钮上保存图像

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?
}

How to capture image and show ViewController? 如何捕获图像并显示ViewController?

@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
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM