diff --git a/ALGORITHM.md b/ALGORITHM.md index 522b63f..6c20e48 100644 --- a/ALGORITHM.md +++ b/ALGORITHM.md @@ -1,44 +1,48 @@ # Algorithm はじめに理想的な動画を用いての説明を行い,その後に実際の動画に適用する.理想的な動画とはバーチャル背景が赤色,オブジェクトが黄色,部屋が水色である動画とする.ここではオブジェクトが右から左へ横切ることを想定している. -![sample_01.gif](https://github.com/Tsuku43/zoomg/blob/master/images/sample_01.gif?raw=true) +![sample_01.gif](images/algorithm/sample_01.gif) ※フレーム数確保のため速度を落としている. ## 手法 基本的な考え方としては,バーチャル背景が部屋を即座に隠すことを利用し,各ピクセルごとに出現時間が短い色を選ぶことで部屋を復元する.以下の画像は理想的な動画の同一部分を拡大し並べたものである. -![sample_01_1-10.png](https://github.com/Tsuku43/zoomg/blob/master/images/sample_01_1-10.png?raw=true) +![sample_01_1-10.png](images/algorithm/sample_01_1-10.png) バーチャル背景とオブジェクトの色には部屋の色よりも幅があり長時間表示されているため,出現頻度が高くなりやすい.よって,最も出現頻度が低い水色が,部屋の色だと決定できる.実際にはピクセルごとに処理を行うため,ある程度のフレーム数が必要である.以下の画像は理想的な動画の座標 500,500 の色を時間軸を横にとり,並べたものである. -![sample_01_500_500_check.png](https://github.com/Tsuku43/zoomg/blob/master/images/sample_01_500_500_check.png?raw=true) +![sample_01_500_500_check.png](images/algorithm/sample_01_500_500_check.png) 水色が最も少ないことがわかる.フレーム数と動画長が増加するほど復元の精度が向上する.問題はバーチャル背景と部屋の色が境界で混ざり合う場合である.これはバーチャル背景と部屋の色差を利用して,排除している.バーチャル背景は先に説明した部屋の復元の逆,最も出現頻度が高い色を選択することで取得できる.今後,色差計算が精度向上に大きく影響する可能性がある. ### 理想的な動画 理想的な動画および,部屋部分を写真に変更した理想的な動画に zoomg を適用する.復元された画像は以下になる. + **理想的な動画** 部屋部分 -![sample_01_room.png](https://github.com/Tsuku43/zoomg/blob/master/images/sample_01_room.png?raw=true) +![sample_01_room.png](images/algorithm/sample_01_room.png) 500,500 の時間変化 -![sample_01_500_500_check.png](https://github.com/Tsuku43/zoomg/blob/master/images/sample_01_500_500_check.png?raw=true) +![sample_01_500_500_check.png](images/algorithm/sample_01_500_500_check.png) + **部屋部分を写真に変更した理想的な動画** 部屋部分 -![sample_02_room.png](https://github.com/Tsuku43/zoomg/blob/master/images/sample_02_room.png?raw=true) +![sample_02_room.png](images/algorithm/sample_02_room.png) 500,500 の時間変化 -![sample_02_500_500_check.png](https://github.com/Tsuku43/zoomg/blob/master/images/sample_02_500_500_check.png?raw=true) +![sample_02_500_500_check.png](images/algorithm/sample_02_500_500_check.png) 共にパラメータを 20 とした.フレーム数の関係でバーチャル背景のみとなったピクセルは縦の線として現れている.オブジェクトと同色のクラスタはパラメータ調整により削減できる.パラメータを 5 とした sample_02 の部屋部分を以下に示す. -![sample_02_room_5.png](https://github.com/Tsuku43/zoomg/blob/master/images/sample_02_room_5.png?raw=true) +![sample_02_room_5.png](images/algorithm/sample_02_room_5.png) ### 実際の動画 実際の zoom から得られた動画に zoomg を適用する.復元された画像は以下になる. + **復元された画像** 部屋部分(顔黒塗り) -![zoom_0_room.png](https://github.com/Tsuku43/zoomg/blob/master/images/zoom_0_room.png?raw=true) +![zoom_0_room.png](images/algorithm/zoom_0_room.png) 500,500 の時間変化 -![zoom_0_500_500_check.png](https://github.com/Tsuku43/zoomg/blob/master/images/zoom_0_500_500_check.png?raw=true) +![zoom_0_500_500_check.png](images/algorithm/zoom_0_500_500_check.png) パラメータを 90 とした.フレーム数の関係で腕などの表示時間が短いため,背景と判定されている.大幅にバーチャル背景が乱れる現象も復元には大きく影響している.実際の部屋と比べると,赤く囲った部分が復元できていることがわかる. + **実際の部屋** -![room.png](https://github.com/Tsuku43/zoomg/blob/master/images/room.png?raw=true) +![room.png](images/algorithm/room.png) ## 対抗手法 @@ -47,24 +51,26 @@ ### フレーム単位のノイズ 理想的な動画をフレーム単位で分割し,1 つのフレームのバーチャル背景部分をノイズに変更したものを再度動画にしたものに zoomg を適用する. -![image_123.png](https://github.com/Tsuku43/zoomg/blob/master/images/image_123.png?raw=true) -フレーム単位で挿入するため,オブジェクトが動いた後の動画後半に挿入した.これは得られた部屋の情報がノイズによってかき消されることを意味している.復元された画像は以下になる. +![image_123.png](images/algorithm/image_123.png) +フレーム単位で挿入するため,オブジェクトが動いた後の動画後半に挿入した.これは得られた部屋の情報がノイズによってかき消されることを意味している.復元された画像は以下になる. + **復元された画像** 部屋部分 -![sample_03_room.png](https://github.com/Tsuku43/zoomg/blob/master/images/sample_03_room.png?raw=true) +![sample_03_room.png](images/algorithm/sample_03_room.png) 500,500 の時間変化 -![sample_03_500_500_check.png](https://github.com/Tsuku43/zoomg/blob/master/images/sample_03_500_500_check.png?raw=true) +![sample_03_500_500_check.png](images/algorithm/sample_03_500_500_check.png) 1000,1000 の時間変化 -![sample_03_1000_1000_check.png](https://github.com/Tsuku43/zoomg/blob/master/images/sample_03_1000_1000_check.png?raw=true) +![sample_03_1000_1000_check.png](images/algorithm/sample_03_1000_1000_check.png) パラメータを 20 とした.ノイズによって復元が妨げられていることがわかる. ### ピクセル単位のノイズ -フレーム単位のノイズでは,フレームを削除することにより容易に復元が可能となる.これを防ぐため,バーチャル背景のランダムな箇所へピクセル単位でのノイズを挿入する.ノイズのピクセルサイズをもランダムにすることで予測を困難にすることができるが,動画の質が低下してしまう.本対策ではバーチャル背景の認識に影響を与えない程度のノイズを目指し,ノイズの座標と量をランダムに散りばめることとした.ノイズを含ませたバーチャル背景用動画を zoom のバーチャル背景として使用した動画に zoomg を適用する.動画は[zoom_vbg.png](https://github.com/Tsuku43/zoomg/blob/master/images/zoom_vbg.png?raw=true)より生成したもので,読み込みの関係で mov への変換を行った. +フレーム単位のノイズでは,フレームを削除することにより容易に復元が可能となる.これを防ぐため,バーチャル背景のランダムな箇所へピクセル単位でのノイズを挿入する.ノイズのピクセルサイズをもランダムにすることで予測を困難にすることができるが,動画の質が低下してしまう.本対策ではバーチャル背景の認識に影響を与えない程度のノイズを目指し,ノイズの座標と量をランダムに散りばめることとした.ノイズを含ませたバーチャル背景用動画を zoom のバーチャル背景として使用した動画に zoomg を適用する.動画は[zoom_vbg.png](images/algorithm/zoom_vbg.png)より生成したもので,読み込みの関係で mov への変換を行った. + **復元された画像** 部屋部分(顔黒塗り) -![zoom_1_room_60.png](https://github.com/Tsuku43/zoomg/blob/master/images/zoom_1_room_60.png?raw=true) -![zoom_1_room_90.png](https://github.com/Tsuku43/zoomg/blob/master/images/zoom_1_room_90.png?raw=true) +![zoom_1_room_60.png](images/algorithm/zoom_1_room_60.png) +![zoom_1_room_90.png](images/algorithm/zoom_1_room_90.png) 500,500 の時間変化 -![zoom_1_500_500_check.png](https://github.com/Tsuku43/zoomg/blob/master/images/zoom_1_500_500_check.png?raw=true) +![zoom_1_500_500_check.png](images/algorithm/zoom_1_500_500_check.png) 上の画像をパラメータ 60,下の画像をパラメータを 90 とした.ノイズにより部屋の復元がさらに困難になっていることがわかる. diff --git a/images/image_123.png b/images/algorithm/image_123.png similarity index 100% rename from images/image_123.png rename to images/algorithm/image_123.png diff --git a/images/room.png b/images/algorithm/room.png similarity index 100% rename from images/room.png rename to images/algorithm/room.png diff --git a/images/sample_01.gif b/images/algorithm/sample_01.gif similarity index 100% rename from images/sample_01.gif rename to images/algorithm/sample_01.gif diff --git a/images/sample_01_1-10.png b/images/algorithm/sample_01_1-10.png similarity index 100% rename from images/sample_01_1-10.png rename to images/algorithm/sample_01_1-10.png diff --git a/images/sample_01_500_500_check.png b/images/algorithm/sample_01_500_500_check.png similarity index 100% rename from images/sample_01_500_500_check.png rename to images/algorithm/sample_01_500_500_check.png diff --git a/images/sample_01_room.png b/images/algorithm/sample_01_room.png similarity index 100% rename from images/sample_01_room.png rename to images/algorithm/sample_01_room.png diff --git a/images/sample_02_500_500_check.png b/images/algorithm/sample_02_500_500_check.png similarity index 100% rename from images/sample_02_500_500_check.png rename to images/algorithm/sample_02_500_500_check.png diff --git a/images/sample_02_room.png b/images/algorithm/sample_02_room.png similarity index 100% rename from images/sample_02_room.png rename to images/algorithm/sample_02_room.png diff --git a/images/sample_02_room_5.png b/images/algorithm/sample_02_room_5.png similarity index 100% rename from images/sample_02_room_5.png rename to images/algorithm/sample_02_room_5.png diff --git a/images/sample_03_1000_1000_check.png b/images/algorithm/sample_03_1000_1000_check.png similarity index 100% rename from images/sample_03_1000_1000_check.png rename to images/algorithm/sample_03_1000_1000_check.png diff --git a/images/sample_03_500_500_check.png b/images/algorithm/sample_03_500_500_check.png similarity index 100% rename from images/sample_03_500_500_check.png rename to images/algorithm/sample_03_500_500_check.png diff --git a/images/sample_03_room.png b/images/algorithm/sample_03_room.png similarity index 100% rename from images/sample_03_room.png rename to images/algorithm/sample_03_room.png diff --git a/images/zoom_0_500_500_check.png b/images/algorithm/zoom_0_500_500_check.png similarity index 100% rename from images/zoom_0_500_500_check.png rename to images/algorithm/zoom_0_500_500_check.png diff --git a/images/zoom_0_room.png b/images/algorithm/zoom_0_room.png similarity index 100% rename from images/zoom_0_room.png rename to images/algorithm/zoom_0_room.png diff --git a/images/zoom_1_500_500_check.png b/images/algorithm/zoom_1_500_500_check.png similarity index 100% rename from images/zoom_1_500_500_check.png rename to images/algorithm/zoom_1_500_500_check.png diff --git a/images/zoom_1_room_60.png b/images/algorithm/zoom_1_room_60.png similarity index 100% rename from images/zoom_1_room_60.png rename to images/algorithm/zoom_1_room_60.png diff --git a/images/zoom_1_room_90.png b/images/algorithm/zoom_1_room_90.png similarity index 100% rename from images/zoom_1_room_90.png rename to images/algorithm/zoom_1_room_90.png diff --git a/images/zoom_vbg.png b/images/algorithm/zoom_vbg.png similarity index 100% rename from images/zoom_vbg.png rename to images/algorithm/zoom_vbg.png