Upgrade to Pro — share decks privately, control downloads, hide ads and more …

240fps で画像処理したい

240fps で画像処理したい

Swift 愛好会 2024/04/26

Megabits_mzq

April 26, 2024
Tweet

More Decks by Megabits_mzq

Other Decks in Programming

Transcript

  1. class func overlayBlendMode() -> any CIFilter & CICompositeOperation CGAffineTransform(translationX: 0,

    y: CGFloat(lastIndex * 1)) 今のフレーム 前のフレーム 重なったフレーム 保存
  2. let trans = CGAffineTransform(translationX: 0, y: CGFloat(lastIndex * 1)) let

    movedImage = ciImage.transformed(by: trans) cachedCIImage = movedImage.composited(over: cachedCIImage!)
  3. CIImage Although a CIImage object has image data associated with

    it, it is not an image. You can think of a CIImage object as an image “recipe.” A CIImage object has all the information necessary to produce an image, but Core Image doesn’t actually render an image until it is told to do so. This lazy evaluation allows Core Image to operate as efficiently as possible.
  4. class func overlayBlendMode() -> any CIFilter & CICompositeOperation CGAffineTransform(translationX: 0,

    y: CGFloat(lastIndex * 1)) 今のフレーム 前のフレーム 重なったフレーム 保存 CIImage に変換 CGImage に変換
  5. filter2.transform = CATransform3DMakeTranslation(0, Self.count * 1, 0) filter2.inputImage = image

    filter.inputImage = filter2.outputImage! filter.inputBackgroundImage = previousImage let rendered = try! Self.render.render(filter.outputImage!, using: Self.renderContext).pixelBuffer CapturePipeline.previousImage = MTIImage(cvPixelBuffer: rendered, alphaType: .alphaIsOne) CIImage -> MTIImage CIFilter -> MTIFilter
  6. class func overlayBlendMode() -> any CIFilter & CICompositeOperation CGAffineTransform(translationX: 0,

    y: CGFloat(lastIndex * 1)) 今のフレーム 前のフレーム 重なったフレーム FeedBack MTIImage に変換 CVPixelBuffer に変換