OpenCV/ObjectDetection †objdetect モジュールに実装されている物体認識アルゴリズム
Cascade を用いた物体認識 †Cascade Classifier Training †チュートリアル http://docs.opencv.org/2.4/doc/user_guide/ug_traincascade.html Latent SVM を用いた物体認識 †Latent (隠れた) SVMは
HOGは画像の局所的な濃淡方向の出現を数えることで得られる。 また、サポート・ベクタ・マシン分類噐が 部分的にラベル付けされたデータでモデルを訓練するのに用いられる。 SVGの基本的なアイデァは、多次元空間においてデータを分類する 超平面 (hyperplane) を構成することである。 Latent SVMの利点は、 個別に訓練された検出噐を組み合せていろんな物体を認識する分類噐を 作成できることである。 #include <opencv2/opencv.hpp> #include <iostream> using namespace std; ... vector<string> models; modes.push_back("モデル"); vector<string> names; names.push_back("category"); cv::LatentSvmDetector detector(models, names); if (detector.emtyp()) { /* エラー処理 */ } ... cv::Mat image; ... vector<cv::LatentSvmDetector::ObjectDetection> founds; detector.detect(image, founds, 0.1, 1); for (int i=0; i<detection.size(); i++) { // cv::Rect rect = founds[i].rect; // rect.x, rect.y, rect,.width, rect.height ... } ... void detect( // 認識噐を組み合せて適用する const cv::Mat& image, // 画像 vector<cv::ObjectDetection>& objectDetections, // 検出された領域 float overlapThreshold = 0.5f, // オーバラップされた検出を排除するための閾値 int numThreads = -1) // 並列動作時のスレッド数 OpenCV 公式レポジトリの extra data に含まれる pngファイル(cat.png, cars.png, ...), xml ファイル(cat.xml, cars.xml, ...) を適用する例 latentDetection.exe xmlfile imagefile
Scene text detection † |