Preprocessings
Read images
Use the load_gray2float
function to read grayscale hologram images.
ParticleHolography.load_gray2float
— Functionload_gray2float(path)
Load a grayscale image from a file and return it as a Array{Float32, 2} array.
Arguments
path::String
: The path to the image file.
Returns
Array{Float32, 2}
: The image as a Float32 array.
Background removal
Given a list of hologram paths, a background image is generated by the mean or mode of the brightness values at each pixel of the hologram. Lists of holograms can be obtained using the Glob
package. It is preferable if these are time series data that record few objects. It may takes a while to process a large number of holograms. A progress bar is displayed during processing.
using ParticleHolography
using Glob
pathlist = glob("path/to/hologram/*.png")
bkg = make_background(pathlist, mode=:mode)
# Remove the background
img = load_gray2float("path/to/hologram/holo1.png")
img .= img .- bkg .+ 64/255
The mode
argument can be set to :mean
or :mode
. The default is :mode
.
ParticleHolography.make_background
— Functionmake_background(pathlist; mode=:mode)
Make a background image from a list of image paths. The background image is calculated by taking the mean or mode of the images in the list. The default mode is :mode.
Arguments
pathlist::Vector{String}
: A list of image paths.glob()
can be used to generate this list.mode::Symbol
: The mode to use for calculating the background. Options are :mean or :mode. Default is :mode.
Returns
Array{Float64, 2}
: The background image.