@@ -20,6 +20,44 @@ getscalar(A::AbstractArray{T,N}, i::CartesianIndex{N}, block_length::CartesianIn
20
20
21
21
getscalar (a:: Real , i... ) = a
22
22
23
+ """
24
+ seg_img = fast_scanning(img, threshold, [diff_fn])
25
+
26
+ Segments the N-D image using a fast scanning algorithm and returns a
27
+ [`SegmentedImage`](@ref) containing information about the segments.
28
+
29
+ # Arguments:
30
+ * `img` : N-D image to be segmented (arbitrary axes are allowed)
31
+ * `threshold` : Upper bound of the difference measure (δ) for considering
32
+ pixel into same segment; an `AbstractArray` can be passed
33
+ having same number of dimensions as that of `img` for adaptive
34
+ thresholding
35
+ * `diff_fn` : (Optional) Function that returns a difference measure (δ)
36
+ between the mean color of a region and color of a point
37
+
38
+ # Examples:
39
+
40
+ ```jldoctest; setup = :(using ImageCore, ImageMorphology, ImageSegmentation)
41
+ julia> img = zeros(Float64, (3,3));
42
+
43
+ julia> img[2,:] .= 0.5;
44
+
45
+ julia> img[:,2] .= 0.6;
46
+
47
+ julia> seg = fast_scanning(img, 0.2);
48
+
49
+ julia> labels_map(seg)
50
+ 3×3 $(Matrix{Int}) :
51
+ 1 4 5
52
+ 4 4 4
53
+ 3 4 6
54
+ ```
55
+
56
+ # Citation:
57
+
58
+ Jian-Jiun Ding, Cheng-Jin Kuo, Wen-Chih Hong,
59
+ "An efficient image segmentation technique by fast scanning and adaptive merging"
60
+ """
23
61
fast_scanning (img:: AbstractArray{CT,N} , block:: NTuple{N,Int} = ntuple (i-> 4 ,Val (N))) where {CT<: ImageCore.NumberLike ,N} =
24
62
fast_scanning (img, adaptive_thres (img, block))
25
63
0 commit comments