Wolfram.com
WolframAlpha.com
WolframCloud.com
Wolfram Language
Example Repository
Ready-to-use examples for the Wolfram Language
Primary Navigation
Categories
Astronomy
Audio Processing
Calculus
Cellular Automata
Chemistry
Complex Systems
Computer Science
Computer Vision
Control Systems
Creative Arts
Data Science
Engineering
Finance & Economics
Finite Element Method
Food & Nutrition
Geography
Geometry
Graphs & Networks
Image Processing
Life Sciences
Machine Learning
Mathematics
Optimization
Physics
Puzzles and Recreation
Quantum Computation
Signal Processing
Social Sciences
System Modeling
Text & Language Processing
Time-Related Computation
Video Processing
Visualization & Graphics
Alphabetical List
Submit a New Resource
Learn More about
Wolfram Language
Related Pages
Related Symbols
Classify
Closing
ComponentMeasurements
DistanceTransform
MorphologicalComponents
Opening
SelectComponents
Thinning
WatershedComponents
Related Categories
Image Processing
Computer Vision
Life Sciences
Blood Cell Identification
Segment and classify normal and burr cells
Example Notebook
Open in Cloud
Download Notebook
Start with an image of red blood cells:
I
n
[
1
]
:
=
i
m
g
=
;
Separate foreground and background with an automatic threshold:
I
n
[
2
]
:
=
b
i
n
a
r
y
=
C
o
l
o
r
N
e
g
a
t
e
@
B
i
n
a
r
i
z
e
[
i
m
g
]
O
u
t
[
2
]
=
Segment overlapping and touching blood cells by identifying every cell as a peak in the distance transform:
I
n
[
3
]
:
=
d
t
=
D
i
s
t
a
n
c
e
T
r
a
n
s
f
o
r
m
[
b
i
n
a
r
y
]
;
I
m
a
g
e
A
d
j
u
s
t
[
d
t
]
O
u
t
[
3
]
=
Find the centers of each cell using a maxima detector:
I
n
[
4
]
:
=
m
a
r
k
e
r
=
M
a
x
D
e
t
e
c
t
[
d
t
,
1
]
O
u
t
[
4
]
=
Segment each individual blood cell and color them all differently by performing a watershed segmentation to capture the scope of each cell:
I
n
[
5
]
:
=
s
e
g
m
e
n
t
s
=
I
m
a
g
e
D
a
t
a
[
b
i
n
a
r
y
,
"
B
i
t
"
]
W
a
t
e
r
s
h
e
d
C
o
m
p
o
n
e
n
t
s
[
C
o
l
o
r
N
e
g
a
t
e
@
d
t
,
m
a
r
k
e
r
]
;
C
o
l
o
r
i
z
e
[
s
e
g
m
e
n
t
s
]
O
u
t
[
5
]
=
Create a mask for all cells:
I
n
[
6
]
:
=
m
a
s
k
=
I
m
a
g
e
[
s
e
g
m
e
n
t
s
,
"
B
i
n
a
r
y
"
]
O
u
t
[
6
]
=
Highlight the tentacles of burr cells via a morphological top-hat transformation that extracts all shapes smaller than a disk of radius 8 pixels.:
I
n
[
7
]
:
=
s
p
i
k
e
s
=
T
o
p
H
a
t
T
r
a
n
s
f
o
r
m
[
m
a
s
k
,
D
i
s
k
M
a
t
r
i
x
[
8
]
]
O
u
t
[
7
]
=
Extract burr cells by selecting cells of a certain size that exhibit tentacles of more than 5% of their total area:
I
n
[
8
]
:
=
b
u
r
r
=
I
m
a
g
e
[
L
a
s
t
@
S
e
l
e
c
t
C
o
m
p
o
n
e
n
t
s
[
{
s
p
i
k
e
s
,
s
e
g
m
e
n
t
s
}
,
(
5
0
0
<
#
A
r
e
a
<
1
5
0
0
∧
0
.
0
5
<
#
M
e
a
n
<
1
)
&
]
,
"
B
i
t
"
]
;
I
n
[
9
]
:
=
H
i
g
h
l
i
g
h
t
I
m
a
g
e
[
i
m
g
,
{
G
r
e
e
n
,
b
u
r
r
}
]
O
u
t
[
9
]
=
See Also
Classify Cells Based on Their Shape
Related Symbols
Classify
Closing
ComponentMeasurements
DistanceTransform
MorphologicalComponents
Opening
SelectComponents
Thinning
WatershedComponents
Publisher Information
Contributed by:
Wolfram Staff