cv

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImgprocModules

func ImgprocModules(ctx *Context) wypes.Modules

func MatModules

func MatModules(ctx *Context) wypes.Modules

func NetModules

func NetModules(ctx *Context) wypes.Modules

func ObjDetectModules

func ObjDetectModules(ctx *Context) wypes.Modules

Types

type BlobParams added in v0.4.0

type BlobParams struct {
	ScaleFactor wypes.Float32
	Size        Size
	Mean        Scalar
	SwapRB      wypes.Bool
	DDepth      wypes.UInt8
	DataLayout  wypes.UInt8
	PaddingMode wypes.UInt8
	Border      Scalar
}

BlobParams represents the record "wasm:cv/types#blob-params".

record blob-params {
	scale-factor: f32,
	size: size,
	mean: scalar,
	swap-RB: bool,
	ddepth: u8,
	data-layout: data-layout-type,
	padding-mode: padding-mode-type,
	border: scalar,
}

func (BlobParams) Lift added in v0.4.0

func (BlobParams) Lift(s *wypes.Store) BlobParams

func (BlobParams) Lower added in v0.4.0

func (v BlobParams) Lower(s *wypes.Store)

Lower implements [Lower] interface.

func (BlobParams) MemoryLift added in v0.4.0

func (BlobParams) MemoryLift(s *wypes.Store, offset uint32) (BlobParams, uint32)

MemoryLift implements [MemoryLift] interface.

func (BlobParams) MemoryLower added in v0.4.0

func (v BlobParams) MemoryLower(s *wypes.Store, offset uint32) (length uint32)

MemoryLower implements [MemoryLower] interface.

func (BlobParams) Unwrap added in v0.4.0

func (v BlobParams) Unwrap() gocv.ImageToBlobParams

func (BlobParams) ValueTypes added in v0.4.0

func (v BlobParams) ValueTypes() []wypes.ValueType

type BlobRectImageParams added in v0.4.0

type BlobRectImageParams struct {
	Offset uint32
	Params BlobParams
	Rects  wypes.List[Rect]
	Size   Size
}

func (BlobRectImageParams) Lift added in v0.4.0

func (BlobRectImageParams) Lower added in v0.4.0

func (v BlobRectImageParams) Lower(s *wypes.Store)

Lower implements [Lower] interface.

func (BlobRectImageParams) MemoryLift added in v0.4.0

func (BlobRectImageParams) MemoryLift(s *wypes.Store, offset uint32) (BlobRectImageParams, uint32)

MemoryLift implements [MemoryLift] interface.

func (BlobRectImageParams) MemoryLower added in v0.4.0

func (v BlobRectImageParams) MemoryLower(s *wypes.Store, offset uint32) (length uint32)

MemoryLower implements [MemoryLower] interface.

func (BlobRectImageParams) Unwrap added in v0.4.0

func (BlobRectImageParams) ValueTypes added in v0.4.0

func (v BlobRectImageParams) ValueTypes() []wypes.ValueType

type CascadeClassifier

type CascadeClassifier struct {
	ID       wypes.UInt32
	Name     string
	Filename string

	Classifier gocv.CascadeClassifier
}

CascadeClassifier is a wrapper around gocv.CascadeClassifier for detection.

func NewCascadeClassifier

func NewCascadeClassifier(name string) *CascadeClassifier

NewCascadeClassifier creates a new CascadeClassifier.

func (*CascadeClassifier) Close

func (c *CascadeClassifier) Close()

Close closes the CascadeClassifier.

func (*CascadeClassifier) SetClassifier

func (cc *CascadeClassifier) SetClassifier(c gocv.CascadeClassifier)

SetClassifier sets the gocv.CascadeClassifier for the CascadeClassifier.

type Context

type Context struct {
	ReturnDataPtr  uint32
	ModelsDir      string
	Config         *config.Store
	FrameStore     *datastore.Frames
	ProcessorStore *datastore.Processors
	EnableCUDA     bool
}

