Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Tilmann Sager
contect
Commits
110135c8
Commit
110135c8
authored
Jul 28, 2021
by
Tilmann Sager
Browse files
Removed edge detection // improved probabilistic transform
parent
65fa8d65
Changes
7
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
110135c8
...
...
@@ -65,8 +65,6 @@ python main.py
[general]
multiprocessing
=
1 # multiprocessing: true (1) or false (0). If true, cores - 2 will be used
limit
=
0 # limit the number of hdf files to be processed (will take the first ones)
[path]
hdf
=
../data/granules # root directory hdf products
flights
=
../data/flights # root directory for flights
output
=
../data/output # root directory for results (will create a folder per run)
...
...
common/config.py
View file @
110135c8
...
...
@@ -99,6 +99,7 @@ def init_params():
Key
.
dt_linegap
:
int
(
cp
.
get
(
_detect_key
,
'line_gap'
)),
Key
.
dt_cannysigma
:
int
(
cp
.
get
(
_detect_key
,
'canny_sigma'
)),
Key
.
dt_filter
:
cp
.
get
(
_detect_key
,
'filter'
),
Key
.
dt_thresh_prob
:
int
(
cp
.
get
(
_detect_key
,
'thresh_prob'
)),
# Detection - Straight
Key
.
dt_thresh_hough
:
float
(
cp
.
get
(
_detect_key
,
'thresh_hough'
)),
...
...
common/constants.py
View file @
110135c8
...
...
@@ -120,6 +120,7 @@ class Key:
dt_linegap
=
'probabilistic_line_gap'
dt_cannysigma
=
'filter_canny_sigma'
dt_filter
=
'edge_detection'
dt_thresh_prob
=
'probabilistic_threshold'
# Detection - Straight
dt_thresh_hough
=
'hough_threshold'
...
...
config.ini
View file @
110135c8
...
...
@@ -3,7 +3,7 @@ hdf_input_root_dir = ../data/granules
flight_root_dir
=
../data/flights
output_root_dir
=
../data/output
multiprocessing
=
1
limit
=
5
limit
=
0
[product]
name
=
MODTBGA
...
...
@@ -20,18 +20,20 @@ k = 0.1
order
=
0
[detection]
method
=
straight
method
=
probabilistic
split_by
=
6
thresh_bin
=
70
max_px_size
=
150
connectivity
=
2
thresh_ratio
=
5
thresh_hough
=
0.5
postprocess
=
0
line_length
=
150
line_gap
=
3
filter
=
canny
canny_sigma
=
2
canny_sigma
=
1
connectivity
=
2
line_length
=
20
line_gap
=
5
thresh_prob
=
5
[classification]
thresh_low
=
20
...
...
detection/hough.py
View file @
110135c8
...
...
@@ -51,13 +51,13 @@ def _scharr(img: np.array) -> np.array:
# TODO: add thresholding again
def
probabilistic
(
img
,
params
):
if
params
[
Key
.
dt_filter
]
==
'scharr'
:
edges
=
_scharr
(
img
)
else
:
edges
=
_canny
(
img
,
params
[
Key
.
dt_cannysigma
])
#
if params[Key.dt_filter] == 'scharr':
#
edges = _scharr(img)
#
else:
#
edges = _canny(img, params[Key.dt_cannysigma])
lines
=
probabilistic_hough_line
(
edges
,
params
[
Key
.
dt_linelength
],
params
[
Key
.
dt_linegap
])
img
,
threshold
=
params
[
Key
.
dt_thresh_prob
],
line_length
=
params
[
Key
.
dt_linelength
],
line_gap
=
params
[
Key
.
dt_linegap
])
labeled
=
label_segments
(
img
)
intersect_labels
=
line_segment_intersect_prob
(
labeled
,
lines
)
line_type_labels
=
get_line_type_segments
(
...
...
detection/label.py
View file @
110135c8
...
...
@@ -171,7 +171,7 @@ def line_segment_intersect_prob(labeled: np.array, lines: []) -> [int]:
if
masked
.
any
():
intersections
.
append
(
label_num
)
return
intersections
return
list
(
set
(
intersections
))
def
_draw_lines
(
hough_lines
:
[],
dimension
):
...
...
main.py
View file @
110135c8
...
...
@@ -22,7 +22,7 @@ def main():
results
=
categorise
(
granules
,
params
)
write_csv_pandas
(
results
,
params
[
Key
.
out_res
],
result_columns
)
plot_flight_pixel_ratio
(
results
)
#
plot_flight_pixel_ratio(results)
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
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