12
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

はじめに

Elixir Image に 0.35.0 で追加されたノイズ除去を Livebook で実行、視覚化してみます

実装したノートブックはこちら

セットアップ

必要なモジュールをインストールします

Mix.install([
  {:image, "~> 0.35"},
  {:kino, "~> 0.9"}
])
  • Image: 画像処理
  • Kino: Livebook の UI/UX

画像の準備

"/home/livebook/vix/noise.jpg" のパスに以下の画像が保存されているものとします

noise.png

この画像を Image.open で開きます

noise_image = Image.open!("/home/livebook/vix/noise.png")

ノイズ除去

Image.reduce_noise で中央値フィルタによりノイズ除去を実行します

第2引数 window_size でノイズ除去の強さを制御します(デフォルト 3)

[
  noise_image,
  Image.reduce_noise!(noise_image, 10)
]
|> Kino.Layout.grid(columns: 2)

スクリーンショット 2023-07-10 13.51.08.png

左が元画像、右がノイズ除去後です

小さい点々がなくなっています

まとめ

かなり簡単にノイズ除去が実装できました

12
1
1

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
12
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?