wasmCV Documentation - v0.6.0

wasmCV is a WebAssembly guest module interface for computer vision based on OpenCV.

Import interface wasm:cv/types


Types

record size

size is a 2-element integer vector. It represents a width and height.

Record Fields

type point

size

record scalar

scalar is a 4-element floating point vector.

Record Fields

record rect

rect is a rectangle with integer coordinates. It is represented by the top-left corner and the bottom-right corner.

Record Fields

record RGBA

RGBA is a color with red, green, blue, and alpha channels.

Record Fields

enum border-type

border-type is a type of border to add to an image.

Enum Cases

enum adaptive-threshold-type

adaptive-threshold-type is a type of adaptive thresholding.

Enum Cases

enum threshold-type

threshold-type is a type of thresholding.

Enum Cases

enum data-layout-type

data-layout-type is a type of data layout.

Enum Cases

enum padding-mode-type

Enum Cases

record blob-params

Record Fields

record mix-max-loc-result

Record Fields

enum hershey-font-type

Enum Cases

enum interpolation-type

Enum Cases

enum color-coversion-type

Enum Cases

enum morph-shape

Enum Cases

Import interface wasm:cv/mat

mat resource is a matrix of bytes, wrapper around the cv::Mat type.


Types

type mix-max-loc-result

mix-max-loc-result

Enum Cases

resource mat


Functions

[constructor]mat: func

Create a new Mat. id does not currently do anything.

Params
Return values

[static]mat.new-with-size: func

Create a new Mat with the specified size and type.

Params
Return values

[method]mat.clone: func

Clone returns a cloned full copy of the Mat.

Params
Return values

[method]mat.close: func

Close the Mat

Params

[method]mat.cols: func

Cols returns the number of columns for this Mat.

Params
Return values

[method]mat.rows: func

Rows returns the number of rows for this Mat.

Params
Return values

[method]mat.region: func

Region returns a new Mat that points to a region of this Mat. Changes made to the region Mat will affect the original Mat, since they are pointers to the underlying OpenCV Mat object.

Params
Return values

[method]mat.copy-to: func

CopyTo copies Mat into destination Mat.

Params

[method]mat.mattype: func

MatType returns the type of the Mat.

Params
Return values

[method]mat.size: func

Size returns an array with one element for each dimension containing the size of that dimension for the Mat.

Params
Return values

[method]mat.empty: func

Empty returns true if the Mat is empty.

Params
Return values

[method]mat.get-float-at: func

GetFloatAt returns the value at the specified row and column as a f32.

Params
Return values

[method]mat.set-float-at: func

SetFloatAt sets the value at the specified row and column as a f32.

Params

[method]mat.get-uchar-at: func

GetUCharAt returns the value at the specified row and column as a u8.

Params
Return values

[method]mat.set-uchar-at: func

SetUCharAt sets the value at the specified row and column as a u8.

Params

[method]mat.get-int-at: func

GetIntAt returns the value at the specified row and column as a s32.

Params
Return values

[method]mat.set-int-at: func

SetIntAt sets the value at the specified row and column as a s32.

Params

[method]mat.get-float-at3: func

GetFloatAt3 returns the value at the specified x, y, z as a f32.

Params
Return values

[method]mat.set-float-at3: func

SetFloatAt3 sets the value at the specified x, y, z as a f32.

Params

[method]mat.get-uchar-at3: func

GetUCharAt3 returns the value at the specified x, y, z as a u8.

Params
Return values

[method]mat.set-uchar-at3: func

SetUCharAt3 sets the value at the specified x, y, z as a u8.

Params

[method]mat.get-int-at3: func

GetIntAt3 returns the value at the specified x, y, z as a s32.

Params
Return values

[method]mat.set-int-at3: func

SetIntAt3 sets the value at the specified x, y, z as a s32.

Params

[method]mat.get-vecb-at: func

GetVecbAt returns a vector of bytes. Its size corresponds to the number of channels of the Mat.

Params
Return values

[method]mat.get-vecf-at: func

