cuda

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: Apache-2.0 Imports: 5 Imported by: 3

README

Cuda (Experimental)

In order to use the cuda package, the cuda toolkit from nvidia needs to be installed on the host system.

Please see https://docs.nvidia.com/cuda/index.html for more information.

Furthermore opencv must be compiled with cuda support.

Compiling opencv with cuda

For now we have included the make target install_cuda that compiles opencv with cuda. (For more details on the compilation process please see the Makefile)

Simply issue the command make install_cuda and you should be good to go.

Then finally verify that it is all working

cd $GOPATH/src/gocv.io/x/gocv
go run ./cmd/cuda/main.go

You should see something along the lines of:

gocv version: 0.19.0
cuda information:
  Device 0:  "GeForce MX150"  2003Mb, sm_61, Driver/Runtime ver.10.0/10.0

Documentation

Overview

Package cuda is the GoCV wrapper around OpenCV cuda.

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

import "gocv.io/x/gocv/cuda"

Index

Constants

View Source
const (
	// InterpolationNearestNeighbor is nearest neighbor. (fast but low quality)
	InterpolationNearestNeighbor InterpolationFlags = 0

	// InterpolationLinear is bilinear interpolation.
	InterpolationLinear = 1

	// InterpolationCubic is bicube interpolation.
	InterpolationCubic = 2

	// InterpolationArea uses pixel area relation. It is preferred for image
	// decimation as it gives moire-free results.
	InterpolationArea = 3

	// InterpolationLanczos4 is Lanczos interpolation over 8x8 neighborhood.
	InterpolationLanczos4 = 4

	// InterpolationDefault is an alias for InterpolationLinear.
	InterpolationDefault = InterpolationLinear

	// InterpolationMax indicates use maximum interpolation.
	InterpolationMax = 7
)
View Source
const (
	// BorderConstant border type
	BorderConstant BorderType = 0

	// BorderReplicate border type
	BorderReplicate = 1

	// BorderReflect border type
	BorderReflect = 2

	// BorderWrap border type
	BorderWrap = 3

	// BorderReflect101 border type
	BorderReflect101 = 4

	// BorderTransparent border type
	BorderTransparent = 5

	// BorderDefault border type
	BorderDefault = BorderReflect101

	// BorderIsolated border type
	BorderIsolated = 16
)

Variables

This section is empty.

Functions

func BuildWarpAffineMaps added in v0.21.0

func BuildWarpAffineMaps(M GpuMat, inverse bool, sz image.Point, xmap, ymap *GpuMat)

BuildWarpAffineMaps builds transformation maps for affine transformation.

For further details. please see: https://docs.opencv.org/master/db/d29/group__cudawarping.html#ga63504590a96e4cc702d994281d17bc1c

func BuildWarpPerspectiveMaps added in v0.21.0

func BuildWarpPerspectiveMaps(M GpuMat, inverse bool, sz image.Point, xmap, ymap *GpuMat)

BuildWarpPerspectiveMaps builds transformation maps for perspective transformation.

For further details, please see: https://docs.opencv.org/master/db/d29/group__cudawarping.html#ga8d16e3003703bd3b89cca98c913ef864

func GetCudaEnabledDeviceCount

func GetCudaEnabledDeviceCount() int

GetCudaEnabledDeviceCount returns the number of cuda enabled devices on the system

func PrintCudaDeviceInfo

func PrintCudaDeviceInfo(device int)

PrintCudaDeviceInfo prints extensive cuda device information

func PrintShortCudaDeviceInfo

func PrintShortCudaDeviceInfo(device int)

PrintShortCudaDeviceInfo prints a small amount of cuda device information

func PyrDown added in v0.21.0

func PyrDown(src GpuMat, dst *GpuMat)

PyrDown blurs an image and downsamples it.

For further details, please see: https://docs.opencv.org/master/db/d29/group__cudawarping.html#ga9c8456de9792d96431e065f407c7a91b

func PyrUp added in v0.21.0

func PyrUp(src GpuMat, dst *GpuMat)

PyrUp upsamples an image and then blurs it.

For further details, please see: https://docs.opencv.org/master/db/d29/group__cudawarping.html#ga2048da0dfdb9e4a726232c5cef7e5747

func Remap added in v0.21.0

func Remap(src GpuMat, dst, xmap, ymap *GpuMat, interpolation InterpolationFlags, borderMode BorderType, borderValue color.RGBA)

Remap applies a generic geometrical transformation to an image.

For further details, please see: https://docs.opencv.org/master/db/d29/group__cudawarping.html#ga0ece6c76e8efa3171adb8432d842beb0

func Resize added in v0.21.0

func Resize(src GpuMat, dst *GpuMat, sz image.Point, fx, fy float64, interp InterpolationFlags)

Resize resizes an image.

For further details, please see: https://docs.opencv.org/master/db/d29/group__cudawarping.html#ga4f5fa0770d1c9efbadb9be1b92a6452a

func Rotate added in v0.21.0

func Rotate(src GpuMat, dst *GpuMat, sz image.Point, angle, xShift, yShift float64, interp InterpolationFlags)

Rotate rotates an image around the origin (0,0) and then shifts it.

For further details, please see: https://docs.opencv.org/master/db/d29/group__cudawarping.html#ga55d958eceb0f871e04b1be0adc6ef1b5

func WarpAffine added in v0.21.0

func WarpAffine(src GpuMat, dst *GpuMat, m GpuMat, sz image.Point, flags InterpolationFlags, borderType BorderType, borderValue color.RGBA)

WarpAffine applies an affine transformation to an image. For more parameters please check WarpAffineWithParams

