hybridgroup.gobot/platforms/opencv
Thomas Kohler 0d0a508c60
core(build): CLI removed (#946)
* core(build): CLI removed
* adjust install instructions in doc and README
* fix master_test and remove useless/duplicated tests examples_test.go
2023-06-04 18:36:55 +02:00
..
LICENSE Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00
README.md core(build): CLI removed (#946) 2023-06-04 18:36:55 +02:00
camera_driver.go Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00
camera_driver_test.go Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00
doc.go core(build): CLI removed (#946) 2023-06-04 18:36:55 +02:00
haarcascade_frontalface_alt.xml Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00
helpers_test.go Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00
lena-256x256.jpg Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00
utils.go Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00
utils_test.go Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00
window_driver.go Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00
window_driver_test.go Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00

README.md

OpenCV

OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in the commercial products. Being a BSD-licensed product, OpenCV makes it easy for businesses to utilize and modify the code.

For more info about OpenCV click here

How to Install

This package requires OpenCV 3.4+ be installed on your system, along with GoCV, which is the Go programming language wrapper used by Gobot. The best way is to follow the installation instructions on the GoCV website at https://gocv.io.

The instructions should automatically install OpenCV 4+

macOS

To install on macOS follow the instructions here:

https://gocv.io/getting-started/macos/

Ubuntu

To install on Ubuntu follow the instructions here:

https://gocv.io/getting-started/linux/

Windows

Please refer to the main README.md

To install on Windows follow the instructions here:

https://gocv.io/getting-started/windows/

How to Use

Here is an example using the camera:

package main

import (
  "gobot.io/x/gobot/v2"
  "gobot.io/x/gobot/v2/platforms/opencv"
  "gocv.io/x/gocv"
)

func main() {
  window := opencv.NewWindowDriver()
  camera := opencv.NewCameraDriver(0)

  work := func() {
    camera.On(opencv.Frame, func(data interface{}) {
      img := data.(gocv.Mat)
      window.ShowImage(img)
      window.WaitKey(1)
    })
  }

  robot := gobot.NewRobot("cameraBot",
    []gobot.Device{window, camera},
    work,
  )

  robot.Start()
}