GetVecfAt returns a vector of floats. Its size corresponds to the number of channels of the Mat.

Params
Return values

[method]mat.get-veci-at: func

GetVeciAt returns a vector of s32. Its size corresponds to the number of channels of the Mat.

Params
Return values

[method]mat.reshape: func

Reshape changes the shape and/or the number of channels of a 2D matrix without copying the data.

For further details, please see: https://docs.opencv.org/4.x/d3/d63/classcv_1_1Mat.html#a4eb96e3251417fa88b78e2abd6cfd7d8

Params
Return values

[method]mat.row-range: func

RowRange creates a matrix header for the specified row span.

For further details, please see: https://docs.opencv.org/4.x/d3/d63/classcv_1_1Mat.html#aa6542193430356ad631a9beabc624107

Params
Return values

[method]mat.col-range: func

ColRange creates a matrix header for the specified column span.

For further details, please see: https://docs.opencv.org/4.x/d3/d63/classcv_1_1Mat.html#aadc8f9210fe4dec50513746c246fa8d9

Params
Return values

[method]mat.min-max-loc: func

MinMaxLoc finds the global minimum and maximum in an array.

For further details, please see: https://docs.opencv.org/trunk/d2/de8/group__core__array.html#gab473bf2eb6d14ff97e89b355dac20707

Params
Return values

Import interface wasm:cv/cv


Types

type border-type

border-type

Functions

arrowed-line: func

drawing functions ArrowedLine draws a arrow segment pointing from the first point to the second one.

For further details, please see: https://docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga0a165a3ca093fd488ac709fdf10c05b2

Params

rectangle: func

Rectangle draws a simple, thick, or filled up-right rectangle.

For further details, please see: https://docs.opencv.org/4.x/d6/d6e/group__imgproc__draw.html#ga07d2f74cadcf8e305e810ce8f3d1e1b7

Params

circle: func

Circle draws a circle.

For further details, please see: https://docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#gaf10604b069374903dbd0f0488cb43670

Params

line: func

Line draws a line segment connecting two points.

For further details, please see: https://docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga7078a9fae8c7e7d13d24dac2520ae4a2

Params

put-text: func

PutText draws a text string. It renders the specified text string into the img Mat at the location passed in the “org” param, using the desired font face, font scale, color, and line thinkness.

For further details, please see: http://docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga5126f47f883d730f633d74f07456c576

Params

adaptive-threshold: func

imgproc functions AdaptiveThreshold applies a fixed-level threshold to each array element.

For further details, please see: https://docs.opencv.org/master/d7/d1b/group__imgproc__misc.html#ga72b913f352e4a1b1b397736707afcde3

Params
Return values

blur: func

Blur blurs an image Mat using a normalized box filter.

For further details, please see: https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga8c45db9afe636703801b0b2e440fce37

Params
Return values

box-filter: func

BoxFilter blurs an image using the box filter.

For further details, please see: https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gad533230ebf2d42509547d514f7d3fbc3

Params
Return values

canny: func

Canny finds edges in an image using the Canny algorithm. The function finds edges in the input image image and marks them in the output map edges using the Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The largest value is used to find initial segments of strong edges. See http://en.wikipedia.org/wiki/Canny_edge_detector

For further details, please see: http://docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga04723e007ed888ddf11d9ba04e2232de

Params
Return values

cvt-color: func

CvtColor converts an image from one color space to another.

For further details, please see: http://docs.opencv.org/master/d7/d1b/group__imgproc__misc.html#ga4e0972be5de079fed4e3a10e24ef5ef0

Params
Return values

dilate: func

Dilate dilates an image by using a specific structuring element.

For further details, please see: https://docs.opencv.org/4.x/d4/d86/group__imgproc__filter.html#ga4ff0f3318642c4f469d0e11f242f3b6c

Params
Return values

erode: func

Erode erodes an image by using a specific structuring element.

For further details, please see: https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaeb1e0c1033e3f6b891a25d0511362aeb

Params
Return values

equalize-hist: func

EqualizeHist normalizes the brightness and increases the contrast of the image.

