【目次】
【サイト内の関連ページ】
システム Python を使うことができる(その場合,Python のインストールは行わない)
システム Python を用いるときは,pip, setuptools の更新は次のコマンドで行う.
sudo apt -y update sudo apt -y install python3-pip python3-setuptools
Ubuntu で,システム Python 以外の Python をインストールしたい場合は pyenv が便利である: 別ページで説明している.
Python の URL: http://www.python.org/
【Python, pip の使い方】
Python, pip は,次のコマンドで起動できる.
【Python 開発環境のインストール】
JupyterLab, spyder, nteract (Python 開発環境) のインストールは, Windows でコマンドプロンプトを管理者として実行し, 次のコマンドを実行.
python -m pip install -U pip setuptools jupyterlab jupyter jupyter-console jupytext nteract_on_jupyter spyder
詳しくは,: 別ページで説明している.
JupyterLab, spyder, nteract (Python 開発環境) のインストール: : 別ページで説明している.
コマンドプロンプトで次のコマンドを実行
python -m pip install -U opencv-python
端末で次のコマンドを実行
sudo apt -y update sudo apt -y install libopencv-dev python3-opencv
端末で次のコマンドを実行
sudo apt -y update sudo apt -y install libopencv-dev python3-opencv python3-opencv-apps
【サイト内の関連ページ】: ステレオ画像
import cv2
import numpy as np
IMROOT="C:/image/"
mono0 = cv2.cvtColor( cv2.imread(IMROOT + "aloeL.jpg"), cv2.COLOR_BGR2GRAY )
mono1 = cv2.cvtColor( cv2.imread(IMROOT + "aloeR.jpg"), cv2.COLOR_BGR2GRAY )
stereo = cv2.StereoBM_create(blockSize= 15, numDisparities=64)
disparity = stereo.compute(mono0, mono1)
map = ( disparity - np.min(disparity) ) / ( np.max(disparity) - np.min(disparity) )
blur = cv2.GaussianBlur(map, (15, 15), 5)
cv2.imshow("", blur)
cv2.waitKey(0)
cv2.destroyAllWindows()