/cam

cam is a package for Go that provides a high level api (similar to net/http) and a small set of plugins for working with camera frames.

Primary LanguageGoMIT LicenseMIT

cam

GoDoc Go Report Card

cam is a package for Go that provides a high level api (similar to net/http) and a small set of plugins for working with camera frames. For the device communication, implementing the Device interface, we use GoCV and OpenCV, more can be easily added. Contributions are welcomed.

Dependencies

Installation

go get github.com/mvrilo/cam

Example

package main

import (
	"image"
	"image/color"
	"log"

	"github.com/mvrilo/cam"
	"github.com/mvrilo/cam/middlewares/pixelize"
	"github.com/mvrilo/cam/middlewares/window"
	"gocv.io/x/gocv"

	_ "github.com/mvrilo/cam/gocv"
)

func main() {
	cam.Use(pixelize.New(32))
	cam.Handle(func(f cam.Frame) {
		text := "hello world"
		blue := color.RGBA{0, 0, 255, 0}
		data, ok := f.Data().(gocv.Mat)
		if !ok {
			return
		}
		gocv.PutText(&data, text, image.Pt(200, 200), gocv.FontHersheyPlain, 10, blue, 8)
	})
	cam.Use(window.New("cam example"))
	log.Fatal(cam.ListenAndServe(0, nil))
}

hello world

Author

Murilo Santana <mvrilo@gmail.com>