For further details, please see: https://docs.opencv.org/master/db/d29/group__cudawarping.html#ga9e8dd9e73b96bdc8e27d85c0e83f1130

func WarpPerspective added in v0.21.0

func WarpPerspective(src GpuMat, dst *GpuMat, m GpuMat, sz image.Point, flags InterpolationFlags, borderType BorderType, borderValue color.RGBA)

WarpPerspective applies a perspective transformation to an image.

For further details, please see: https://docs.opencv.org/master/db/d29/group__cudawarping.html#ga7a6cf95065536712de6b155f3440ccff

Types

type BackgroundSubtractorMOG

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

BackgroundSubtractorMOG is a wrapper around the cv::cuda::BackgroundSubtractorMOG.

func NewBackgroundSubtractorMOG

func NewBackgroundSubtractorMOG() BackgroundSubtractorMOG

NewBackgroundSubtractorMOG returns a new BackgroundSubtractor algorithm of type MOG. MOG is a Gaussian Mixture-based Background/Foreground Segmentation Algorithm.

For further details, please see: https://docs.opencv.org/master/dc/d3d/cudabgsegm_8hpp.html

func (*BackgroundSubtractorMOG) Apply

func (b *BackgroundSubtractorMOG) Apply(src GpuMat, dst *GpuMat)

Apply computes a foreground mask using the current BackgroundSubtractorMOG.

For further details, please see: https://docs.opencv.org/master/d1/dfe/classcv_1_1cuda_1_1BackgroundSubtractorMOG.html#a8f52d2f7abd1c77c84243efc53972cbf

func (*BackgroundSubtractorMOG) Close

func (b *BackgroundSubtractorMOG) Close() error

Close BackgroundSubtractorMOG.

type BackgroundSubtractorMOG2

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

BackgroundSubtractorMOG2 is a wrapper around the cv::cuda::BackgroundSubtractorMOG2.

func NewBackgroundSubtractorMOG2

func NewBackgroundSubtractorMOG2() BackgroundSubtractorMOG2

NewBackgroundSubtractorMOG2 returns a new BackgroundSubtractor algorithm of type MOG2. MOG2 is a Gaussian Mixture-based Background/Foreground Segmentation Algorithm.

For further details, please see: https://docs.opencv.org/master/dc/d3d/cudabgsegm_8hpp.html

func (*BackgroundSubtractorMOG2) Apply

func (b *BackgroundSubtractorMOG2) Apply(src GpuMat, dst *GpuMat)

Apply computes a foreground mask using the current BackgroundSubtractorMOG2.

For further details, please see: https://docs.opencv.org/master/df/d23/classcv_1_1cuda_1_1BackgroundSubtractorMOG2.html#a92408f07bf1268c1b778cb186b3113b0

func (*BackgroundSubtractorMOG2) Close

func (b *BackgroundSubtractorMOG2) Close() error

Close BackgroundSubtractorMOG2.

type BorderType added in v0.21.0

type BorderType int

BorderType type of border.

type GpuMat

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

GpuMat is the GPU version of a Mat

For further details, please see: https://docs.opencv.org/master/d0/d60/classcv_1_1cuda_1_1GpuMat.html

func NewGpuMat

func NewGpuMat() GpuMat

NewGpuMat returns a new empty GpuMat

func NewGpuMatFromMat added in v0.21.0

func NewGpuMatFromMat(mat gocv.Mat) GpuMat

NewGpuMatFromMat returns a new GpuMat based on a Mat

func (*GpuMat) Close

func (g *GpuMat) Close() error

Close the GpuMat object

func (*GpuMat) Download

func (g *GpuMat) Download(dst *gocv.Mat)

Download performs data download from GpuMat (Blocking call)

For further details, please see: https://docs.opencv.org/master/d0/d60/classcv_1_1cuda_1_1GpuMat.html#a027e74e4364ddfd9687b58aa5db8d4e8

func (*GpuMat) Empty

func (g *GpuMat) Empty() bool

Empty returns true if GpuMat is empty

func (*GpuMat) Upload

func (g *GpuMat) Upload(data gocv.Mat)

Upload performs data upload to GpuMat (Blocking call)

For further details, please see: https://docs.opencv.org/master/d0/d60/classcv_1_1cuda_1_1GpuMat.html#a00ef5bfe18d14623dcf578a35e40a46b

type InterpolationFlags added in v0.21.0

type InterpolationFlags int

InterpolationFlags are bit flags that control the interpolation algorithm that is used.

type SparsePyrLKOpticalFlow added in v0.21.0

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

SparsePyrLKOpticalFlow is a wrapper around the cv::cuda::SparsePyrLKOpticalFlow.

func NewSparsePyrLKOpticalFlow added in v0.21.0

func NewSparsePyrLKOpticalFlow() SparsePyrLKOpticalFlow

NewSparsePyrLKOpticalFlow returns a new SparsePyrLKOpticalFlow

For further details, please see: https://docs.opencv.org/master/d7/d05/classcv_1_1cuda_1_1SparsePyrLKOpticalFlow.html#a6bcd2d457532d7db76c3e7f11b60063b

func (SparsePyrLKOpticalFlow) Calc added in v0.21.0

func (s SparsePyrLKOpticalFlow) Calc(prevImg, nextImg, prevPts, nextPts, status GpuMat)

Calc calculates a sparse optical flow.

For further details, please see: https://docs.opencv.org/master/d5/dcf/classcv_1_1cuda_1_1SparseOpticalFlow.html#a80d5efbb7788e3dc4c49e6226ba34347

Jump to

Keyboard shortcuts

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