[OPENCV] FaceDectection - (四) 模型訓練

前面幾篇關於FaceDetection的文章已經介紹如何應用openCV內建的 library
以及分析臉部辨識所需要的xml檔案

這一篇文章將會介紹如何產生出 xml 檔案提供給 openCV使用

獲取人臉資料庫

因為要重新訓練出模型, 因此需要有大量的人臉圖案
喵使用了FERET的資料庫

[OPENCV] FaceDectection - (三) 實務剖析

HaarCascade Xml

的程式碼當中, 最主要的參數是去讀取 haarcascade_frontalface_alt.xml
1
2
3
4
5
6
7
8
9
int main(int argc, char** argv) {

  // Load preconstructed classifier
  face_cascade.load("data/haarcascade_frontalface_alt.xml");
  Mat inputImage = imread(argv[1]);
  detectFaces(inputImage);
  waitKey(0);
  return 0;
}

這邊開始, 喵要詳細的解構這xml檔案
一開始的對於整個cascade的參數

<opencv_storage>
<cascade type_id="opencv-cascade-classifier"><stageType>BOOST</stageType>
  <featureType>HAAR</featureType>
  <height>20</height>
  <width>20</width>
  <stageParams>
    <maxWeakCount>213</maxWeakCount></stageParams>
  <featureParams>
    <maxCatCount>0</maxCatCount></featureParams>
  <stageNum>22</stageNum>


FeatureType: HAAR / LBP / HOG
Height: Mask 高度
Widht: Mask 寬度
stageParams --> maxWeakCount: 最多有幾個weak nodes in a classifier
maxCatCount: 最多串幾個 nodes (設定為0, 代表沒有使用串接)
stageNum: 共有多少個 Stage

OpenGL 閱讀筆記 (二) OpenGL基本操作

這邊虎喵跳過glfw/glew的初始化, 先來提一下OpenGL的基本操作方式 前面也提到過, OpenGL是一個類C的語言, 因此使用C/C++的攻城獅們應該會感到很熟悉. OpenGL的基本動作循環如下: 每一行code的解釋如下: // 本地變數,...