Go 語言版的 OpenCV 封裝 - GoOpenCV

jopen 12年前發布 | 92K 次閱讀 OpenCV Google Go/Golang開發

Go 語言版的 OpenCV 封裝 - GoOpenCV

Go-OpenCV 是 Go 語言版的 OpenCV 封裝。

示例代碼:

// Copyright 2011 . 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"
        "opencv"
        "os"
)

func main() {
        filename := "./samples/lena.jpg"
        if len(os.Args) == 2 {
                filename = os.Args[1]
        }

        image := opencv.LoadImage(filename)
        if image == nil {
                panic("LoadImage fail")
        }
        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)
}

項目主頁:http://www.baiduhome.net/lib/view/home/1341845443166

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!