Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bio-IT
image-analysis-training-resources
Commits
1fc71747
Commit
1fc71747
authored
Jul 04, 2019
by
Constantin Pape
Browse files
Add python binarization activity
parent
a81513db
Pipeline
#10443
passed with stage
in 1 minute and 6 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
_includes/binarization/activities/binarization_python.md
0 → 100644
View file @
1fc71747
```
python
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
skimage
import
io
# load the image from file
image_file
=
"/image-analysis-training-resources/image_data/xy_8bit__two_cells.tif"
image
=
io
.
imread
(
image_file
)
# binarize the image, so that all values larger than the threshold are foreground
threshold_value
=
60
binarized
=
image
>
threshold_value
# display the original and the binarized image
fig
,
ax
=
plt
.
subplots
(
2
)
ax
[
0
].
subplot
(
image
)
ax
[
0
].
set_title
(
"Image"
)
ax
[
1
].
subplot
(
binarized
)
ax
[
1
].
set_title
(
"Binarized"
)
```
For associated course material in jupyter,
[
click here
](
TODO
)
.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment