Subvision Core is a cross-platform C++ computer vision library powering the Subvision underwater target shooting scoring system.
Subvision is a mobile and web app developed to detect, locate, and score impacts on underwater target shooting sheets. It aims to be validated by the FFESSM (French Underwater Federation) for official competition use.
- C++ core logic for:
- Sheet detection
- Target detection
- Impact localization
- Score computation
- Multiple platform support:
- WebAssembly build for browser usage
- .NET bindings via C++/CLI for Windows applications
- Native C++ library
- Dockerized build environment for consistency
βββ include/ # Header files
βββ src/ # C++ core source files
βββ test/ # Unit tests
βββ web/ # HTML test interface
βββ emscripten_binding.cpp # Emscripten JavaScript bindings
βββ cli_wrapper.cpp # C++/CLI .NET bindings
βββ CMakeLists.txt # CMake build configuration
βββ Makefile # WebAssembly build system
βββ build_wasm/ # WebAssembly output (generated)
- Docker
- Internet access to pull the image
ghcr.io/subvision-soft/subvision-emscripten:2025.6.1
- Windows with Visual Studio 2022
- CMake 3.30.5+
- OpenCV 4.x (installed via chocolatey:
choco install opencv) - .NET Framework 4.7.2+ or .NET 6+
Builds use the ghcr.io/subvision-soft/subvision-emscripten:2025.6.1 Docker image, which is maintained in
the Subvision Stack project.
This image includes:
- Emscripten SDK
- OpenCV with pkg-config
- CMake and other tools required for building C++ and WASM
Run the following commands depending on your target:
# Build both versions (standard + ES6)
make all
# Build the standard WebAssembly version
make subvision
# Build the ES6 module WebAssembly version
make subvision_es6The output will be located in the build_wasm/ directory.
# Build the C++/CLI .NET wrapper for x64
mkdir build-dotnet-x64
cd build-dotnet-x64
cmake -G "Visual Studio 17 2022" -A x64 -DBUILD_CLI_WRAPPER=ON ..
cmake --build . --config Release
# Build for x86 (32-bit)
cd ..
mkdir build-dotnet-x86
cd build-dotnet-x86
cmake -G "Visual Studio 17 2022" -A Win32 -DBUILD_CLI_WRAPPER=ON ..
cmake --build . --config ReleaseThe output will be:
build-dotnet-x64\bin\x64\SubvisionNET-x64.dll(64-bit)build-dotnet-x86\bin\x86\SubvisionNET-x86.dll(32-bit)
# Build native library and tests
mkdir build
cd build
cmake ..
cmake --build . --config Release
# Run tests
cd test
./subvision_tests| File | Description |
|---|---|
| subvision_core.js | WebAssembly wrapper (standard version) |
| subvision_core_es6.js | WebAssembly wrapper using ES6 modules |
| index.html | Test interface for running in browser |
| File | Description |
|---|---|
| SubvisionNET-x64.dll | .NET assembly for 64-bit applications |
| SubvisionNET-x86.dll | .NET assembly for 32-bit applications |
import SubvisionCV from './subvision_core_es6.js';
const module = await SubvisionCV();
// Process target image
const results = module.processTargetImage(width, height, imageData);
console.log('Impacts:', results.impacts);
// Get sheet coordinates
const coords = module.getSheetCoordinates(width, height, imageData);
console.log('Corners:', coords);using SubvisionNET;
// Load image as RGBA byte array
byte[] imageData = LoadImageAsRGBA("target.jpg", out int width, out int height);
// Process target to detect impacts
var results = SubvisionCore.ProcessTargetImage(imageData, width, height);
foreach (var impact in results.Impacts)
{
Console.WriteLine($"Impact: Distance={impact.Distance}, Score={impact.Score}");
}
// Get sheet coordinates
var coords = SubvisionCore.GetSheetCoordinates(imageData, width, height);| Target | Description |
|---|---|
| all | Build both standard and ES6 versions |
| subvision | Build standard WebAssembly version |
| subvision_es6 | Build ES6 module WebAssembly version |
| help | Show help message |
| Option | Description | Default |
|---|---|---|
| BUILD_TESTS | Build unit tests | ON |
| BUILD_CLI_WRAPPER | Build C++/CLI .NET wrapper | OFF |
| EMSCRIPTEN | Build for WebAssembly | OFF |
MIT License β see LICENSE for details.