fluorescence

Crates.iofluorescence
lib.rsfluorescence
version0.1.1
created_at2025-03-11 07:31:53.809389+00
updated_at2025-03-11 07:36:10.674984+00
description✨ Fluorescence - A library for dominant color extraction and fuzzy graphics processing.
homepage
repositoryhttps://github.com/hanbings/fluorescence
max_upload_size
id1587651
size19,777
hanbings (hanbings)

documentation

README

🌟 Fluorescence

🦀 Rust | 🥮 Moonbit

An image library for color, blur, transformation, and feature extraction.

Image

This section is only provided for moonbit. There is no cake in moonbit that can load and parse images.

It is expected to support popular formats such as bmp, jpeg, png, etc.

Blur

Color

Kmeans

🦀 Rust

After installing this crates, We need to load the image from disk and pass it into a special data structure, which is prepared for no_std environments (such as bare metal environments or WASM).

#[cfg(test)]
mod test {
    use fluorescence::{
        color::{self, PrimanyColor},
        Image, RgbaColor,
    };
    use image::{GenericImageView, ImageReader};

    #[test]
    fn get_primany_colors_with_kmeans() {
        let image_file = "./example/len_std.jpg";
        let img = ImageReader::open(image_file).unwrap().decode().unwrap();

        let pixels: Vec<RgbaColor> = img
            .pixels()
            .map(|pixel| {
                let rgba = pixel.2;
                RgbaColor {
                    r: rgba[0],
                    g: rgba[1],
                    b: rgba[2],
                    a: rgba[3],
                }
            })
            .collect();

        let width = img.width();
        let heigth = img.height();

        let kmeans = color::kmeans::Kmeans::new(
            Image {
                pixels,
                width,
                heigth,
            },
            1,
            100,
            1.0,
        );

        let colors = kmeans.get_primary_colors().unwrap();

        println!("{:?}", colors);
    }
}

🥮 Moonbit

When I found out that moonbit didn't even have a library that could read and parse jpeg or png images, it meant I needed some time to implement parsing images first. :(

Commit count: 7

cargo fmt