gcv

package module
v0.40.5 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: BSD-3-Clause Imports: 5 Imported by: 3

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 Crop added in v0.40.0

func Crop(img gocv.Mat, rect image.Rectangle) gocv.Mat

Crop crop the cv.Mat by rect with crabcut

func Fill added in v0.20.0

func Fill(iGray gocv.Mat, rect Rect)

Fill fillpoly the iGray image

func FindAllX added in v0.40.5

func FindAllX(imgSearch, imgSource image.Image, args ...interface{}) (x, y []int)

FindAllX find all the img search in the img source by find all template and sift and return []x, []y

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 FindImgX added in v0.40.0

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

FindImgX 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 FindX added in v0.40.0

func FindX(imgSearch, imgSource image.Image, args ...interface{}) (x, y int)

FindX find all the img search in the img source by find all template and sift and return x, y

func FlannbasedMatch added in v0.30.0

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

FlannbasedMatch new flann based match

func GetSize added in v0.40.0

func GetSize(img gocv.Mat) (int, int)

GetSize get the cv.Mat width, hight

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 ImgToMatA added in v0.40.0

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

ImgToMatA 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 MarkPoint added in v0.40.0

func MarkPoint(img gocv.Mat, point image.Point, args ...interface{}) gocv.Mat

MarkPoint mark the point draw line to img

func MaskImg added in v0.40.0

func MaskImg(img *gocv.Mat, mark image.Rectangle, args ...interface{})

MaskImg rectangle the mark to img

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 Resize added in v0.40.0

func Resize(img gocv.Mat, sz image.Point, w, h float64) gocv.Mat

Resize resize the image

func Rotate added in v0.40.0

func Rotate(img gocv.Mat, args ...interface{}) gocv.Mat

Rotate rotate the image to 90, 180, 270 degrees

func Show

func Show(img gocv.Mat, args ...interface{})

Show show the gocv.Mat image in the window

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 Find added in v0.40.0

func Find(imgSearch, imgSource image.Image, args ...interface{}) (r Result)

Find find all the img search in the img source by find all template and sift and return Result

func FindAll added in v0.40.0

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

FindAll find all the img search in the img source by find all template and sift and return []Result

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 FindAllSift added in v0.40.0

func FindAllSift(imSource, imSearch gocv.Mat, args ...interface{}) (res []Result)

FindAllSift find the imSearch all sift in imSource return result

func FindAllSiftC added in v0.40.0

func FindAllSiftC(imSource, imSearch gocv.Mat, args ...interface{}) []Result

FindAllSiftC find the imgSearch all sift in the imgSource return []Result and close gocv.Mat

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