For further details, please see: https://docs.opencv.org/master/d6/dc7/group__imgproc__hist.html#ga7e54091f0c937d49bf84152a16f76d6e

Params
Return values

gaussian-blur: func

GaussianBlur blurs an image using a Gaussian filter.

For further details, please see: https://docs.opencv.org/4.x/d4/d86/group__imgproc__filter.html#gae8bdcd9154ed5ca3cbc1766d960f45c1

Params
Return values

get-structuring-element: func

GetStructuringElement returns a structuring element of the specified size and shape for morphological operations.

For further details, please see: https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gac342a1bb6eabf6f55c803b09268e36dc

Params
Return values

hough-lines: func

HoughLines implements the standard or standard multi-scale Hough transform algorithm for line detection. For a good explanation of Hough transform, see: http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm

For further details, please see: http://docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga46b4e588934f6c8dfd509cc6e0e4545a

Params
Return values

hough-lines-p: func

HoughLinesP implements the probabilistic Hough transform algorithm for line detection. For a good explanation of Hough transform, see: http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm

For further details, please see: http://docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga8618180a5948286384e3b7ca02f6feeb

Params
Return values

median-blur: func

MedianBlur blurs an image using the median filter.

For further details, please see: https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga564869aa33e58769b4469101aac458f9

Params
Return values

resize: func

Resize resizes an image. It resizes the image src down to or up to the specified size, storing the result in dst. Note that src and dst may be the same image. If you wish to scale by factor, an empty sz may be passed and non-zero fx and fy. Likewise, if you wish to scale to an explicit size, a non-empty sz may be passed with zero for both fx and fy.

For further details, please see: https://docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga47a974309e9102f5f08231edc7e7529d

Params
Return values

threshold: func

Threshold applies a fixed-level threshold to each array element.

For further details, please see: https://docs.opencv.org/3.3.0/d7/d1b/group__imgproc__misc.html#gae8a4a146d1ca78c626a53577199e9c57

Params
Return values

transpose-ND: func

Transpose for n-dimensional matrices.

For further details, please see: https://docs.opencv.org/4.x/d2/de8/group__core__array.html#gab1b1274b4a563be34cdfa55b8919a4ec

Params
Return values

Import interface wasm:cv/dnn


Types

type mat

mat

Enum Cases

enum net-target-type

Enum Cases

resource layer

resource net


Functions

[constructor]layer: func

Return values

[method]layer.get-name: func

GetName returns the name of the layer.

Params
Return values

[static]net.read: func

ReadNet read deep learning network represented in one of the supported formats.

For further details, please see: https://docs.opencv.org/4.x/d6/d0f/group__dnn.html#ga138439da76f26266fdefec9723f6c5cd

Params
Return values

[static]net.read-from-ONNX: func

ReadNetFromONNX reads a network model stored in ONNX framework’s format.

For further details, please see: https://docs.opencv.org/4.x/d6/d0f/group__dnn.html#ga9198ecaac7c32ddf0aa7a1bcbd359567

Params
Return values

[method]net.close: func

Close the network

Params

[method]net.empty: func

Empty returns true if there are no layers in the network.

For further details, please see: https://docs.opencv.org/master/db/d30/classcv_1_1dnn_1_1Net.html#a6a5778787d5b8770deab5eda6968e66c

Params
Return values

[method]net.set-input: func

SetInput sets the new input value for the network.

For further details, please see: https://docs.opencv.org/trunk/db/d30/classcv_1_1dnn_1_1Net.html#a672a08ae76444d75d05d7bfea3e4a328

Params

[method]net.forward: func

Forward runs forward pass to compute output of layer with name outputName.

For further details, please see: https://docs.opencv.org/trunk/db/d30/classcv_1_1dnn_1_1Net.html#a98ed94cb6ef7063d3697259566da310b

Params
Return values

[method]net.forward-layers: func

ForwardLayers forward pass to compute outputs of layers listed in outBlobNames.

For further details, please see: https://docs.opencv.org/4.x/db/d30/classcv_1_1dnn_1_1Net.html#afe22e099b60a2883e220645391f68d4c

