ArtyZiff35/3D_Reconstruction_From_Stereo_Images をインストールする. これは,ステレオ画像についての画像補正,ステレオマッチング,視差マップ (disparity map),深度マップ (depth map),カラーの3次元点群の生成を行う.
【関連する外部ページ】
GitHub のページ: https://github.com/ArtyZiff35/3D_Reconstruction_From_Stereo_Images
Windows での Git のインストール: 別ページ »で説明
【関連する外部ページ】
Git の公式ページ: https://git-scm.com/
Windows での Python 3.10,関連パッケージ,Python 開発環境のインストール: 別ページ »で説明
【サイト内の関連ページ】
Python のまとめ: 別ページ »にまとめ
【関連する外部ページ】
Python の公式ページ: https://www.python.org/
コマンドプロンプトを管理者として実行: 別ページ »で説明
※ 「 python -m pip install ...」は,Python パッケージをインストールするためのコマンド.
python -m pip install -U pip pip install -U matplotlib seaborn plyfile open3d cd %HOMEPATH% rmdir /s /q 3D_Reconstruction_From_Stereo_Images git clone --recursive https://github.com/ArtyZiff35/3D_Reconstruction_From_Stereo_Images cd 3D_Reconstruction_From_Stereo_Images
cd %HOMEPATH% cd 3D_Reconstruction_From_Stereo_Images notepad src\RealDepth.py
実行の前に,ディレクトリの作成,所定のディレクトリに所定の画像を置くなどの作業を行っている.
cd %HOMEPATH% cd 3D_Reconstruction_From_Stereo_Images mkdir remap mkdir remap\remapped mkdir remap\remapped\left mkdir remap\remapped\right copy sampleRectified\left\_bike_l.png remap\remapped\left copy sampleRectified\right\_bike_r.png remap\remapped\right mkdir diparity mkdir disparity\heatmap mkdir ply src\master.py
マウスで回転などができる.
remap\remapped\left\_bike_l.png remap\remapped\right\_bike_r.png
disparity\heatmap\bike.png
以下書きかけ
cd %HOMEPATH% cd 3D_Reconstruction_From_Stereo_Images cd src mkdir remap mkdir remap\remapped mkdir remap\remapped\left mkdir remap\remapped\right cd remap\remapped cd left curl -O https://raw.githubusercontent.com/opencv/opencv/master/samples/data/aloeL.jpg cd .. cd right curl -O https://raw.githubusercontent.com/opencv/opencv/master/samples/data/aloeR.jpg
cd %HOMEPATH% cd 3D_Reconstruction_From_Stereo_Images cd src mkdir disparity mkdir disparity\heatmap mkdir ply
import FastDP as fdm path_l = 'remap/remapped/left/aloeL.jpg' path_r = 'remap/remapped/right/aloeR.jpg' name = 'aloe' disparity = fdm.generate_disparity_map(left_path=path_l, right_path=path_r, name=name, downsample_n=0) exit()
disparity\heatmap\aloe.png
import FastDP as fdm import RealDepth as rd path_l = 'remap/remapped/left/aloeL.jpg' path_r = 'remap/remapped/right/aloeR.jpg' name = 'aloe' disparity = fdm.generate_disparity_map(left_path=path_l, right_path=path_r, name=name, downsample_n=0) model3D_matrix = rd.generate_depth_map(disparity, 'disparity/heatmap/aloe.png') rd.convert_to_ply(disparity=disparity, model_3d=model3D_matrix, name=name, image_path='disparity/heatmap/aloe.png', cmp_range=70) rd.visualize_model('ply/' + str(name) + '.ply')