Skip to main content

Uma lib python que oferece uma serie de ferramentas para o processamento de imagem

Project description

pictokit

Introduction

pictokit is a Python library designed to perform image processing and transformations.
It serves as a foundation for applying different methods commonly studied in Image Processing courses, while also being flexible enough to be extended for research and development.


Installation

pictokit requires Python >= 3.10.

You can install it directly from PyPI:

pip install pictokit

Features

  • Basic image loading and visualization
  • Histogram analysis and equalization
  • Contrast expansion
  • [More features will be added and documented here in future versions]

How it Works

The library provides modular functions that can be combined to build image transformation pipelines.
It is meant to be lightweight and educational, focusing on clarity and usability.
Detailed usage examples will be provided in the official documentation.

Basic image loading and visualization

Images can be loaded directly from disk or from memory arrays and displayed using standard Python visualization tools. This provides a straightforward way to inspect input data before applying transformations.

from pictokit import Image

# Load image from file
img = Image(path="examples/image.png")

# Display the original image
print(img)

Image Display Example

Histogram analysis and equalization

Functions are available to compute and plot image histograms, giving insights into the distribution of pixel intensities.

from pictokit import Image

img = Image(path="examples/image.png")

# Plot histogram of the original image
img.histogram()

Plot Histogram Example

Contrast Expansion

Contrast enhancement can be achieved through expansion techniques, where pixel intensity values are stretched to span a wider range (0–255).
This adjustment improves the visibility of details that might otherwise be hidden in very dark or very bright regions of the image.

The transformation is defined by the following formula:

$$ f(D) = \frac{255}{H - L}(D - L) $$

Where:

  • D → the original pixel value
  • L → the lowest pixel intensity in the image (minimum gray level)
  • H → the highest pixel intensity in the image (maximum gray level)
  • f(D) → the new pixel value, rescaled to the 0–255 range
from pictokit import Image

img = Image(path="examples/image.png")

# Apply contrast expansion with low and high limits and show histogram
img.contrast_expansion(low_limit=50, high_limit=250, hist=True)

# Show original and transformed images side by side
img.compare_images()

Example result of contrast expansion:

Contrast Expansion Example

Thresholding

Thresholding is a point operation used to segment an image into regions based on intensity.
Pixels with values below a given threshold are set to 0 (black), while pixels equal to or above the threshold are set to a specified intensity value (A) (commonly 255, white).
This technique is widely used in image processing to separate foreground objects from the background.

The transformation is defined by the following formula:

$$ f(D) = A \cdot u(D - T) $$

Where:

  • D → the original pixel value
  • T → the threshold value
  • A → the intensity value assigned when the condition is satisfied (usually 255)
  • u(x) → the unit step function, which is 0 if (x < 0) and 1 if (x \geq 0)
  • f(D) → the new pixel value (either 0 or (A))
from pictokit import Image

img = Image(path="examples/image.png")

# Apply thresholding with threshold T and intensity A
img.thresholding(A=1, T=150, hist=True)

# Show original and transformed images side by side
img.compare_images()

Example result of contrast expansion:

Thresholding Example

Academic Motivation

This project was created in the context of Image Processing courses, to consolidate theoretical knowledge through practical implementations.
It aims to provide both a learning resource for students and a useful toolkit for developers who want to explore image transformations.


Notes

If you want to contribute, please check the CONTRIBUTING.md file.
Suggestions, bug reports, and improvements are always welcome.

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

pictokit-0.2.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

pictokit-0.2.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file pictokit-0.2.0.tar.gz.

File metadata

  • Download URL: pictokit-0.2.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.13 Linux/6.11.0-1018-azure

File hashes

Hashes for pictokit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7e31e034d29168fd58a1fd51163a818a09e2f28c62d2268d46fa6a04a3bc5ef6
MD5 1e980c2a38665c6f0021fec36de69f46
BLAKE2b-256 af9b55939c94159cb9e0a4cd257be6c5769aae45c57fe7dee5e79a02ca2bad3e

See more details on using hashes here.

File details

Details for the file pictokit-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pictokit-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.13 Linux/6.11.0-1018-azure

File hashes

Hashes for pictokit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3420e47124126a50f9e7451522629cf4bddc136c7032513179321da45a627ad9
MD5 aaba6ea9bcec6ca44f14b99758b6eb05
BLAKE2b-256 e4d27b6f1f88052b6ebb460cea6912c51f2da499c4b973576dcb7f4958e63336

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