Params
Return values

[method]net.get-unconnected-out-layers: func

GetUnconnectedOutLayers returns indexes of layers with unconnected outputs.

For further details, please see: https://docs.opencv.org/4.x/db/d30/classcv_1_1dnn_1_1Net.html#ae26f0c29b3733d15d0482098ef9053e3

Params
Return values

[method]net.get-layer-names: func

GetLayerNames returns names of layers in the network.

For further details, please see: hhttps://docs.opencv.org/4.x/db/d30/classcv_1_1dnn_1_1Net.html#a38e67098ae4ae5906bf8d8ea72199c2e

Params
Return values

[method]net.get-layer: func

GetLayer returns layer with specified id.

For further details, please see: https://docs.opencv.org/4.x/db/d30/classcv_1_1dnn_1_1Net.html#ac944d7f2d3ead5ef9b1b2fa3885f3ff1

Params
Return values

blob-from-image: func

BlobFromImage creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

For further details, please see: https://docs.opencv.org/4.x/d6/d0f/group__dnn.html#ga29f34df9376379a603acd8df581ac8d7

Params
Return values

blob-from-image-with-params: func

BlobFromImageWithParams creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

For further details, please see: https://docs.opencv.org/4.x/d6/d0f/group__dnn.html#ga29f34df9376379a603acd8df581ac8d7

Params
Return values

blob-rects-to-image-rects: func

BlobRectsToImageRects converts blob rects to image rects.

For further details, please see: https://docs.opencv.org/4.4.0/d6/d0f/group__dnn.html#ga9d118d70a1659af729d01b10233213ee

Params
Return values

NMS-boxes: func

NMSBoxes performs non maximum suppression given boxes and corresponding scores.

For futher details, please see: https://docs.opencv.org/4.4.0/d6/d0f/group__dnn.html#ga9d118d70a1659af729d01b10233213ee

Params
Return values

Import interface wasm:cv/objdetect


Types

type mat

mat

CascadeClassifier is a cascade classifier class for object detection.

resource HOG-descriptor

HOGDescriptor is a Histogram Of Gradiants (HOG) for object detection.

For further details, please see: https://docs.opencv.org/master/d5/d33/structcv_1_1HOGDescriptor.html#a723b95b709cfd3f95cf9e616de988fc8

resource face-detector-YN

enum face-distance-type

Enum Cases

resource face-recognizer-SF


Functions

[constructor]cascade-classifier: func

NewCascadeClassifier returns a new CascadeClassifier.

For further details, please see: https://docs.opencv.org/4.x/df/d20/classcv_1_1FaceDetectorYN.html#a5f7fb43c60c95ca5ebab78483de02516

Params
Return values

[method]cascade-classifier.close: func

Close the CascadeClassifier

Params

[method]cascade-classifier.load: func

Load cascade classifier from a file.

For further details, please see: http://docs.opencv.org/master/d1/de5/classcv_1_1CascadeClassifier.html#a1a5884c8cc749422f9eb77c2471958bc

Params
Return values

[method]cascade-classifier.detect-multi-scale: func

DetectMultiScale detects objects of different sizes in the input Mat image. The detected objects are returned as a slice of image.Rectangle structs.

For further details, please see: http://docs.opencv.org/master/d1/de5/classcv_1_1CascadeClassifier.html#aaf8181cb63968136476ec4204ffca498

Params
Return values

[method]cascade-classifier.detect-multi-scale-with-params: func

DetectMultiScaleWithParams detects objects of different sizes in the input Mat image. The detected objects are returned as a slice of image.Rectangle structs.

For further details, please see: http://docs.opencv.org/master/d1/de5/classcv_1_1CascadeClassifier.html#aaf8181cb63968136476ec4204ffca498

Params
Return values

[constructor]HOG-descriptor: func

NewHOGDescriptor returns a new HOGDescriptor.

Params
Return values

[method]HOG-descriptor.close: func

Close the HOGDescriptor

Params

