Skip to content
This repository was archived by the owner on Nov 22, 2026. It is now read-only.

mojo-cv v0.1.2

Choose a tag to compare

@amarbarosys amarbarosys released this 04 Nov 14:37
· 19 commits to main since this release

mojo-cv v0.1.2

Released: 2026-11-04 · Commit: 935554f · Previous: v0.1.1

What it does

OpenCV-style computer vision in Mojo on the CPU, with 3D, CAD and calibration helpers. Each op is checked against cv2 5.0 (2D) or a numpy, brute-force or closed-form oracle (3D) on the same input. A library (from mojocv.imgproc import ...) and a command-line tool (mojo-cv OP OUT IN... [k=v] on .mcv files).

Highlights

  • StereoSGBM at 1080p with 128 disparities peaks at 1.5 GB instead of 11.7 GB, with the same output byte for byte.
  • cvtColor BGR to RGB no longer writes into the next row for widths 9, 10, 17, 18, 25, 26, ...; the gray and
    YCrCb paths no longer read past the row.
  • Malformed input raises an error instead of crashing: a .mcv header larger than its data, a short file, glb
    accessors out of bounds, and mismatched arguments to remap, blobFromImage, HOGScores, Farneback flow, bfmatch and
    knnmatch.
  • The package precompiles (mojo precompile src/mojocv), so the conda recipe builds; it builds on Mojo 1.3
    nightly too.

Changes

Added

  • recipe.yaml (conda package mojo-cv), docs/design.md.

Changed

  • StereoSGBM keeps one uint16 cost volume and rolling path rows; blockSize above 16 now raises.
  • The 3D command-line entry moves to tools/cli3d.mojo (mojo build -I src tools/cli3d.mojo).

Fixed

  • cvtColor SIMD blocks stay inside their row (bgr2rgb, bgr2gray, rgb2gray, YCrCb).
  • Mat.load checks the header size against the file before it allocates; a short .mcv file or a missing argument
    raises instead of aborting.
  • Rng.sample raises when n < k instead of looping forever.
  • threshold saturates maxval to the dtype's range.
  • ransac_iters returns the cap when the inlier share vanishes (it returned a large negative number).
  • remap, blobFromImage, HOGScores, calcOpticalFlowFarneback, bfmatch and knnmatch check their
    inputs' shapes and raise on a mismatch.
  • glb accessor bounds cannot wrap.
  • Builds on Mojo 1.3.0.dev2026110305 as well as 1.2.0.

Verified

Check Result
ci-local: the GitHub workflow in a clean Ubuntu 24.04 container, Mojo 1.2.0, MAX 26.7.0 PASS

Known limits

  • StereoSGBM accepts blockSize up to 16.
  • As in v0.1.0 otherwise.

Upgrade / run

uv sync
mojo build -I src tools/cli3d.mojo -o cli3d   # was: the entry inside src/mojocv/cli3d.mojo

Commits

  • 935554f fix(release): pyproject.toml, recipe.yaml, uv.lock say 0.1.2
  • bda27c7 docs: design.md, recipe.yaml, oracle packages in the dev group
  • ea82689 fix(cv): main() moves out of the package into tools/cli3d.mojo
  • f4722f9 ci(cv): run tests/ransac_iters.mojo in the gate
  • 40d097d fix(cv): ransac_iters uses log1p so a vanishing inlier share gives the cap
  • 412b7b9 fix(cv): threshold saturates maxval to the dtype range
  • 1ae86ef fix(cv): bfmatch and knnmatch raise on descriptors of different width
  • 9c59fe3 fix(cv): calcOpticalFlowFarneback checks the frames' shape and channels
  • eacc957 fix(cv): HOGScores raises unless the svm holds 3781 floats
  • 855aff2 fix(cv): blobFromImage raises when mean has fewer values than channels
  • 1b7847f fix(cv): remap raises when the two maps differ in shape
  • ffeffd6 build: mojo-upgrade gives src/main.mojo 240 s
  • 191ce15 fix: build on Mojo 1.3 nightly
  • 3fe3034 perf(cv): StereoSGBM peak RSS 11.7 GB -> 1.5 GB at 1080p/128, output unchanged
  • ba088fc ci(cv): run tools/malformed_check.py in the gate
  • 4c2c81d chore(cv): delete polar_rotation, Js.count and a redundant clause; version 0.1.1
  • 4d1017e fix(cv): glb accessor bounds cannot wrap
  • f52b18e fix(cv): Rng.sample raises when n < k instead of looping forever
  • 24f635c fix(cv): a short .mcv file or a missing input argument raises instead of aborting
  • 1147350 fix(cv): Mat.load checks the header size before it allocates
  • 9e24054 fix(cv): cvtColor SIMD blocks stay inside their row
  • 514e610 docs: CI, latest-release and license badges