Skip to content

Commit b9cc3b0

Browse files
authored
add a kward to gui() for the default color threshold (#13)
1 parent 07f7c42 commit b9cc3b0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/gui.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function gui(
2525
whichbutton = Ref{Symbol}(), # used for testing
2626
preclick::Union{Int,Nothing} = nothing, # used for testing
2727
background_path = nothing, # used to correct for non-uniform illumination (see joinpath(pkgdir(@__MODULE__),"docs","src","assets","blurred_calibration.png"))
28+
default_threshold = 0.2, # default color similarity threshold used for segmentation
2829
crop_top::Int = 0, # crop this many pixels off of each side
2930
crop_bottom::Int = 0,
3031
crop_left::Int = 0,
@@ -42,7 +43,7 @@ function gui(
4243
bkgimg = isnothing(background_path) ? nothing : Float32.(Gray.(load(background_path)[crop_top+1:end-crop_bottom, crop_left+1:end-crop_right]))
4344
bkgmean = isnothing(bkgimg) ? nothing : Float32(mean(bkgimg))
4445
seg = nothing
45-
threshold = 0.15
46+
threshold = default_threshold
4647
labels2idx = Dict{Int,Int}()
4748
idx2labels = Dict{Int,Int}()
4849
# Set up basic properties of the window

src/segment.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Larger `threshold` values will result in fewer segments.
88
"""
99
function segment_image(
1010
img::AbstractMatrix{<:Color};
11-
threshold::Real = 0.15, # threshold for color similarity in region growing
11+
threshold::Real = 0.2, # threshold for color similarity in region growing
1212
prune::Bool = true, # prune small segments
1313
min_size::Int = 500, # minimum size of segments to keep
1414
)

0 commit comments

Comments
 (0)