[method]HOG-descriptor.detect-multi-scale: func

DetectMultiScale detects objects of different sizes in the input Mat image. The detected objects are returned as a slice of image.Rectangle structs.

For further details, please see: https://docs.opencv.org/master/d5/d33/structcv_1_1HOGDescriptor.html#a660e5cd036fd5ddf0f5767b352acd948

Params
Return values

[method]HOG-descriptor.detect-multi-scale-with-params: func

DetectMultiScaleWithParams detects objects of different sizes in the input Mat image. The detected objects are returned as a slice of image.Rectangle structs.

For further details, please see: https://docs.opencv.org/master/d5/d33/structcv_1_1HOGDescriptor.html#a660e5cd036fd5ddf0f5767b352acd948

Params
Return values

[constructor]face-detector-YN: func

Creates an instance of face detector YN with given parameters.

For further details, please see: https://docs.opencv.org/4.x/df/d20/classcv_1_1FaceDetectorYN.html#a5f7fb43c60c95ca5ebab78483de02516

Params
Return values

[static]face-detector-YN.new-with-params: func

Creates an instance of face detector YN with given parameters.

For further details, please see: https://docs.opencv.org/4.x/df/d20/classcv_1_1FaceDetectorYN.html#a5f7fb43c60c95ca5ebab78483de02516

Params
Return values

[method]face-detector-YN.close: func

Close the face detector

Params

[method]face-detector-YN.detect: func

Detects faces in the input image.

For further details, please see: https://docs.opencv.org/4.x/df/d20/classcv_1_1FaceDetectorYN.html#ac05bd075ca3e6edc0e328927aae6f45b

Params
Return values

[method]face-detector-YN.get-input-size: func

Params
Return values

[method]face-detector-YN.get-nms-threshold: func

Params
Return values

[method]face-detector-YN.get-score-threshold: func

Params
Return values

[method]face-detector-YN.get-topk: func

Params
Return values

[method]face-detector-YN.set-input-size: func

Params

[method]face-detector-YN.set-nms-threshold: func

Params

[method]face-detector-YN.set-score-threshold: func

Params

[method]face-detector-YN.set-topk: func

Params

[constructor]face-recognizer-SF: func

Creates an instance of FaceRecognizerSF with given parameters.

For further details, please see: https://docs.opencv.org/4.x/da/d09/classcv_1_1FaceRecognizerSF.html#a04df90b0cd7d26d350acd92621a35743

Params
Return values

[static]face-recognizer-SF.new-with-params: func

Creates an instance of FaceRecognizerSF with given parameters.

For further details, please see: https://docs.opencv.org/4.x/da/d09/classcv_1_1FaceRecognizerSF.html#a04df90b0cd7d26d350acd92621a35743

Params
Return values

[method]face-recognizer-SF.close: func

Close the face FaceRecognizerSF

Params

[method]face-recognizer-SF.align-crop: func

Aligns detected face with the source input image and crops it.

For further details, please see: https://docs.opencv.org/4.x/da/d09/classcv_1_1FaceRecognizerSF.html#a84492908abecbc9362b4ddc8d46b8345

Params
Return values

[method]face-recognizer-SF.feature: func

Feature extracts face feature from aligned image.

For further details, please see: https://docs.opencv.org/4.x/da/d09/classcv_1_1FaceRecognizerSF.html#ab1b4a3c12213e89091a490c573dc5aba

Params
Return values

[method]face-recognizer-SF.match: func

Match calculates the distance between two face features.

For further details, please see: https://docs.opencv.org/4.x/da/d09/classcv_1_1FaceRecognizerSF.html#a2f0362ca1e64320a1f3ba7e1386d0219

Params
Return values

[method]face-recognizer-SF.match-with-params: func

Match calculates the distance between two face features.

For further details, please see: https://docs.opencv.org/4.x/da/d09/classcv_1_1FaceRecognizerSF.html#a2f0362ca1e64320a1f3ba7e1386d0219

Params
Return values

Export interface wasm:cv/request


Types

type mat

mat

Functions

process: func

Params
Return values