Пример #1
0
func detect(tarImg *C.IplImage) *C.CvSeq {
	cvHCC := (*C.CvHaarClassifierCascade)(
		C.cvLoad(C.CString("./config/haarcascade_frontalface_default.xml"),
			(*C.CvMemStorage)(nil),
			(*C.char)(nil),
			(**C.char)(nil)))
	cvMStr := C.cvCreateMemStorage(0)

	return C.cvHaarDetectObjects(
		unsafe.Pointer(tarImg),
		cvHCC,
		cvMStr,
		1.11,
		3,
		0,
		C.cvSize(0, 0),
		C.cvSize(0, 0),
	)
}
Пример #2
0
func NewHaarClassifier(filename string) *HaarClassifierCascade {
	// TODO: Figure out an interface for managing the three parameters
	// at the end of this function.
	classifier := C.cvLoad(C.CString(filename), nil, nil, nil)
	return (*HaarClassifierCascade)(classifier)
}