Small toolkit to debayer and stack images.
Project description
Debayer Ohweier
Small toolkit to debayer and stack images.
How to capture images
Use the setting (Bayer) for taking the images.
Example
from debayer_ohweier import debayer,get_gradient_stack,get_argmax, zstack,save_image,save_plot
import matplotlib.pyplot as plt
import numpy as np
import os
import glob
path='sample data' #Path to the tif-files from Microscope
im_paths=sorted(glob.glob(os.path.join(path,'*.tif')))
# load and debayer all files
ims=[]
for p in im_paths:
im=debayer(path=p)
ims.append(im)
dirname,filename=os.path.split(p)
save_image(im,os.path.join(dirname,'debayered',filename))
print('debayered')
# calc the gradient of all images. the gradient is highest for sharb edges in the image, hence, areas in Focus
a_grad_stack,a_grad_b_stack=get_gradient_stack(ims)
print('gradient')
# chose the image with the higest gradient per location to get height information
a_max_b=get_argmax(a_grad_b_stack)
a_max=get_argmax(a_grad_stack)
save_image(a_max,os.path.join(path,'stack','height.tif'))
save_plot(a_max,os.path.join(path,'stack','height.pdf'),pixelsize=800/60,s_unit='$\mu m$')
save_plot(a_max,os.path.join(path,'stack','height.svg'),pixelsize=800/60,s_unit='$\mu m$')
save_plot(a_max,os.path.join(path,'stack','height.png'),pixelsize=800/60,s_unit='$\mu m$')
print('argmax')
# Stack debayered images acording to height information
a_neu=zstack(ims,a_max_b,blur=True, blursize=30)
save_image(a_neu,os.path.join(path,'stack','stack.tif'))
save_image(a_neu,os.path.join(path,'stack','stack.jpg'))
print('zstack')
Developer: Jan Paschen
jan.paschen@ise.fraunhofer.de
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
debayer_ohweier-0.0.1.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for debayer_ohweier-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1d6c0a2c36c5d6f554b980734cd6a53deef2051d9401a3826beaa8b5013dab4 |
|
MD5 | efddaedadaeccb3c8bb33b9d8bb0dce0 |
|
BLAKE2b-256 | bc8f10d38b8bd007aade648a4a407f6b1647457ae0f55d06491e9b5930dcd580 |