multi

command module
v0.0.0-...-276954f Latest Latest
Warning

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

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

README

Multi

The multi example that reads frames from a connected webcam, and processes them using a wasmCV guest module written using either TinyGo, Rust, or C.

The host application is a Go application written using GoCV Go language wrappers for OpenCV and the Wazero WASM runtime.

Compile the TinyGo guest module

$ cd modules/processor
$ tinygo build -o ../processor.wasm -target=wasm-unknown .
$ cd ../..

Compile the Rust guest module

$ cd modules/processrs
$ cargo build --target wasm32-unknown-unknown --release
$ cd ../..
$ cp ./modules/processrs/target/wasm32-unknown-unknown/release/processrs.wasm ./modules/

Compile the C guest module

$ cd modules/processc
$ ./build.sh
$ cd ../..

Run the host application using the TinyGo wasmCV guest module

$ go run . -processor=tinygo
Defining host functions...
Loading tinygo wasmCV guest module...
Start reading device id: 0

It will then capture each frame, display some stats, and them perform a gaussian blur on the source image.

Running tinygo wasmCV module
Read frame 34
Cols: 640 Rows: 480

Run the host application using the Rust wasmCV guest module

$ go run . -processor=rust
Defining host functions...
Loading rust wasmCV guest module...
Start reading device: /dev/video0
Running rust wasmCV module
Read frame 28
Cols: 640 Rows: 480

Run the host application using the C wasmCV guest module

$ go run . -processor=c
Defining host functions...
Loading c wasmCV guest module...
Start reading device: /dev/video0
Running c wasmCV module
Read frame 28
Cols: 640 Rows: 480

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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