gcv

package module
v0.31.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2021 License: BSD-3-Clause Imports: 4 Imported by: 4 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gcv

Build Status Build Status CircleCI Status codecov Go Report Card GoDoc Release

Use

package main

import (
	"fmt"

	"github.com/go-vgo/robotgo"
	"github.com/vcaesar/gcv"
)

func main() {
	img := robotgo.CaptureImg()
	img1 := robotgo.CaptureImg(18, 4, 20, 20)
	rs := gcv.FindAllImg(img1, img)
	fmt.Println("find: ", rs[0].TopLeft.Y, rs[0].Rects.TopLeft.X, rs[0].ImgSize.H)
	fmt.Println("find: ", rs)

	m1, _ := gcv.ImgToMat(img)
	m2, _ := gcv.ImgToMat(img1)
	rs = gcv.FindAllTemplate(m1, m2, 0.8)
	fmt.Println("find: ", rs)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fill added in v0.20.0

func Fill(iGray gocv.Mat, rect Rect)

Fill fillpoly the iGray image

func FindImg

func FindImg(subImg, imgSource image.Image) (float32, float32, image.Point, image.Point)

FindImg find image in the subImg

func FindImgByte

func FindImgByte(subImg, imgSource []byte) (float32, float32, image.Point, image.Point)

FindImgByte find image in the subImg by []byte

func FindImgFile

func FindImgFile(tempFile, file string, flag ...int) (float32, float32, image.Point, image.Point)

FindImgFile find image file in subfile

func FindImgMat

func FindImgMat(imgSource, temp gocv.Mat) (float32, float32, image.Point, image.Point)

FindImgMat find the image Mat in the temp Mat

func FindImgMatC added in v0.20.0

func FindImgMatC(imgSource, temp gocv.Mat) (float32, float32, image.Point, image.Point)

FindImgMatC find the image Mat in the temp Mat and close gocv.Mat

func FindImgXY

func FindImgXY(subImg, imgSource image.Image) (int, int)

FindImgXY find image in the subImg return x, y

func FindMultiAllImg added in v0.20.0

func FindMultiAllImg(imgSearch []image.Image, imgSource image.Image, args ...interface{}) [][]Result

FindMultiAllImg find the multi search image all template in the source image return [][]Result

func FindMultiAllImgFile added in v0.31.0

func FindMultiAllImgFile(fileSearh []string, file string, args ...interface{}) [][]Result

FindMultiAllImgFile find the multi file search image all template in the file source image return [][]Result

func FindMultiAllTemplate added in v0.20.0

func FindMultiAllTemplate(imgSource gocv.Mat, imgSearch []gocv.Mat, args ...interface{}) (r [][]Result)

FindMultiAllTemplate find the multi imgSearch all template in the imgSource return [][]Result

func FindMultiAllTemplateC added in v0.20.0

func FindMultiAllTemplateC(imgSource gocv.Mat, imgSearch []gocv.Mat, args ...interface{}) (r [][]Result)

FindMultiAllTemplate find the multi imgSearch all template in the imgSource return [][]Result and close gocv.Mat

func FlannbasedMatch added in v0.30.0

func FlannbasedMatch(query, train gocv.Mat, k int) [][]gocv.DMatch

FlannbasedMatch new flann based match

func IMRead

func IMRead(file string, flag ...int) gocv.Mat

IMRead read the image file to gocv.Mat

func IMWrite added in v0.20.0

func IMWrite(name string, img gocv.Mat) bool

IMWrite write the gocv.Mat to file

func ImgToMat

func ImgToMat(img image.Image) (gocv.Mat, error)

ImgToMat trans image.Image to gocv.Mat

func ImgWrite added in v0.20.0

func ImgWrite(name string, img image.Image) bool

IMWrite write the image.Image to file

func MatToImg

func MatToImg(m1 gocv.Mat) (image.Image, error)

MatToImg trans gocv.Mat to image.Image

func Rectangle added in v0.20.0

func Rectangle(iGray gocv.Mat, maxLoc image.Point, w, h int)

Rectangle rectangle the iGray image

func Show

func Show(img gocv.Mat, name ...string)

Show show the gocv.Mat image

Types

type Point added in v0.30.0

type Point struct {
	X, Y int
}

Point the image X, Y point structure

type Rect added in v0.30.0

type Rect struct {
	TopLeft, TopRight       Point
	BottomLeft, BottomRight Point
}

Rect the image rectangles structure

type Result added in v0.20.0

type Result struct {
	Middle, TopLeft Point // maxLoc
	Rects           Rect

	MaxVal  []float32
	ImgSize Size
}

Result find template result structure

func FindAllImg added in v0.20.0

func FindAllImg(imgSearch, imgSource image.Image, args ...interface{}) []Result

FindAllImg find the search image all template in the source image return []Result

func FindAllImgFile added in v0.20.0

func FindAllImgFile(fileSearh, file string, args ...interface{}) []Result

FindAllImgFlie find the search image all template in the source image file return []Result

func FindAllTemplate added in v0.20.0

func FindAllTemplate(imgSource, imgSearch gocv.Mat, args ...interface{}) []Result

FindAllTemplate find the imgSearch all template in the imgSource return []Result

func FindAllTemplateC added in v0.20.0

func FindAllTemplateC(imgSource, imgSearch gocv.Mat, args ...interface{}) []Result

FindAllTemplateC find the imgSearch all template in the imgSource return []Result and close gocv.Mat

func FindAllTemplateCS added in v0.31.0

func FindAllTemplateCS(imgSource, imgSearch gocv.Mat, args ...interface{}) []Result

FindAllTemplateCS find the imgSearch all template in the imgSource return []Result and close gocv.Mat

type Size added in v0.30.0

type Size struct {
	W, H int
}

Size the image size structure

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL