領域(輪郭)の特徴である面積,周囲長,重心,外接矩形などについて学びます. 領域(輪郭)を対象とした様々な関数について学ぶことになります. 1. モーメント¶ 画像のモーメントは物体の重心,面積などを計算するのに役立ちます.詳細についてはWikipediaの 画像モーメント(英語) のページを参照してください. cv2.moments() 関数はあらゆるモーメントを計算します.: import cv2 import numpy as np img = cv2.imread('star.jpg',0) ret,thresh = cv2.threshold(img,127,255,0) imgEdge,contours,hierarchy = cv2.findContours(thresh, 1, 2) cnt = contours[0] M = cv2.moments(cnt) print
![領域(輪郭)の特徴 — OpenCV-Python Tutorials 1 documentation](https://cdn-ak-scissors.b.st-hatena.com/image/square/97035e6fb768e86acfa2db6a5ae6255ed621fb93/height=288;version=1;width=512/http%3A%2F%2Flabs.eecs.tottori-u.ac.jp%2Fsd%2FMember%2Foyamada%2FOpenCV%2Fhtml%2F_images%2Fcircumcircle.png)