-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathopencv_doc.go
63 lines (48 loc) · 1.33 KB
/
opencv_doc.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
// 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 provides Go bindings for OpenCV 1.1.
Install `GCC` or `MinGW` (http://tdm-gcc.tdragon.net/download) at first,
and then run these commands:
1. `go get -d github.com/chai2010/opencv`
2. `go generate` and `go install`
3. `go run hello.go`
Example:
// 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 main
import (
"fmt"
"log"
"os"
"github.com/chai2010/opencv"
)
func main() {
filename := "../images/lena.jpg"
if len(os.Args) == 2 {
filename = os.Args[1]
}
image := opencv.LoadImage(filename)
if image == nil {
log.Fatalf("LoadImage %s failed!", filename)
}
defer image.Release()
win := opencv.NewWindow("Go-OpenCV")
defer win.Destroy()
win.SetMouseCallback(func(event, x, y, flags int) {
fmt.Printf("event = %d, x = %d, y = %d, flags = %d\n",
event, x, y, flags,
)
})
win.CreateTrackbar("Thresh", 1, 100, func(pos int) {
fmt.Printf("pos = %d\n", pos)
})
win.ShowImage(image)
opencv.WaitKey(0)
}
Report bugs to <chaishushan@gmail.com>.
Thanks!
*/
package opencv