こんにちは。Heavy metal is very very healthyです。ナビタイムジャパンでAIやコンピュータビジョンを用いた研究開発を担当しています。 この記事では、PythonとOpenCVでコンピュータビジョンを使った画像から信号機の色を認識する手法を紹介したいと思います。
OpenCVで「色空間の変更」を行う方法を説明します。最もよく使う、「BGR ⇄ Gray」と「BGR ⇄ HSV」の2つの変換を試してみます。 ・Python 3.7 Webカメラ映像をGrayに変換して表示するプログラムは次の通りです。 import cv2 # キャプチャの準備 cap = cv2.VideoCapture(0) while ...
#Construct masks for the three colours, then perform a series of dilations and erosions to remove small areas left in the mask green_mask = cv2.inRange(hsv, greenLower, greenUpper) green_mask = ...
1. Python 3.x: Make sure you have Python installed on your system. 2. OpenCV: A library for image and video processing. 3. NumPy: A library for numerical computations ...