前景抽出/OpenCV

サンプルコードはここ

画像はcatで検索して、同化してるような写真を選びました。

実行

Python grabcut.py cat.jpg

操作

Key ‘0’ – To select areas of sure background
Key ‘1’ – To select areas of sure foreground
Key ‘2’ – To select areas of probable background
Key ‘3’ – To select areas of probable foreground

Key ‘n’ – To update the segmentation
Key ‘r’ – To reset the setup
Key ‘s’ – To save the results

なにもせずにsで保存すると、前景抽出された結果が得られます。

程よく抽出しているように見えます。

参考はここです。

シェアする

  • このエントリーをはてなブックマークに追加

フォローする