Skip to main content

Classical CV-based image leveling and thumbnail generator.

Project description

PlumbKing 👑 — Classical CV Image Leveling & Thumbnails

king

PlumbKing is a lightweight, classical-CV horizon leveling and thumbnail generator. It processes photo batches using a purely deterministic pipeline:

  • Multi-scale K-Means segmentation
  • Canny edge extraction
  • Probabilistic Hough transform
  • Weighted roll voting
  • Optional RANSAC horizon correction

No ML models, no cloud calls — just fast, transparent image geometry.


✨ Features

  • 📐 Automatic roll leveling (multi-scale classical CV)
  • 🔍 Preview mode with confirmation before replacing originals
  • 🧭 EXIF-aware rotation correction
  • 🖼️ Structured thumbnail generation
  • 🛠️ Debug output for each stage (--debug-dir)
  • 🐧 Works on Linux, macOS, WSL

🚀 Installation

pip install plumbking

📦 Basic Usage

Level and thumbnail all images in a directory:

plumbking --directory /path/to/images

Dry-run (no writes):

plumbking --directory /path/to/images --dry-run

Enable full CV debug logging:

plumbking --directory /photos --debug-dir /tmp/pk-debug

This creates per-image folders containing:

  • segmentation maps
  • Canny edge maps
  • Hough overlays
  • RANSAC boundary maps
  • intermediate resized crops

🔧 Workflow Summary

  1. Scan the directory

  2. Detect leveling candidates

  3. Generate preview leveled images under _leveled_preview/

  4. Prompt for approval

    • Yes → originals replaced by leveled versions
    • No → preview removed, originals kept
  5. Generate missing thumbnails


⚙️ Environment Variables

Variable Default Meaning
THUMB_MAX_SIZE 720 Max width/height of thumbnails
LEVELED_PREVIEW_DIR _leveled_preview Directory used for preview leveling
LEVEL_ANALYSIS_SIZE 720 Downscale used during leveling analysis
LEVEL_DEBUG_DIR (unset) Optional global debug directory (overridden by --debug-dir)

📝 Notes

  • Works best for horizon-bearing photos, architecture, landscapes
  • Deterministic classical CV — great for reproducible pipelines
  • Safe to rerun; naming conventions prevent double-processing
  • Designed for large photo collections and batch workflows

One hand for the ship, one hand for the soul. Built aboard Moonshot.

     :=.:***.       .    .*   ==:            .*.                 ....          ...               
     .=.  :         =    .+   =-:            .*.                       ..        .               
     .=.   -        .=    :.  ==:....        .*.                                                 
     .+:   ..        *   .:.= -=:.           .*.                                                 
  .*+:+:    +     --:=+:=***-.:+-:           .*................     . ..  .   ...                
      ++=+:..+.==*+*+-#*++**=****.           .*.                                                 
-::..:-=++*********+*%%##%##:#**+             *:                                                 
::.......:.::.. .:-=+%@*. .+  =-:.           .*-                                       ..        
   -**=#*#*:::....   .  .  -.:+-+-:*****+*++=:=-                                                 
               . .===##-::.........      .    .+                       ......                    
         ..                   .:+-. =-:..... :+#+                                 ......:-=+****#
         ..                         ..   .  -:%:+..-+*****=*+##*=#%# ##%@@@@@@*@@@%%%#@@@@@@@%@@@
