-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathopencv_cv.go
58 lines (48 loc) · 1.38 KB
/
opencv_cv.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
// Copyright 2014 <chaishushan{AT}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
/*
#cgo CFLAGS: -I./opencv110/cv/include
#include <cv.h>
*/
import "C"
import (
"unsafe"
)
const (
CV_BGR2GRAY = C.CV_BGR2GRAY
CV_BLUR = C.CV_BLUR
)
/* Smoothes array (removes noise) */
func Smooth(src, dst *IplImage, smoothtype,
param1, param2 int, param3, param4 float64) {
C.cvSmooth(unsafe.Pointer(src), unsafe.Pointer(dst), C.int(smoothtype),
C.int(param1), C.int(param2), C.double(param3), C.double(param4),
)
}
/* Converts input array pixels from one color space to another */
func CvtColor(src, dst *IplImage, code int) {
C.cvCvtColor(unsafe.Pointer(src), unsafe.Pointer(dst), C.int(code))
}
/* Runs canny edge detector */
func Canny(image, edges *IplImage, threshold1, threshold2 float64, aperture_size int) {
C.cvCanny(unsafe.Pointer(image), unsafe.Pointer(edges),
C.double(threshold1), C.double(threshold2),
C.int(aperture_size),
)
}
const (
CV_INPAINT_NS = C.CV_INPAINT_NS
CV_INPAINT_TELEA = C.CV_INPAINT_TELEA
)
/* Inpaints the selected region in the image */
func Inpaint(src, inpaint_mask, dst *IplImage, inpaintRange float64, flags int) {
C.cvInpaint(
unsafe.Pointer(src),
unsafe.Pointer(inpaint_mask),
unsafe.Pointer(dst),
C.double(inpaintRange),
C.int(flags),
)
}