contrib

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

README

Using OpenCV Contrib

The OpenCV Contrib library contains experimental or non-free (aka patented) algorithms.

GoCV support for OpenCV Contrib can be found here in the "gocv.io/x/gocv/contrib" package.

For more information about OpenCV Contrib, please go to:

https://github.com/opencv/opencv_contrib

How to use

If you have followed the installation instructions from the main README, then the OpenCV contrib modules have already been compiled and installed.

First, you must include the contrib subpackage:

import (
    "gocv.io/x/gocv"
    "gocv.io/x/gocv/contrib"
)

Then you will be able to use the functions within the contrib subpackage. For example, this uses the SIFT feature identitification algorithm that is within the xfeatures2d module of OpenCV:

si := contrib.NewSIFT()
kp := si.Detect(img)

Documentation

Overview

Package contrib is the GoCV wrapper around OpenCV Contrib.

For further details, please see: https://github.com/opencv/opencv_contrib

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LBPHFaceRecognizer

type LBPHFaceRecognizer struct {
	// contains filtered or unexported fields
}

func (*LBPHFaceRecognizer) LoadFile

func (fr *LBPHFaceRecognizer) LoadFile(fname string)

load traned model data from file

see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#acc42e5b04595dba71f0777c7179af8c3

func (*LBPHFaceRecognizer) Predict

func (fr *LBPHFaceRecognizer) Predict(sample gocv.Mat) int

predict image for trained model, retun label for correctly predicted image, return -1 if not found

see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#aa2d2f02faffab1bf01317ae6502fb631

func (*LBPHFaceRecognizer) PredictExtendedResponse

func (fr *LBPHFaceRecognizer) PredictExtendedResponse(sample gocv.Mat) PredictResponse

the same as above but returns some more info

see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ab0d593e53ebd9a0f350c989fcac7f251

func (*LBPHFaceRecognizer) SaveFile

func (fr *LBPHFaceRecognizer) SaveFile(fname string)

save trained model data to file

see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a2adf2d555550194244b05c91fefcb4d6

func (*LBPHFaceRecognizer) SetNeighbors

func (fr *LBPHFaceRecognizer) SetNeighbors(neighbors int)

set Neighbors

see https://docs.opencv.org/3.4.0/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#ab225f7bf353ce8697a506eda10124a92 wrong neighbors can raise opencv exception!

func (*LBPHFaceRecognizer) Train

func (fr *LBPHFaceRecognizer) Train(images []gocv.Mat, labels []int)

Train loaded model with images and their labels

see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ac8680c2aa9649ad3f55e27761165c0d6

func (*LBPHFaceRecognizer) Update

func (fr *LBPHFaceRecognizer) Update(newImages []gocv.Mat, newLabels []int)

update existing trained model with new images and labels

see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a8a4e73ea878dcd0c235d0487189d25f3

type PredictResponse

type PredictResponse struct {
	Label      int32   `json:"label"`
	Confidence float32 `json:"confidence"`
}

type SIFT

type SIFT struct {
	// contains filtered or unexported fields
}

SIFT is a wrapper around the cv::SIFT algorithm.

func NewSIFT

func NewSIFT() SIFT

NewSIFT returns a new SIFT algorithm.

For further details, please see: https://docs.opencv.org/3.4.0/d5/d3c/classcv_1_1xfeatures2d_1_1SIFT.html

func (*SIFT) Close

func (d *SIFT) Close() error

Close SIFT.

func (*SIFT) Detect

func (d *SIFT) Detect(src gocv.Mat) []gocv.KeyPoint

Detect keypoints in an image using SIFT.

For further details, please see: https://docs.opencv.org/3.4.0/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887

func (*SIFT) DetectAndCompute

func (d *SIFT) DetectAndCompute(src gocv.Mat, mask gocv.Mat) ([]gocv.KeyPoint, gocv.Mat)

DetectAndCompute detects and computes keypoints in an image using SIFT.

For further details, please see: https://docs.opencv.org/3.4.0/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677

type SURF

type SURF struct {
	// contains filtered or unexported fields
}

SURF is a wrapper around the cv::SURF algorithm.

func NewSURF

func NewSURF() SURF

NewSURF returns a new SURF algorithm.

For further details, please see: https://docs.opencv.org/3.4.0/d5/df7/classcv_1_1xfeatures2d_1_1SURF.html

func (*SURF) Close

func (d *SURF) Close() error

Close SURF.

func (*SURF) Detect

func (d *SURF) Detect(src gocv.Mat) []gocv.KeyPoint

Detect keypoints in an image using SURF.

For further details, please see: https://docs.opencv.org/3.4.0/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887

func (*SURF) DetectAndCompute

func (d *SURF) DetectAndCompute(src gocv.Mat, mask gocv.Mat) ([]gocv.KeyPoint, gocv.Mat)

DetectAndCompute detects and computes keypoints in an image using SURF.

For further details, please see: https://docs.opencv.org/3.4.0/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677

Jump to

Keyboard shortcuts

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