ios - 如何捕捉图像 GPUIMAGE 2

标签 ios swift gpuimage

我无法捕捉图像。 相机处于事件状态但单击按钮不保存图像

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?

最佳答案

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

关于ios - 如何捕捉图像 GPUIMAGE 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43298097/

相关文章:

ios - 如何将数据加载到 TableView 中

ios - AFNetworking swift JSON AnyObject 转换

ios - 如何解析 didReceiveUserInfo userInfo 参数?一个 __NSSingleObjectArrayI

swift - AUHostMusicalContextBlock "An audio unit accessing this property should cache it in realtime-safe storage before beginning to render."

swift - 如何使用 iOS 11 和 Swift 3 在 UINavigation Bar 的 Stack View 中为 UIButtons 启用点击手势

ios - 在视频上添加 GPUImagePicture

objective-c - GLSL - 如何访问纹理的像素数据是 GLSL 着色器?

objective-c - 在 UITextField 的 editingDidBegin 中显示 UIMenuController

android - 适用于 Android 和 iOS 的应用程序 OpenStreetMap