【サイト内の OpenCV 関連ページ】
【OpenCV の公式情報】
【サイト内の関連ページ】
【関連する外部ページ】
Python の公式ページ: https://www.python.org/
Python で OpenCV を動かすためのもの.
OpenCV Python のインストールは:別ページ »で説明1~2 コマンドの実行でインストールできる.
sudo apt -y update sudo apt -y install curl
画像のダウンロード
curl コマンドを用いてダウンロードできる.あるいは Web ブラウザでもダウンロードできる.
Ubuntu, RaspberryPi のときは,「sudo mkdir /usr/local/image; cd /usr/local/image/」
cd %LOCALAPPDATA% curl -L https://github.com/opencv/opencv_extra/raw/4.x/testdata/stitching/boat1.jpg?raw=true -o boat1.jpg curl -L https://github.com/opencv/opencv_extra/raw/4.x/testdata/stitching/boat2.jpg?raw=true -o boat2.jpg curl -L https://github.com/opencv/opencv_extra/raw/4.x/testdata/stitching/boat3.jpg?raw=true -o boat3.jpg curl -L https://github.com/opencv/opencv_extra/raw/4.x/testdata/stitching/boat4.jpg?raw=true -o boat4.jpg curl -L https://github.com/opencv/opencv_extra/raw/4.x/testdata/stitching/boat5.jpg?raw=true -o boat5.jpg curl -L https://github.com/opencv/opencv_extra/raw/4.x/testdata/stitching/boat6.jpg?raw=true -o boat6.jpg
jupyter qtconsole
import os import cv2 %matplotlib inline import matplotlib.pyplot as plt import warnings warnings.filterwarnings('ignore') # Suppress Matplotlib warnings IMROOT=os.environ['LOCALAPPDATA'] + '/' image_names = [IMROOT + "boat1.jpg", IMROOT + "boat2.jpg", IMROOT + "boat3.jpg", IMROOT + "boat4.jpg", IMROOT + "boat5.jpg", IMROOT + "boat6.jpg"] images = [] for i in image_names: img = cv2.imread(i) images.append(img) stitcher = cv2.Stitcher.create() all = stitcher.stitch(images) plt.style.use('default') plt.imshow(cv2.cvtColor(all[1], cv2.COLOR_BGR2RGB)) plt.show()