10
8

More than 1 year has passed since last update.

超解像をとりあえず使ってみるなら、画像ドロップで使えるCoreMLモデルで

Posted at

画像を鮮明に大きくしてくれる超解像を手軽につかう方法です


オリジナル(左)と超解像結果(右)

鮮明なコンテンツ提供に使える超解像モデル、使うのは難しい?

超解像を使えれば、より鮮明に、リッチなサイズで、
ユーザーに提供するコンテンツのクオリティをあげられる可能性がある。

しかし、超解像技術はどうやって使えばいいのだろうか?
複雑な計算が必要なんじゃないの?

CoreMLなら画像ドロップでとりあえず使える

CoreMLモデルなら、画像ドロップでとりあえず超解像モデルが試せる。

アプリへの組み込みもかんたん

アプリへの組み込みも、Xcodeにファイルを入れて、短いコードで呼び出すだけである。

手順

CoreML-ModelsからBSRGANをダウンロードする。

ファイルを開き、Previewタブで画像をドロップする。



画像をモデルファイルにドロップ

プロジェクトに組み込む場合は、Visionで実行する。

guard let model = try? VNCoreMLModel(for: bsrgan(configuration: MLModelConfiguration()).model) else { fatalError("model initialization failed") }
let coreMLRequest = VNCoreMLRequest(model: model)
let handler = VNImageRequestHandler(cvPixelBuffer: pixelBuffer, options: [:])
try? handler.perform([coreMLRequest])
guard let result:CVPixelBuffer = coreMLRequest.results?.first as? VNPixelBufferObservation else { return }

🐣


フリーランスエンジニアです。
お仕事のご相談こちらまで
rockyshikoku@gmail.com

Core MLやARKitを使ったアプリを作っています。
機械学習/AR関連の情報を発信しています。

Twitter
Medium

10
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
8