Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

「Python」OpenCVでリアルタイム処理にあたって苦しんだこと。【導入】

こんにちは、
今回は、PythonでOpenCVの導入するにあたって
苦しんだことを書いていきます。

Linuxで導入はかなり簡単でしたが、
Macではかなり導入に時間がかかってしまいました・・・。
Pythonの3系で結局できず2系で進めてしまいました。

備忘録程度に綴ります。

OpenCV、2系と3系のグレースケールに変更の書き方の違い

OpenCVのグレースケールの書き方が2系と3系で違っています。

 

2系=>

 

[python]cv2.cvtColor(frame,cv2.cv.CV_BGR2GRAY)[/python]

 

3系=>

 

[python]cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)[/python]

 

3系で2系の書き方をすると

AttributeError: 'module' object has no attribute 'cv'

と怒られます。

HAAR分類器の顔検出用の特徴量のパスを見直す

 

error: (-215) !empty() in function detectMultiScale

とのエラーが表示されました。
このエラーの対処は、HAAR分類器の顔検出用の特徴量のパスを見直します。

haarcascade_frontalface_alt.xml」を指定したパス通りの位置に置きます。

OpenCVのフォルダに同封されているので
そこからコピーして持ってきましょう。

Pythonで画像認識① 顔認識 - Python 備忘録
久々の更新です。本日は画像の顔認識をやっていきたいと思います。顔認識は知っての通り、画像の中の人間の顔をプログラムで検知すること。 今回の目標は画像の中の人間の顔に四角い枠を出してみることをしたいと思います。 imagesフォルダの中にwo...
スポンサーリンク

cv2.VideoCapture()の引数

PCの内蔵カメラを使いたかったが、
実行した際、カメラの映像は映し出されず「can twist」との文字が。(Mac)

その時指定していたのが、
cv2.VideoCapture(0)

ググっても内蔵カメラを使うときはcv2.VideoCapture(0)と
記してありました。

実際は、

背面カメラ=>
cv2.VideoCapture(0)

前面カメラ=>
cv2.VideoCapture(1)

USB接続=>
cv2.VideoCapture(-1)

もし、自分の環境で表示されないときは
全部試してもいいかもしれません。

SurfaceのカメラをPythonからリアルタイムに使う - TadaoYamaokaの開発日記
SurfaceのカメラをPythonからリアルタイムに使うには、OpenCVを利用して以下のように記述する。 import cv2 video_capture = cv2.VideoCapture(1) while True: ret, f...

コメント

スポンサーリンク
スポンサーリンク
タイトルとURLをコピーしました