https://github.com/grebtsew/FloorplanToBlender3d
今回は、とりあえず、windows11のminiconda環境で gitcloneし、サンプルを2D -> 3D変換するまで
FloorplanToBlender3dの参考url
FloorplanToBlender3dのdocsにありますが、 FloorplanToBlender3dを用い、更に以下のurlも参考にしているようです
- First look at problem : https://mathematica.stackexchange.com/questions/19546/image-processing-floor-plan-detecting-rooms-borders-area-and-room-names-t
- Room detection : https://stackoverflow.com/questions/54274610/crop-each-of-them-using-opencv-python
- Watershed : https://docs.opencv.org/3.1.0/d3/db4/tutorial_py_watershed.html
- Shape detection : https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_features_harris/py_features_harris.html
- Distance in image : https://stackoverflow.com/questions/50930033/drawing-lines-and-distance-to-them-on-image-opencv-python
- Rect contain : https://stackoverflow.com/questions/33065834/how-to-detect-if-a-point-is-contained-within-a-bounding-rect-opecv-python
- Line detection : https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_imgproc/py_houghlines/py_houghlines.html
- Readme tips: https://github.com/matiassingers/awesome-readme
その他の参考url
- https://github.com/rbg-research/Floor-Plan-Detection
- https://github.com/ozturkoktay/floor-plan-room-segmentation
git gitclone , pip install
(base) C:\Users\end0t\dev> git clone https://github.com/grebtsew/FloorplanToBlender3d.git
使用したminicondaに付属するpythonは ver.3.9 。
しかし、FloorplanToBlender3d に付属する requirements.txt で指定される opencv-python ver.4.2.0.34 を pip install できませんでしたので、 ver.4.4.0.46 にした上で pip install しています
(base) C:\Users\end0t\dev> python --version Python 3.9.21 (base) C:\Users\end0t\dev> cd FloorplanToBlender3d (base) C:\Users\end0t\dev\FloorplanToBlender3d> vi requirements.txt opencv-python==4.4.0.46 #opencv-python==4.2.0.34 numpy==1.22.0 configparser==3.5.0 future-fstrings==1.2.0 requests==2.25.1 pyfiglet==0.7 setuptools==54.1.0 scipy==1.5.4 pillow==9.0.1 matplotlib==3.5.1 black==22.1.0 pytest==7.0.1 (base) C:\Users\end0t\dev\FloorplanToBlender3d> pip install -r requirements.txt
main.py で setup & sample実行
付属する main.py を実行すると、Configs/default.ini の作成などを行った後、 Images/Examples/example.png の2D間取り図が Target/floorplan.blend の blender用 3Dに変換されます。
※変換対象のファイルは、Configs/default.ini 内で指定されています。
________ __ __ ____ __ __ _____ __
/ ____/ /___ ____ _________ / /___ _____ / /_____ / __ )/ /__ ____ ____/ /__ ____|__ /____/ /
/ /_ / / __ \/ __ \/ ___/ __ \/ / __ `/ __ \ / __/ __ \ / __ / / _ \/ __ \/ __ / _ \/ ___//_ </ __ /
/ __/ / / /_/ / /_/ / / / /_/ / / /_/ / / / / / /_/ /_/ / / /_/ / / __/ / / / /_/ / __/ / ___/ / /_/ /
/_/ /_/\____/\____/_/ / .___/_/\__,_/_/ /_/ \__/\____/ /_____/_/\___/_/ /_/\__,_/\___/_/ /____/\__,_/
/_/
----- CREATE BLENDER PROJECT FROM FLOORPLAN WITH DIALOG -----
Welcome to this program. Please answer the questions below to progress.
Remember that you can change data more efficiently in the config file.
Please enter your blender installation path [default = C:\Program Files\Blender Foundation\Blender 4.4\blender.exe]:
Do you want to build from StackingFile or ConfigFile list ? [default = ConfigFile]:
Use default config or import from file paths separated by space [default = ./Configs/default.ini]:
Do you want to set images to use in each config file? [N/y]:
This program is about to run and create blender3d project, continue? :
Generate datafiles in folder: Data
Clean datafiles
Clear all cached data before run: [default = yes] :
----- Generate Images/Examples/example.png at pos [0 0 0] rot [ 0 0 90] scale [1, 1, 1] -----
Approximated apartment size : 431494.0
Created file : Data/0/floor_verts.txt
Created file : Data/0/floor_faces.txt
Walls created : 113
Created file : Data/0/wall_vertical_verts.txt
Created file : Data/0/wall_vertical_faces.txt
Created file : Data/0/wall_horizontal_verts.txt
Created file : Data/0/wall_horizontal_faces.txt
Number of rooms detected : 4
Created file : Data/0/room_verts.txt
Created file : Data/0/room_faces.txt
Windows created : 7
Created file : Data/0/window_vertical_verts.txt
Created file : Data/0/window_vertical_faces.txt
Created file : Data/0/window_horizontal_verts.txt
Created file : Data/0/window_horizontal_faces.txt
Doors created : 5
Created file : Data/0/door_vertical_verts.txt
Created file : Data/0/door_vertical_faces.txt
Created file : Data/0/door_horizontal_verts.txt
Created file : Data/0/door_horizontal_faces.txt
Created file : Data/0/transform.txt
Creates blender project
Project created at: C:\Users\end0t\dev\FloorplanToBlender3d/Target/floorplan.blend
Done, Have a nice day!
FloorplanToBlender3d Copyright (C) 2022 Daniel Westberg
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it under certain conditions;