Context is the configuration for the cv package used when each call is made from the guest module.

func NewContext added in v0.4.0

func NewContext(modelsDir string, conf *config.Store, datastorage string, enableCUDA bool) *Context

type FaceDetectorYN

type FaceDetectorYN struct {
	ID       wypes.UInt32
	Name     string
	Filename string

	Detector gocv.FaceDetectorYN
}

FaceDetectorYN is a wrapper around gocv.FaceDectectorYN for detection.

func NewFaceDetectorYN

func NewFaceDetectorYN(model string) *FaceDetectorYN

NewFaceDetectorYN creates a new FaceDetectorYN.

func (*FaceDetectorYN) Close

func (d *FaceDetectorYN) Close()

Close closes the FaceDectectorYN.

func (*FaceDetectorYN) SetDetector

func (d *FaceDetectorYN) SetDetector(dd gocv.FaceDetectorYN)

SetDetector sets the gocv.FaceDetectorYN for the FaceDectectorYN.

type Frame

type Frame struct {
	ID    wypes.UInt32
	Image gocv.Mat
}

Frame is a container for an image frame.

func NewEmptyFrame

func NewEmptyFrame() *Frame

NewEmptyFrame creates a new Frame with an empty Mat.

func NewFrame

func NewFrame(img gocv.Mat) *Frame

NewFrame creates a new Frame.

func (*Frame) Close

func (f *Frame) Close()

Close closes the frame.

func (*Frame) Empty

func (f *Frame) Empty() bool

func (*Frame) SetImage

func (f *Frame) SetImage(img gocv.Mat)

SetImage sets the image of the frame.

type Layer added in v0.4.0

type Layer struct {
	ID wypes.UInt32

	Layer gocv.Layer
}

Layer is a wrapper around gocv.Layer for DNN image processing.

func NewLayer added in v0.4.0

func NewLayer(layer gocv.Layer) *Layer

func (*Layer) Close added in v0.4.0

func (l *Layer) Close()

func (*Layer) SetLayer added in v0.4.0

func (l *Layer) SetLayer(layer gocv.Layer)

type MixMaxLocResult added in v0.4.0

type MixMaxLocResult struct {
	MinVal wypes.Float32
	MaxVal wypes.Float32
	MinLoc Size
	MaxLoc Size
}

MixMaxLocResult represents the record "wasm:cv/types#mix-max-loc-result".

record mix-max-loc-result {
	min-val: f32,
	max-val: f32,
	min-loc: size,
	max-loc: size,
}

func (MixMaxLocResult) Lift added in v0.4.0

func (MixMaxLocResult) Lower added in v0.4.0

func (v MixMaxLocResult) Lower(s *wypes.Store)

Lower implements [Lower] interface.

func (MixMaxLocResult) MemoryLift added in v0.4.0

func (MixMaxLocResult) MemoryLift(s *wypes.Store, offset uint32) (MixMaxLocResult, uint32)

MemoryLift implements [MemoryLift] interface.

func (MixMaxLocResult) MemoryLower added in v0.4.0

func (v MixMaxLocResult) MemoryLower(s *wypes.Store, offset uint32) (length uint32)

MemoryLower implements [MemoryLower] interface.

func (MixMaxLocResult) Unwrap added in v0.4.0

func (v MixMaxLocResult) Unwrap() MixMaxLocResult

func (MixMaxLocResult) ValueTypes added in v0.4.0

func (v MixMaxLocResult) ValueTypes() []wypes.ValueType

type Net

type Net struct {
	ID       wypes.UInt32
	Name     string
	Filename string

	Net gocv.Net
}

Net is a wrapper around gocv.Net for DNN image processing.

func NewNet

func NewNet(model string) *Net

NewNet creates a new Net.

func (*Net) Close

func (n *Net) Close()

Close closes the Net.

func (*Net) SetNet

func (n *Net) SetNet(net gocv.Net)

SetNet sets the gocv.Net for the Net.

type RGBA

