#author("2016-06-25T06:34:43+00:00","default:nitta","nitta") #author("2016-06-25T07:26:53+00:00","default:nitta","nitta") [[OpenCV]] *[[OpenCV/ObjectDetection]] [#xd240fdf] objdetect モジュールに実装されている物体認識アルゴリズム -Cascade -Latent SVM -Scene Text Detector (OpenCV 3以降) **Cascade を用いた物体認識 [#yb8d9def] ***Cascade Classifier Training [#rff8ecc2] チュートリアル http://docs.opencv.org/2.4/doc/user_guide/ug_traincascade.html **Latent SVM を用いた物体認識 [#j910e293] Latent (隠れた) SVMは - HOG特徴 - 星型,部分ベースのモデルで構成されたルート・フィルター - オブジェクトのカテゴリを表す部分フィルタの集合 を使う。 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 -The PASCAL Visual Object Classes http://host.robots.ox.ac.uk/pascal/VOC/ - Discriminatively trained deformable part models http://people.eecs.berkeley.edu/~rbg/latent/index.html - OpenCV 2.4 Latent SVM http://docs.opencv.org/2.4/modules/objdetect/doc/latent_svm.html - OpenCV Adventure Learning Deformable Models with Latent SVM http://experienceopencv.blogspot.jp/2011/02/learning-deformable-models-with-latent.html - OpenCV SVM サンプルコード Mat型 http://y-takeda.tumblr.com/post/41691065345/ -Latent SVM 使ってみた http://pukulab.blog.fc2.com/blog-entry-69.html ** Scene text detection [#cbee4ad1]