MCPcopy Create free account
hub / github.com/XadillaX/byakuren

github.com/XadillaX/byakuren @v1.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.1 ↗ · + Follow
2,278 symbols 4,290 edges 108 files 429 documented · 19% updated 21mo agov1.0.1 · 2024-10-22★ 173

Browse by type

Functions 2,062 Types & classes 216
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Byakuren

Byakuren is a C library for extracting theme colors from images.

This library has been used in production by a related company for years.

TODO: Implement KD-Tree for color finding.

聖 白蓮

聖 白蓮

聖 白蓮(ひじり びゃくれん,Hiziri Byakuren)是系列作品《东方project》中的角色,首次登场于《东方星莲船》。

  • 种族:魔法使
  • 能力:使用魔法程度的能力(酣畅增强身体能力的)
  • 危险度:不明
  • 人类友好度:中
  • 主要活动场所:命莲寺之类

命莲寺的住持。虽然原本是人类,不过由于常年的修行已经完全超越了人类。现在已经属于人们常说的魔法使了。

虽然已经入了佛门,但是不知道什么原因却被妖怪敬仰着。她从来没有像童话故事中的魔法使那样,念诵着咒语治退妖怪。使用的力量完全是邪恶的,一点都不像是圣人,虽然并没有人目击到她与人类为敌,但其实已彻底成为妖怪的同伴了。

Features

  • Supports multiple color extraction algorithms:
  • Octree algorithm
  • Min-diff algorithm
  • Mix-in algorithm (combining Octree and Min-diff)
  • Provides a simple C API
  • Can be compiled into a static library for easy integration

Installation

Clone the repository with submodules:

git clone --recurse-submodules https://github.com/XadillaX/byakuren.git

Compile the static library:

make byakuren

After compilation, include byakuren.h in your project to use the library:

#include "byakuren.h"

Usage

  1. Initialize the Byakuren environment:
int result = bkr_init();
  1. Use one of the color extraction algorithms:
  2. Octree Algorithm
  3. Min-diff Algorithm
  4. Mix Algorithm

  5. Release the environment when done:

bkr_destroy();

For detailed API usage, refer to the API Documentation section below.

Testing

Compile the test binary:

make ./test/bkr_test

Run the test with a specific algorithm:

cd test && ./bkr_test ALGORITHM

Replace ALGORITHM with octree, mindiff, or mix.

Test Helper

A Node.js-based test helper is available for quick testing without generating .rgb files manually.

  1. Install dependencies:
npm install
  1. Run the helper:
./test/run.js -u IMAGE_URL -a ALGORITHM

For example:

./test/run.js -u http://example.com/image.jpg -a octree

Use -a all to test all three algorithms at once.

APIs

Here's a brief overview of the main APIs provided by Byakuren. For detailed parameter descriptions and usage, please refer to the full API documentation in the header files.

Initialization & Cleanup

int bkr_init();
void bkr_destroy();

Octree Algorithm

bkr_octree_node* bkr_build_octree(bkr_rgb* pixels, uint32_t pixel_count, uint32_t max_colors);
int bkr_octree_calculate_color_stats(bkr_octree_node* node, bkr_color_stats stats[]);
void bkr_release_octree(bkr_octree_node* node);

Min-diff Algorithm

int bkr_mindiff_calculate_color_stats(bkr_rgb* pixels, uint32_t pixel_count, bkr_color_stats stats[], bkr_mindiff_parameter* param);

Mix Algorithm

int bkr_mix_calculate_color_stats(bkr_rgb* pixels, uint32_t pixel_count, uint32_t octree_max_colors, bkr_mindiff_parameter* mindiff_param, bkr_color_stats stats[]);

For full API documentation, including detailed descriptions of parameters and return values, please refer to the following header files:

  • bkr_common.h: Common structures and definitions
  • lib/octree.h: Octree algorithm functions
  • lib/mindiff.h: Min-diff algorithm functions
  • lib/mix.h: Mix algorithm functions

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

「雖然我覺得不怎麼可能有人會關注我」

Core symbols most depended-on inside this repo

Shape

Method 1,569
Function 493
Class 206
Enum 10

Languages

C++67%
Python22%
TypeScript8%
C4%

Modules by API surface

tools/cpplint/samples/protobuf-sample/src/descriptor.pb.cc553 symbols
tools/cpplint/samples/protobuf-sample/src/descriptor.pb.h534 symbols
tools/cpplint/cpplint_unittest.py270 symbols
tools/cpplint/cpplint.py190 symbols
docs/html/jquery.js123 symbols
tools/cpplint/samples/protobuf-sample/src/descriptor_unittest.cc102 symbols
tools/cpplint/samples/chromium-sample/src/io_thread.cc81 symbols
tools/cpplint/samples/chromium-sample/src/chrome_content_renderer_client.cc57 symbols
tools/cpplint/samples/v8-sample/src/interface-descriptors.h55 symbols
tools/cpplint/samples/vlc-sample/src/missing.c52 symbols
tools/cpplint/samples/chromium-sample/src/io_thread.h41 symbols
tools/cpplint/cpplint_clitest.py29 symbols

For agents

$ claude mcp add byakuren \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page