type RGBA struct {
	R wypes.UInt8
	G wypes.UInt8
	B wypes.UInt8
	A wypes.UInt8
}

RGBA represents the record "wasm:cv/types#RGBA".

record RGBA {
	r: u8,
	g: u8,
	b: u8,
	a: u8,
}

func (RGBA) Lift

func (RGBA) Lift(s *wypes.Store) RGBA

func (RGBA) Lower

func (v RGBA) Lower(s *wypes.Store)

Lower implements [Lower] interface.

func (RGBA) MemoryLift

func (RGBA) MemoryLift(s *wypes.Store, offset uint32) (RGBA, uint32)

MemoryLift implements [MemoryLift] interface.

func (RGBA) MemoryLower

func (v RGBA) MemoryLower(s *wypes.Store, offset uint32) (length uint32)

MemoryLower implements [MemoryLower] interface.

func (RGBA) Unwrap

func (v RGBA) Unwrap() color.RGBA

func (RGBA) ValueTypes

func (v RGBA) ValueTypes() []wypes.ValueType

type Rect

type Rect struct {
	Min Size
	Max Size
}

Rect represents the record "wasm:cv/types#rect".

record rect {
	min: size,
	max: size,
}

func (Rect) Lift

func (Rect) Lift(s *wypes.Store) Rect

func (Rect) Lower

func (v Rect) Lower(s *wypes.Store)

Lower implements [Lower] interface.

func (Rect) MemoryLift

func (Rect) MemoryLift(s *wypes.Store, offset uint32) (Rect, uint32)

MemoryLift implements [MemoryLift] interface.

func (Rect) MemoryLower

func (v Rect) MemoryLower(s *wypes.Store, offset uint32) (length uint32)

MemoryLower implements [MemoryLower] interface.

func (Rect) Unwrap

func (v Rect) Unwrap() image.Rectangle

func (Rect) ValueTypes

func (v Rect) ValueTypes() []wypes.ValueType

type Scalar

type Scalar struct {
	Val1 wypes.Float32
	Val2 wypes.Float32
	Val3 wypes.Float32
	Val4 wypes.Float32
}

Scalar represents the record "wasm:cv/types#scalar".

record scalar {
	val1: f32,
	val2: f32,
	val3: f32,
	val4: f32,
}

func (Scalar) Lift

func (Scalar) Lift(s *wypes.Store) Scalar

func (Scalar) Lower

func (v Scalar) Lower(s *wypes.Store)

Lower implements [Lower] interface.

func (Scalar) MemoryLift

func (Scalar) MemoryLift(s *wypes.Store, offset uint32) (Scalar, uint32)

MemoryLift implements [MemoryLift] interface.

func (Scalar) MemoryLower

func (v Scalar) MemoryLower(s *wypes.Store, offset uint32) (length uint32)

MemoryLower implements [MemoryLower] interface.

func (Scalar) Unwrap

func (v Scalar) Unwrap() gocv.Scalar

func (Scalar) ValueTypes

func (v Scalar) ValueTypes() []wypes.ValueType

type Size

type Size struct {
	X wypes.Int32
	Y wypes.Int32
}

Size represents the record "wasm:cv/types#size".

record size {
	x: s32,
	y: s32,
}

func (Size) Lift

func (Size) Lift(s *wypes.Store) Size

func (Size) Lower

func (v Size) Lower(s *wypes.Store)

Lower implements [Lower] interface.

func (Size) MemoryLift

func (Size) MemoryLift(s *wypes.Store, offset uint32) (Size, uint32)

MemoryLift implements [MemoryLift] interface.

func (Size) MemoryLower

func (v Size) MemoryLower(s *wypes.Store, offset uint32) (length uint32)

MemoryLower implements [MemoryLower] interface.

func (Size) Unwrap

func (v Size) Unwrap() image.Point

func (Size) ValueTypes

func (v Size) ValueTypes() []wypes.ValueType

Jump to

Keyboard shortcuts

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