v1.0
Focused on the first complete visual-analysis chain: image containers, thresholding, filtering, Sobel edges, binary morphology, connected components, and export.
v1.1
Focused on robustness improvements: Otsu thresholding, adaptive thresholding, median blur, and gray-image transforms.
v1.2
Focuses on edge and contour analysis: Canny edges, contour extraction, contour statistics, and upgraded edge/counting demos.
v1.0 vs v1.1 vs v1.2
The bundled demo assets are kept stable so v1.0, v1.1, and v1.2 remain directly comparable.
Object counting:
v1.0 used threshold(120) and detected 5 objects on the bundled asset.
v1.1 uses median_blur(radius=1) -> otsu_threshold and also detects 5 objects, while removing the fixed threshold constant from the counting path.
v1.2 keeps the v1.1 binary path and adds contour extraction plus a rendered contour mask for the same binary image.
Edge detection:
v1.1 exported the Sobel gradient magnitude edge map.
v1.2 keeps that output and adds a binary Canny edge map for direct comparison.
Document enhancement:
v1.0 used a fixed threshold after brightness and contrast adjustment.
v1.1 preserves the v1.0 output in document_enhancement_output_v1_0.png and writes the optimized median_blur -> adaptive_threshold_mean result to document_enhancement_output.png.
Testing Scope
Current tests cover:
image container invariants
gray-image geometric transforms
PNG decode adaptation to RgbImage
grayscale, global thresholding, Otsu thresholding, and adaptive thresholding
filtering, border handling, and median blur behavior
Sobel and Canny edge behavior
binary morphology behavior
connected components, contour extraction, and contour statistics
SVG/HTML export rendering
PNG signature generation
Notes
The project intentionally focuses on the algorithm layer. It does not provide GUI features, video processing, OpenCV bindings, or machine learning integration.
PNG decode and export are implemented locally from vendored subsets adapted from mizchi/image and mizchi/zlib, because the current upstream registry dependency graph is not compatible with the local MoonBit toolchain used for this repository.
License
MoonVision is released under the MIT license. See LICENSE for the full text.
MoonVision
MoonVision is a MoonBit-native lightweight image processing and basic computer vision library.
The current
v1.2line focuses on:GrayImage,RgbImageRgbImagethrough a vendored adapter layerModule Layout
Quick Start
Check the project:
Run tests:
At the time of writing, the repository test suite passes on the repository default target.
Basic Usage
Export a grayscale image as PNG bytes:
Build an SVG overlay for detected components:
Decode a PNG file into
RgbImagebytes first:Demos
Demo input assets live in
examples/assets/.All demo outputs are written to
examples/output/.Object counting:
Outputs:
examples/output/object_counting_input.pngexamples/output/object_counting_binary_v1_0.pngexamples/output/object_counting_binary.pngexamples/output/object_counting_contours.pngexamples/output/object_counting_overlay.svgexamples/output/object_counting_report.htmlEdge detection:
Outputs:
examples/output/edge_detection_input.pngexamples/output/edge_detection_edges.pngexamples/output/edge_detection_canny.pngexamples/output/edge_detection_report.htmlDocument enhancement:
Outputs:
examples/output/document_enhancement_input.pngexamples/output/document_enhancement_output_v1_0.pngexamples/output/document_enhancement_output.pngexamples/output/document_enhancement_report.htmlVersion Stages
v1.0Focused on the first complete visual-analysis chain: image containers, thresholding, filtering, Sobel edges, binary morphology, connected components, and export.v1.1Focused on robustness improvements: Otsu thresholding, adaptive thresholding, median blur, and gray-image transforms.v1.2Focuses on edge and contour analysis: Canny edges, contour extraction, contour statistics, and upgraded edge/counting demos.v1.0 vs v1.1 vs v1.2
The bundled demo assets are kept stable so
v1.0,v1.1, andv1.2remain directly comparable.v1.0usedthreshold(120)and detected5objects on the bundled asset.v1.1usesmedian_blur(radius=1) -> otsu_thresholdand also detects5objects, while removing the fixed threshold constant from the counting path.v1.2keeps thev1.1binary path and adds contour extraction plus a rendered contour mask for the same binary image.v1.1exported the Sobel gradient magnitude edge map.v1.2keeps that output and adds a binaryCannyedge map for direct comparison.v1.0used a fixed threshold after brightness and contrast adjustment.v1.1preserves thev1.0output indocument_enhancement_output_v1_0.pngand writes the optimizedmedian_blur -> adaptive_threshold_meanresult todocument_enhancement_output.png.Testing Scope
Current tests cover:
RgbImageNotes
mizchi/imageandmizchi/zlib, because the current upstream registry dependency graph is not compatible with the local MoonBit toolchain used for this repository.License
MoonVision is released under the
MITlicense. See LICENSE for the full text.