forked from go-opencv/go-opencv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cvaux.go
93 lines (73 loc) · 4.88 KB
/
cvaux.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright 2011 <chaishushan@gmail.com>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package opencv
//#include "opencv.h"
//#cgo linux pkg-config: opencv
//#cgo darwin pkg-config: opencv
//#cgo windows LDFLAGS: -lopencv_core242.dll -lopencv_imgproc242.dll -lopencv_photo242.dll -lopencv_highgui242.dll -lstdc++
import "C"
import (
"unsafe"
)
/****************************************************************************************\
* Eigen objects *
\****************************************************************************************/
/****************************************************************************************\
* 1D/2D HMM *
\****************************************************************************************/
/*********************************** Embedded HMMs *************************************/
/****************************************************************************************\
* A few functions from old stereo gesture recognition demosions *
\****************************************************************************************/
/****************************************************************************************\
* Additional operations on Subdivisions *
\****************************************************************************************/
/****************************************************************************************\
* More operations on sequences *
\****************************************************************************************/
/*******************************Stereo correspondence*************************************/
/*****************************************************************************************/
/************ Epiline functions *******************/
/****************************************************************************************\
* Contour Morphing *
\****************************************************************************************/
/****************************************************************************************\
* Texture Descriptors *
\****************************************************************************************/
/****************************************************************************************\
* Face eyes&mouth tracking *
\****************************************************************************************/
type HaarCascade struct {
cascade *C.CvHaarClassifierCascade
}
func LoadHaarClassifierCascade(haar string) *HaarCascade {
haarCascade := new(HaarCascade)
haarCascade.cascade = C.cvLoadHaarClassifierCascade(C.CString(haar), C.cvSize(1, 1))
return haarCascade
}
func (this *HaarCascade) DetectObjects(image *IplImage) []*Rect {
storage := C.cvCreateMemStorage(0)
seq := C.cvHaarDetectObjects(unsafe.Pointer(image), this.cascade, storage, 1.1, 3, C.CV_HAAR_DO_CANNY_PRUNING, C.cvSize(0, 0), C.cvSize(0, 0))
var faces []*Rect
for i := 0; i < (int)(seq.total); i++ {
rect := (*Rect)((*_Ctype_CvRect)(unsafe.Pointer(C.cvGetSeqElem(seq, C.int(i)))))
faces = append(faces, rect)
}
return faces
}
/****************************************************************************************\
* 3D Tracker *
\****************************************************************************************/
/****************************************************************************************\
* Skeletons and Linear-Contour Models *
\****************************************************************************************/
/****************************************************************************************\
* Background/foreground segmentation *
\****************************************************************************************/
/****************************************************************************************\
* Calibration engine *
\****************************************************************************************/
/*****************************************************************************\
* --- END --- *
\*****************************************************************************/