前言
實現分類可以使用SVM方法,但是需要人工調參,具體過程請參考here,這個比較麻煩,小鵝不喜歡麻煩,正好看到SVM可以自動調優,甚好!
注意
1.reshape的使用;
https://docs.opencv.org/3.3.1/d3/d63/classcv_1_1Mat.html#a4eb96e3251417fa88b78e2abd6cfd7d8
cv::Mat cv::Mat::reshape ( int cn, int rows = 0 ) const
參數
cn: New number of channels. If the parameter is 0, the number of channels remains the same. rows: New number of rows. If the parameter is 0, the number of rows remains the same.
2.注意函數參變量如果在函數內部數據發生改變,且其他處有引用的話,函數的形參一定要使用引用。
3.注意調用函數形參的數據類型是否匹配。
4.調試過程中的錯誤也許是由其他處的原因導致的,所以一定要找到錯誤的根源。
5.一定要靜下心來耐心地一步步跟蹤、調試代碼,直至找到真正的原因,調試過程中不要怕麻煩怕速度慢,盡量自己想辦法解決。
6.對於一些庫函數,可以網頁查找,但是一定也要看看庫函數的開發文檔,更具有權威性和正確性。
7.
參考
1.
2. opencv3.3.1_SVM;
3.
https://blog.csdn.net/wyx100/article/details/75295215
完