Skip to content

subvision-soft/subvision-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Subvision Core

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.


πŸš€ Features

  • 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

πŸ“ Repository Structure

β”œβ”€β”€ 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)

βš™οΈ Prerequisites

For WebAssembly Build:

  • Docker
  • Internet access to pull the image ghcr.io/subvision-soft/subvision-emscripten:2025.6.1

For .NET Build:

  • 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+

🐳 Docker Image

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

πŸ”¨ How to Build

WebAssembly Build

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_es6

The output will be located in the build_wasm/ directory.

.NET Build (Windows)

# 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 Release

The output will be:

  • build-dotnet-x64\bin\x64\SubvisionNET-x64.dll (64-bit)
  • build-dotnet-x86\bin\x86\SubvisionNET-x86.dll (32-bit)

Native C++ Build

# Build native library and tests
mkdir build
cd build
cmake ..
cmake --build . --config Release

# Run tests
cd test
./subvision_tests

πŸ“¦ Output Files

WebAssembly

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

.NET

File Description
SubvisionNET-x64.dll .NET assembly for 64-bit applications
SubvisionNET-x86.dll .NET assembly for 32-bit applications

πŸ’» Usage Examples

JavaScript (WebAssembly)

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);

C# (.NET)

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);

πŸ› οΈ Build Targets

Makefile (WebAssembly)

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

CMake Options

Option Description Default
BUILD_TESTS Build unit tests ON
BUILD_CLI_WRAPPER Build C++/CLI .NET wrapper OFF
EMSCRIPTEN Build for WebAssembly OFF

πŸ“„ License

MIT License – see LICENSE for details.

Packages

No packages published

Contributors 2

  •  
  •