@@ -39,7 +39,7 @@ segments = seeded_region_growing(img, seeds)
39
39
# output
40
40
41
41
Segmented Image with:
42
- labels map: 240×360 Array {Int64,2 }
42
+ labels map: 240×360 Matrix {Int64}
43
43
number of labels: 3
44
44
```
45
45
@@ -61,7 +61,7 @@ julia> length(segment_labels(segments))
61
61
3
62
62
63
63
julia> segment_mean(segments)
64
- Dict{Int64,RGB{Float64}} with 3 entries:
64
+ Dict{Int64, RGB{Float64}} with 3 entries:
65
65
2 => RGB{Float64}(0.793598,0.839543,0.932374)
66
66
3 => RGB{Float64}(0.329863,0.35779,0.237457)
67
67
1 => RGB{Float64}(0.0646509,0.0587034,0.0743471)
@@ -100,12 +100,12 @@ julia> img = load("src/pkgs/segmentation/assets/horse.jpg");
100
100
101
101
julia> segments = felzenszwalb(img, 100)
102
102
Segmented Image with:
103
- labels map: 240×360 Array {Int64,2 }
103
+ labels map: 240×360 Matrix {Int64}
104
104
number of labels: 43
105
105
106
106
julia> segments = felzenszwalb(img, 10) #smaller segments but noisy segmentation
107
107
Segmented Image with:
108
- labels map: 240×360 Array {Int64,2 }
108
+ labels map: 240×360 Matrix {Int64}
109
109
number of labels: 312
110
110
```
111
111
@@ -141,7 +141,7 @@ julia> img = fill(1, 4, 4);
141
141
julia> img[1:2,1:2] .= 2;
142
142
143
143
julia> img
144
- 4×4 Array {Int64,2 }:
144
+ 4×4 Matrix {Int64}:
145
145
2 2 1 1
146
146
2 2 1 1
147
147
1 1 1 1
@@ -150,14 +150,14 @@ julia> img
150
150
julia> seg = fast_scanning(img, 0.5);
151
151
152
152
julia> labels_map(seg) # returns the assigned labels map
153
- 4×4 Array {Int64,2 }:
153
+ 4×4 Matrix {Int64}:
154
154
1 1 3 3
155
155
1 1 3 3
156
156
3 3 3 3
157
157
3 3 3 3
158
158
159
159
julia> segment_labels(seg) # returns a list of all assigned labels
160
- 2-element Array {Int64,1 }:
160
+ 2-element Vector {Int64}:
161
161
1
162
162
3
163
163
@@ -193,7 +193,7 @@ julia> seeds = [(CartesianIndex(104, 48), 1), (CartesianIndex( 49, 40), 1),
193
193
194
194
julia> seg = seeded_region_growing(img, seeds)
195
195
Segmented Image with:
196
- labels map: 183×275 Array {Int64,2 }
196
+ labels map: 183×275 Matrix {Int64}
197
197
number of labels: 2
198
198
```
199
199
** Original** [ (source)] ( https://upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Davidraju_Worm_Snake.jpg/275px-Davidraju_Worm_Snake.jpg ) :
@@ -241,7 +241,7 @@ julia> img = load("src/pkgs/segmentation/assets/tree.jpg");
241
241
242
242
julia> seg = unseeded_region_growing(img, 0.05) # here 0.05 is the threshold
243
243
Segmented Image with:
244
- labels map: 320×480 Array {Int64,2 }
244
+ labels map: 320×480 Matrix {Int64}
245
245
number of labels: 698
246
246
```
247
247
@@ -266,7 +266,7 @@ julia> img = Gray.(testimage("house"));
266
266
267
267
julia> segments = felzenszwalb(img, 300, 100) # k=300 (the merging threshold), min_size = 100 (smallest number of pixels/region)
268
268
Segmented Image with:
269
- labels map: 512×512 Array {Int64,2 }
269
+ labels map: 512×512 Matrix {Int64}
270
270
number of labels: 11
271
271
```
272
272
@@ -296,7 +296,7 @@ julia> img = imresize(img, (128, 128));
296
296
297
297
julia> segments = meanshift(img, 16, 8/255) # parameters are smoothing radii: spatial=16, intensity-wise=8/255
298
298
Segmented Image with:
299
- labels map: 128×128 Array {Int64,2 }
299
+ labels map: 128×128 Matrix {Int64}
300
300
number of labels: 44
301
301
```
302
302
![ img1] ( assets/small_house.jpg ) ![ img2] ( assets/meanshift.jpg )
@@ -328,12 +328,12 @@ julia> img = testimage("camera");
328
328
329
329
julia> seg = fast_scanning(img, 0.1) # threshold = 0.1
330
330
Segmented Image with:
331
- labels map: 512×512 Array {Int64,2 }
331
+ labels map: 512×512 Matrix {Int64}
332
332
number of labels: 2538
333
333
334
334
julia> seg = prune_segments(seg, i->(segment_pixel_count(seg,i)<50), (i,j)->(-segment_pixel_count(seg,j)))
335
335
Segmented Image with:
336
- labels map: 512×512 Array {Int64,2 }
336
+ labels map: 512×512 Matrix {Int64}
337
337
number of labels: 65
338
338
```
339
339
@@ -357,7 +357,7 @@ be used to create a segmented image.
357
357
358
358
###### Demo
359
359
360
- ``` jldoctest
360
+ ``` julia
361
361
julia> using TestImages, ImageSegmentation
362
362
363
363
julia> img = testimage (" lena_gray" );
@@ -370,7 +370,7 @@ homogeneous (generic function with 1 method)
370
370
371
371
julia> seg = region_splitting (img, homogeneous)
372
372
Segmented Image with:
373
- labels map: 256×256 Array {Int64,2 }
373
+ labels map: 256 × 256 Matrix {Int64}
374
374
number of labels: 8836
375
375
```
376
376
@@ -449,7 +449,7 @@ julia> markers = label_components(dist .< -15);
449
449
450
450
julia> segments = watershed(dist, markers)
451
451
Segmented Image with:
452
- labels map: 312×252 Array {Int64,2 }
452
+ labels map: 312×252 Matrix {Int64}
453
453
number of labels: 24
454
454
455
455
julia> imshow(map(i->get_random_color(i), labels_map(segments)) .* (1 .-bw)) #shows segmented image
@@ -516,7 +516,7 @@ julia> function homogeneous(img)
516
516
homogeneous (generic function with 1 method)
517
517
518
518
julia> t = region_tree(img, homogeneous) # `img` is an image
519
- Cell: RegionTrees.HyperRectangle{2,Float64}([1.0, 1.0], [300.0, 300.0])
519
+ Cell: RegionTrees.HyperRectangle{2, Float64}([1.0, 1.0], [300.0, 300.0])
520
520
```
521
521
522
522
For more information regarding ` RegionTrees ` , see [ this] ( https://github.com/rdeits/RegionTrees.jl#regiontreesjl-quadtrees-octrees-and-their-n-dimensional-cousins ) .
@@ -546,14 +546,14 @@ julia> img[1:2,3:4] .= 3;
546
546
julia> seg = fast_scanning(img, 0.5);
547
547
548
548
julia> labels_map(seg)
549
- 4×4 Array {Int64,2 }:
549
+ 4×4 Matrix {Int64}:
550
550
1 1 3 3
551
551
1 1 3 3
552
552
2 2 2 2
553
553
2 2 2 2
554
554
555
555
julia> seg.image_indexmap
556
- 4×4 Array {Int64,2 }:
556
+ 4×4 Matrix {Int64}:
557
557
1 1 3 3
558
558
1 1 3 3
559
559
2 2 2 2
@@ -564,7 +564,7 @@ julia> diff_fn(rem_label, neigh_label) = segment_pixel_count(seg,rem_label) - se
564
564
julia> new_seg = prune_segments(seg, [3], diff_fn);
565
565
566
566
julia> labels_map(new_seg)
567
- 4×4 Array {Int64,2 }:
567
+ 4×4 Matrix {Int64}:
568
568
1 1 2 2
569
569
1 1 2 2
570
570
2 2 2 2
@@ -583,7 +583,7 @@ neighbouring segment having least `diff_fn` value.
583
583
584
584
``` jldoctest prune
585
585
julia> seg.image_indexmap
586
- 4×4 Array {Int64,2 }:
586
+ 4×4 Matrix {Int64}:
587
587
1 1 3 3
588
588
1 1 3 3
589
589
2 2 2 2
@@ -594,7 +594,7 @@ julia> diff_fn(rem_label, neigh_label) = segment_pixel_count(seg,rem_label) - se
594
594
julia> rem_segment!(seg, 3, diff_fn);
595
595
596
596
julia> labels_map(new_seg)
597
- 4×4 Array {Int64,2 }:
597
+ 4×4 Matrix {Int64}:
598
598
1 1 2 2
599
599
1 1 2 2
600
600
2 2 2 2
0 commit comments