Content-Length: 297780 | pFad | http://github.com/Ar-Ray-code/PastePicture2Wallpaper

31 GitHub - Ar-Ray-code/PastePicture2Wallpaper: 画像から線画を作成してUbuntuの壁紙に貼り付けるためのスクリプト
Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

画像から線画を作成してUbuntuの壁紙に貼り付けるためのスクリプト

License

Notifications You must be signed in to change notification settings

Ar-Ray-code/PastePicture2Wallpaper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 Cannot retrieve latest commit at this time.

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PastePicture2Wallpaper

キャラクターをUbuntu風の壁紙に貼り付けるプログラム。

0. 画像を用意する

お好きな画像を用意してください。

アニメ画像などのわりと対象物と背景がはっきりしているものがおすすめです。

StableDiffusionを使う場合

StableDiffusionを使用して画像を作成することができます。

要件

  • 8GB以上のVRAMが搭載されたGPU(Colabだとそれ以上必要な場合あり)
  • Ubuntu22.04 + Python3.10環境

StableDiffusionの環境構築手順に従って環境構築してください。モデルはanything-v4.0(別途ダウンロード必須)がおすすめです。

作成例

  • ロボットは背景と誤認されやすい。背景を生成させずに線画抽出のみにするとよい。
  • 輪郭がはっきりしないパーツは欠けやすい


1. 画像をColabで深度画像に変換する

PastePicture2Wallpaper.ipynb (Colaboratry)をチェックしてください。


全て実行すると線画がresult.pngという名前でそのまま出力されます。ステップ2に進んでください。


Colabでは、OSの雰囲気に合わせて線の色を変更できます。

  • Mac風(灰色):パステルカラーの背景に合わせて半透明の灰色線画を出力
  • Mac風(白色):鮮やかな背景に半透明の白線画を出力
  • Windows風: 水色の背景にさらに明るい水色半透明の線画を出力
  • Ubuntu風: 紫-桃色の背景に馴染む桃色半透明の線画を出力


画像を閾値を指定して距離を指定(出力画像がうまく深度を捉えられていない場合)

Colabでは画像を見ながら閾値調整と確認が同時にできないので、最も下のコードセルのコメントアウトを外してdepth_result.pngをダウンロードして以下の手順を行います。

画像を閾値を指定して距離を指定

深度閾値が150で適当でない場合、リアルタイムで確認しながら閾値調整できます。


PyQtの使い方下手過ぎて申し訳ないです…

convert.pyを用いて深度の閾値を変更します。デフォルトでは150なので、そのままconvertionボタンを押してもOKです。

オプション

  • -i : 画像パス
  • -d : depth_result.pngを指定

画像は同じサイズにしてください(何も変換しなければ問題無いです)

python3 convert.py -i ~/Downloads/image.jpg -d ~/Downloads/depth_result.png

変換終了後に次のファイルがコマンド入力をしたディレクトリに出力されます。

  • edges_check.jpg : エッジ検出後の画像(確認用)
  • edges.png : エッジ検出後の合成用画像。線に少し透明度があり、背景が透過されています。

残念ながら完璧な線画は出力できないので、適宜修正してください。


2. Gimpなどを使って合成

壁紙をGimpやPowerPointなどで作ってください。


記事


参考

https://axross-recipe.com/recipes/404 by Kazuhito00

About

画像から線画を作成してUbuntuの壁紙に貼り付けるためのスクリプト

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/Ar-Ray-code/PastePicture2Wallpaper

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy