【问题标题】:How to capture image GPUIMAGE 2如何捕获图像 GPUIMAGE 2
【发布时间】:2018-08-27 12:38:07
【问题描述】:

我无法捕获图像。 相机处于活动状态,但点击按钮未保存图像

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?

【问题讨论】:

    标签: ios swift gpuimage


    【解决方案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
    }
    

    【讨论】:

    • 如果你不知道请不要试图分散注意力。
    猜你喜欢
    • 1970-01-01
    • 2016-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多