1. 학습할 positive 이미지와 negative 이미지를 준비
2. person.info와 bg.txt 파일 생성
- person.info(postive 이미지의 경로가 저장되어 있음)
ex)
pos/pos00001.pgm 1 0 0 48 96
pos/pos00002.pgm 1 0 0 48 96
pos/pos00003.pgm 1 0 0 48 96
.....
pos/pos00001.pgm 1 0 0 48 96 -> 1 : 학습할 객체의 개수, 0 0 : x와 y 좌표(좌측상단 기준), 48 96 : (width, height)
- bg.txt (negative 이미지들의 경로가 저장되어 있음)
ex)
neg/neg00001.pgm
neg/neg00002.pgm
neg/neg00003.pgm
.....
3. opencv_createsamples 실행 (경로 : 설치된 opencv 파일안의 build/bin/opencv_createsamples)
ex)
opencv_createsamples -info person.info -num 500 -w 48 -h 96 -vec person.vec
-num : positive 이미지 수
-w : width
-h : height
-vec : vec 파일 이름
4. 생성된 vec파일을 가지고 training
ex)
opencv_traincascade -data data -vec person.vec -bg bg.txt -numPos 500 -numNeg 1500 -numStages 2 -w 48 -h 24 -featureType LBP
5. data 폴더에 생성된 cascade.xml 로 이미지 검출 테스트를 함
'Program Language > OpenCV' 카테고리의 다른 글
Linux에서 Droidcam 설치 및 안드로이드캠 연결 (1) | 2017.01.10 |
---|---|
OpenCV 참고 사이트 (0) | 2017.01.03 |
이미지 학습 절차 (0) | 2017.01.03 |
Mat이란? (0) | 2016.12.29 |