....:......       .             .   :.   . .. . .  .:  ###*#*+**+-#:  :-%%   ::.- .=*: .*#= ..:=*
++**+++++*+**##**##@%%%##*.   +%%%%%%%%%%%%%% :+#*=-+= =+-:++ :%*-=: - ==#.+:+=*#-=+:=**%@%@%#**%
==*+*##*+*+*+++++**#%%%#-+:   =##%%%%%%%@%%**:++-==:-...   ..... :+     -%##**:*#*#=:*#+++++++*%%
##+%%%@#@@*@@@@. @@%#+@=%*+@%-##%@%-=*@@#+*%--++*#       *##***=    +%* #%%%@%-@@%%+*+%+*+=+#+%@%
%%#@@%@%*@*@@@@+-%@%#*@%*  @%-%%#@%%:+@@%*#%#####       +*#####+     %* #%@@@#:@@@%##*#.:-:::..-%
#*+#@@@@:@-@@@@@ #@%#-@%+  @@+*- @@%+*@@%-#-                       - =-  *%%%#:%%+=***-*******##%
%+-@@%@@+@+%@%@@#+@.#+@@*  =@*#..@@+=*@%@##@%@%%%%%#%%%#*##*##**+*++ -  -+*#%#=%%--.+-*+++***++=+
.  +@@@@%@@#%%@@@=%..=@@+. .@++#=@@***@@@#*%%%%**#%%%%%###%#####+*+= .   **#**-*#.+==**********=*
.  .@@@@@@@@%%@@@+@-.+@@#*::@*##:+-%%%@@@+#%%##*%%%%%%*=#*+-:+#*=-.     -*#++*.####*-############
.   %@@@@@@@@%@@#-@*-%@@#+:.@+-+-=#***+.                                * ...... .=*=############
+:.-%@@@@+@#@*@@+:%*-%@@++.-@*-#-=@      =**+++++++++.   -.            =          .#*############
-...+@@@@+@##:@@#.#%-%*@=#: @+:-.     =*****+=--. -                   #=.........  =++***********
:.  :@@@@@@##-@@+:#%+#+@=%**@.                                       ==....        .-:::::::----=
*:  .@@@@@@@#+%@#:*%++%%+:+*         .=-++                          :*............ ..::..........
#=   @@@@@@@#+#@@%%#-:%%%= .      .                                .: ... ....      .:::::::::..:
@=   #%%@@@@@%%@@%*=+: -       **=.                        .      ::............    .-------:::::
%+=. *%%%%%%%%%%%%%@%##       .--.                     ..        +*-..................===----::--
%**: *%%%%%%%%#%%%%%=  #     :                    :-:         -==##...... ............=====------
%#+--+%%%%%%%%#%%%%@%% =. -:               .-==--:          -=+-:*................. ..:=====-----
@%=.-*%%%%%%%%%%%@@@@*  .        ..-=====---:.          .**+=-     ....................=----::::-
%%***#%%%%%%%%%@@@@# ::     **++==-=====-           +%##+.        -   ............... .--::-:::::
%%###*%%%%%%%@@@@@*      =*%%@@#+++=-.        .=#%%#-    :     =  .................... .    :.   
%%###*#%%%%%@@@@@@@##** .:@@%@@@@+.     .:.:*%%#.       .++=     ...................  ..    :... 
####**#%%%%%@@@@@@@@@%%@@@@@%@@@@@@-   -*#*-            -+-.     .................... ...   ..=. 
####**#%%@@@@@@@@@@@@%@@@@@##@@@@@%%#*-           -+=   : +. :   ....................:  -=- .:++ 
####*##%%%%@@@@@@@@@@@@@@%%%%%%%%+.            =****: . =-=  -:  .....................  ... .=++ 
##%##*##%%@@@@@@@%%%%%%%%%%%#:               =*#*#.     -+:  .= .*%##**:............ .  :...  ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plumbking-0.1.1.tar.gz (37.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plumbking-0.1.1-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

Details for the file plumbking-0.1.1.tar.gz.

File metadata

  • Download URL: plumbking-0.1.1.tar.gz
  • Upload date:
  • Size: 37.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for plumbking-0.1.1.tar.gz
Algorithm Hash digest
SHA256 085cebb5551eab4937bdc650b213c091a50bbfddbefeeff7102ee7c9ca88fb89
MD5 fd2484708b1ffa17cc23841d62468c55
BLAKE2b-256 2682f0ecaede154421c8bbde4e8d9d7a290ecb659dc8a1787d066063bf6e2f6c

See more details on using hashes here.

File details

Details for the file plumbking-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: plumbking-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 33.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for plumbking-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35a22dd378fbfde57478776ef76bb0e11715a82133cdc3dcf337016777ca2313
MD5 dc9c924dd7739915c0d567827d58a14a
BLAKE2b-256 fa5fd257aee95564a121ac0fb1137b13173b4b9163699695a69ee5bfbe6e6e52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page