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
Tilman Marquart
Art Structures - LME Praktikum
Commits
190faf55
Unverified
Commit
190faf55
authored
Jan 12, 2020
by
tilman
Browse files
add background foreground seperation
parent
c7f19c9c
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
detect_structures.py
View file @
190faf55
This diff is collapsed.
Click to expand it.
playground/morphological_filters(anticracks).py
View file @
190faf55
import
cv2
import
numpy
as
np
# out = cv2.imread('../images/images_imdahl/Giotto_di_Bondone_-_Joachims_Dream_-_Capella_degli_Scrovegni.jpg')
out
=
cv2
.
imread
(
'/Users/Tilman/Documents/Programme/Python/forschungspraktikum/art-structures-env/src/images/out/images_imdahl/kmeans_output_canvas/
new2
/658px-Giotto_di_Bondone_-_No._3_Scenes_from_the_Life_of_Joachim_-_3._Annunciation_to_St_Anne_-_WGA09171.
png_kmeans_temp_save_after
.jpg'
)
out
=
cv2
.
imread
(
'/Users/Tilman/Documents/Programme/Python/forschungspraktikum/art-structures-env/src/images/out/images_imdahl/kmeans_output_canvas/
final
/658px-Giotto_di_Bondone_-_No._3_Scenes_from_the_Life_of_Joachim_-_3._Annunciation_to_St_Anne_-_WGA09171.
jpg_inkm_step5_kmean_binarization
.jpg'
)
# out = cv2.GaussianBlur(out,(5,5),0)
# out = cv2.medianBlur(out,3) #smoothen cracks
out
=
cv2
.
medianBlur
(
out
,
13
)
#smoothen cracks
out
=
cv2
.
bilateralFilter
(
out
,
30
,
60
,
60
)
#remove cracks
out
=
cv2
.
medianBlur
(
out
,
13
)
#smoothen cracks
#remove small kmeans fragments
kernel
=
np
.
array
([
[
0
,
0
,
1
,
0
,
0
],
[
0
,
1
,
1
,
1
,
0
],
[
0.5
,
1
,
1
,
1
,
1
],
[
0
,
1
,
1
,
1
,
0
],
[
0
,
0
,
0.5
,
0
,
0
]],
dtype
=
np
.
uint8
)
# out = cv2.medianBlur(out,53)
# out = cv2.medianBlur(out,53)
out
=
cv2
.
erode
(
out
,
kernel
,
iterations
=
10
)
out
=
cv2
.
dilate
(
out
,
kernel
,
iterations
=
10
)
out
=
cv2
.
dilate
(
out
,
kernel
,
iterations
=
10
)
out
=
cv2
.
erode
(
out
,
kernel
,
iterations
=
10
)
# out = cv2.bilateralFilter(out,20,60,60)
# out = cv2.medianBlur(out,7)
# out = cv2.medianBlur(out,13) #smoothen cracks
# out = cv2.bilateralFilter(out,30,90,90) #remove cracks
...
...
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