Live tuning of image processing algorithms
Project description
IMAGETUNE
imagetune is a simple GUI to interactively tune image-processing parameters.
Here is a simple script to make a binary version of an image:
from skimage.filters import gaussian
from skimage import data
def threshold(im, thres_val):
return im > thres_val
def preprocessing(im):
bg = gaussian(im, 10)
fg = im - bg
segmented = threshold(fg, 0.1)
return segmented
im = data.coins()
result = preprocessing(im)
The script depends on parameters, sigma=10 for Gaussian filtering and thres_val=0.1 for the thresholding.
In order to tune these live, simply wrap those functions in tune:
from skimage.filters import gaussian
from skimage import data
+from imagetune import tune, tuneui
def threshold(im, thres_val):
return im > thres_val
def preprocessing(im):
- bg = gaussian(im, 10)
+ bg = tune(gaussian)(im, 10)
fg = im - bg
- segmented = threshold(fg, 0.1)
+ segmented = tune(threshold)(fg, 0.1)
return segmented
im = data.coins()
+tuneui(preprocessing, im)
This launches a small window in which the parameters are tunable live:
You can also decorate your functions instead
+@tune
def threshold(im, thres_val):
return im > thres_val
Note that the function still works as normal:
output = preprocessing(im)
Only when you run tuneui(preprocessing, im) does it behave differently.
Installation
Install directly with pip:
pip install imagetune
Function requirements
All tunable functions are asssumed to take an image as its input and return an image as its output.
Choosing parameters
Given a function:
def adjust(im, alpha, gamma):
return alpha * im**gamma
The decorator tune will per standard assume you wish to tune the first parameter (alpha).
You can change this by specifying argnames:
tune(adjust, argnames='gamma')
or argnums:
tune(adjust, argnums=2)
The behavior of the above is identical. You can also tune both parameters, by either
tune(adjust, argnames=('alpha', 'gamma'))
or
tune(adjust, argnums=(1, 2))
Misc
To overwrite function names in the UI, simply pass along a name:
bg = tune(gaussian, name='blur')(im, 10)
You can also choose a min, max of the parameter bar:
bg = tune(gaussian, min=0, max=300)(im, 10)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imagetune-0.1.0a0.tar.gz.
File metadata
- Download URL: imagetune-0.1.0a0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4945e73388ea4a0e52977add3aa9ffca9689de6c9615404ed3c13fee4f29f64
|
|
| MD5 |
51c1f2cdc1702e92c42d42ba25f2b85c
|
|
| BLAKE2b-256 |
1e100f92ef04546e83ae482bb70e6d4076b75bacf908865d242b5cc680d5b3bc
|
Provenance
The following attestation bundles were made for imagetune-0.1.0a0.tar.gz:
Publisher:
publish.yml on juliusbierk/imagetune
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imagetune-0.1.0a0.tar.gz -
Subject digest:
a4945e73388ea4a0e52977add3aa9ffca9689de6c9615404ed3c13fee4f29f64 - Sigstore transparency entry: 499891974
- Sigstore integration time:
-
Permalink:
juliusbierk/imagetune@814f1af405fe98258bd53b6444169f7c15720fd8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/juliusbierk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@814f1af405fe98258bd53b6444169f7c15720fd8 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file imagetune-0.1.0a0-py3-none-any.whl.
File metadata
- Download URL: imagetune-0.1.0a0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64ee5b384ac5d4f84f4c77fba6e5829bebeaea1dbb6b681cbdf9bf4c731f939d
|
|
| MD5 |
f94048bea3b11e252edcd7a8d4c7a89c
|
|
| BLAKE2b-256 |
850161a1201413f583a1474d949f36cc1971318ec87f7076242f6c546bbb1d16
|
Provenance
The following attestation bundles were made for imagetune-0.1.0a0-py3-none-any.whl:
Publisher:
publish.yml on juliusbierk/imagetune
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imagetune-0.1.0a0-py3-none-any.whl -
Subject digest:
64ee5b384ac5d4f84f4c77fba6e5829bebeaea1dbb6b681cbdf9bf4c731f939d - Sigstore transparency entry: 499891999
- Sigstore integration time:
-
Permalink:
juliusbierk/imagetune@814f1af405fe98258bd53b6444169f7c15720fd8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/juliusbierk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@814f1af405fe98258bd53b6444169f7c15720fd8 -
Trigger Event:
workflow_dispatch
-
Statement type: