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
Olena
pylene
Commits
1797bfcd
Commit
1797bfcd
authored
Jun 17, 2021
by
Quentin Kaci
Browse files
Integrate alpha tree and watershed hierarchy benchmarks into pipeline
parent
f9da352b
Pipeline
#28630
passed with stage
in 25 minutes and 50 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
bench/BMAlphaTree.cpp
View file @
1797bfcd
...
...
@@ -8,11 +8,10 @@
using
image_t
=
mln
::
image2d
<
mln
::
rgb8
>
;
static
const
std
::
vector
<
std
::
string
>
bench_images
=
{
"
plane.png"
,
"nature.png"
,
"mountains.png"
,
"hong_kong.pn
g"
};
static
const
std
::
vector
<
std
::
string
>
bench_images
=
{
"
Aerial_view_of_Olbia.jpg"
,
"Space1_20MB.jp
g"
};
static
const
auto
alphatree_vect_function
=
[](
const
image_t
&
input
)
{
mln
::
morpho
::
alphatree
(
input
,
mln
::
c4
,
[](
const
auto
&
a
,
const
auto
&
b
)
->
std
::
double_t
{
return
mln
::
l2dist
(
a
,
b
);
});
mln
::
morpho
::
alphatree
(
input
,
mln
::
c4
,
[](
const
auto
&
a
,
const
auto
&
b
)
->
double
{
return
mln
::
l2dist
(
a
,
b
);
});
};
static
const
auto
alphatree_hq_function
=
[](
const
image_t
&
input
)
{
...
...
@@ -43,44 +42,24 @@ public:
};
BENCHMARK_F
(
BMAlphaTree
,
Alphatree
Plane
Vect
)(
benchmark
::
State
&
st
)
BENCHMARK_F
(
BMAlphaTree
,
Alphatree
Olbia
Vect
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
alphatree_vect_function
,
0
);
}
BENCHMARK_F
(
BMAlphaTree
,
Alphatree
Plane
HQ
)(
benchmark
::
State
&
st
)
BENCHMARK_F
(
BMAlphaTree
,
Alphatree
Olbia
HQ
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
alphatree_hq_function
,
0
);
}
BENCHMARK_F
(
BMAlphaTree
,
Alphatree
Natur
eVect
)(
benchmark
::
State
&
st
)
BENCHMARK_F
(
BMAlphaTree
,
Alphatree
Spac
eVect
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
alphatree_vect_function
,
1
);
}
BENCHMARK_F
(
BMAlphaTree
,
Alphatree
Natur
eHQ
)(
benchmark
::
State
&
st
)
BENCHMARK_F
(
BMAlphaTree
,
Alphatree
Spac
eHQ
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
alphatree_hq_function
,
1
);
}
BENCHMARK_F
(
BMAlphaTree
,
AlphatreeMountainsVect
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
alphatree_vect_function
,
2
);
}
BENCHMARK_F
(
BMAlphaTree
,
AlphatreeMountainsHQ
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
alphatree_hq_function
,
2
);
}
BENCHMARK_F
(
BMAlphaTree
,
AlphatreeHongKongVect
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
alphatree_vect_function
,
3
);
}
BENCHMARK_F
(
BMAlphaTree
,
AlphatreeHongKongHQ
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
alphatree_hq_function
,
3
);
}
BENCHMARK_MAIN
();
\ No newline at end of file
bench/BMWatershedHierarchy.cpp
View file @
1797bfcd
#include
<mln/core/image/view/cast.hpp>
#include
<mln/io/imread.hpp>
#include
<mln/io/imsave.hpp>
#include
<benchmark/benchmark.h>
#include
<mln/accu/accumulators/count.hpp>
#include
<mln/accu/accumulators/mean.hpp>
#include
<mln/core/colors.hpp>
#include
<mln/core/image/ndimage.hpp>
#include
<mln/core/neighborhood/c4.hpp>
#include
<mln/io/imread.hpp>
#include
<mln/morpho/watershed_hierarchy.hpp>
using
image_t
=
mln
::
image2d
<
mln
::
rgb8
>
;
static
const
std
::
vector
<
std
::
string
>
bench_images
=
{
"
plane.png"
,
"nature.png"
,
"mountains.png"
,
"hong_kong.pn
g"
};
static
const
std
::
vector
<
std
::
string
>
bench_images
=
{
"
Aerial_view_of_Olbia.jpg"
,
"Space1_20MB.jp
g"
};
static
const
auto
watershed_hierarchy_by_area_function
=
[](
const
image_t
&
input
)
{
mln
::
morpho
::
watershed_hierarchy
(
input
,
mln
::
accu
::
features
::
count
<>
(),
mln
::
c4
,
[](
const
auto
&
a
,
const
auto
&
b
)
->
std
::
float_t
{
return
mln
::
l2dist
(
a
,
b
);
});
mln
::
morpho
::
watershed_hierarchy
(
input
,
[](
auto
tree
,
auto
nm
)
->
std
::
vector
<
size_t
>
{
return
tree
.
compute_attribute_on_points
(
nm
,
mln
::
accu
::
features
::
count
<>
());
},
mln
::
c4
,
[](
const
auto
&
a
,
const
auto
&
b
)
->
std
::
float_t
{
return
mln
::
l2dist
(
a
,
b
);
});
};
static
const
auto
hierarchical_segmentation_function
=
[](
const
image_t
&
input
)
{
auto
[
tree
,
node_map
]
=
mln
::
morpho
::
watershed_hierarchy
(
input
,
mln
::
accu
::
features
::
count
<>
(),
mln
::
c4
,
[](
const
auto
&
a
,
const
auto
&
b
)
->
std
::
float_t
{
return
mln
::
l2dist
(
a
,
b
);
});
auto
[
tree
,
node_map
]
=
mln
::
morpho
::
watershed_hierarchy
(
input
,
[](
auto
tree
,
auto
nm
)
->
std
::
vector
<
size_t
>
{
return
tree
.
compute_attribute_on_points
(
nm
,
mln
::
accu
::
features
::
count
<>
());
},
mln
::
c4
,
[](
const
auto
&
a
,
const
auto
&
b
)
->
std
::
float_t
{
return
mln
::
l2dist
(
a
,
b
);
});
auto
mean
=
tree
.
compute_attribute_on_values
(
node_map
,
input
,
mln
::
accu
::
accumulators
::
mean
<
mln
::
rgb8
>
());
...
...
@@ -50,49 +53,29 @@ public:
callback
(
inputs
[
i
]);
}
std
::
vector
<
image_t
>
inputs
;
static
std
::
vector
<
image_t
>
inputs
;
};
std
::
vector
<
image_t
>
BMWatershedHierarchy
::
inputs
;
BENCHMARK_F
(
BMWatershedHierarchy
,
WatershedHierarchyAreaPlane
)(
benchmark
::
State
&
st
)
BENCHMARK_F
(
BMWatershedHierarchy
,
WatershedHierarchyAreaOlbia
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
watershed_hierarchy_by_area_function
,
0
);
}
BENCHMARK_F
(
BMWatershedHierarchy
,
HierarchicalSegmentation
Plane
)(
benchmark
::
State
&
st
)
BENCHMARK_F
(
BMWatershedHierarchy
,
HierarchicalSegmentation
Olbia
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
hierarchical_segmentation_function
,
0
);
}
BENCHMARK_F
(
BMWatershedHierarchy
,
WatershedHierarchyArea
Natur
e
)(
benchmark
::
State
&
st
)
BENCHMARK_F
(
BMWatershedHierarchy
,
WatershedHierarchyArea
Spac
e
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
watershed_hierarchy_by_area_function
,
1
);
}
BENCHMARK_F
(
BMWatershedHierarchy
,
HierarchicalSegmentation
Natur
e
)(
benchmark
::
State
&
st
)
BENCHMARK_F
(
BMWatershedHierarchy
,
HierarchicalSegmentation
Spac
e
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
hierarchical_segmentation_function
,
1
);
}
BENCHMARK_F
(
BMWatershedHierarchy
,
WatershedHierarchyAreaMountains
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
watershed_hierarchy_by_area_function
,
2
);
}
BENCHMARK_F
(
BMWatershedHierarchy
,
HierarchicalSegmentationMountains
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
hierarchical_segmentation_function
,
2
);
}
BENCHMARK_F
(
BMWatershedHierarchy
,
WatershedHierarchyAreaHongKong
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
watershed_hierarchy_by_area_function
,
3
);
}
BENCHMARK_F
(
BMWatershedHierarchy
,
HierarchicalSegmentationHongKong
)(
benchmark
::
State
&
st
)
{
this
->
run
(
st
,
hierarchical_segmentation_function
,
3
);
}
BENCHMARK_MAIN
();
\ No newline at end of file
bench/CMakeLists.txt
View file @
1797bfcd
...
...
@@ -64,5 +64,7 @@ add_benchmark(BMMorphers BMMorphers.cpp BMMorphers_main.cpp)
add_benchmark
(
BMReference_Linear BMReference_Linear.cpp BMReference_Linear_Reversed.cpp BMReference_Linear_main.cpp
)
add_benchmark
(
BMReference_Neighborhood BMReference_Neighborhood_main.cpp
)
add_benchmark
(
BMBufferPrimitives BMBufferPrimitives.cpp
)
add_benchmark
(
BMAlphaTree BMAlphaTree.cpp
)
add_benchmark
(
BMWatershedHierarchy BMWatershedHierarchy.cpp
)
ExternalData_Add_Target
(
fetch-external-data
)
doc/source/snippets/CMakeLists.txt
View file @
1797bfcd
...
...
@@ -6,20 +6,20 @@ set(PYLENE_IMAGE_DIR ${PROJECT_SOURCE_DIR}/img)
set
(
DOCUMENTATION_IMAGES
""
)
function
(
add_image EXECUTABLE INPUT
)
# add_image(EXECUTABLE INPUT OUTPUT1 [ [OUTPUT2 [OUTPUT3 ...] ] ]
set
(
outputs
""
)
foreach
(
output IN LISTS ARGN
)
set
(
output
"
${
DOCUMENTATION_IMAGE_DIR
}
/
${
output
}
"
)
list
(
APPEND outputs
"
${
output
}
"
)
list
(
APPEND DOCUMENTATION_IMAGES
"
${
output
}
"
)
endforeach
()
set
(
DOCUMENTATION_IMAGES
${
DOCUMENTATION_IMAGES
}
PARENT_SCOPE
)
add_custom_command
(
OUTPUT
${
outputs
}
COMMAND
${
EXECUTABLE
}
${
INPUT
}
${
outputs
}
COMMAND_EXPAND_LISTS
)
# add_image(EXECUTABLE INPUT OUTPUT1 [ [OUTPUT2 [OUTPUT3 ...] ] ]
set
(
outputs
""
)
foreach
(
output IN LISTS ARGN
)
set
(
output
"
${
DOCUMENTATION_IMAGE_DIR
}
/
${
output
}
"
)
list
(
APPEND outputs
"
${
output
}
"
)
list
(
APPEND DOCUMENTATION_IMAGES
"
${
output
}
"
)
endforeach
()
set
(
DOCUMENTATION_IMAGES
${
DOCUMENTATION_IMAGES
}
PARENT_SCOPE
)
add_custom_command
(
OUTPUT
${
outputs
}
COMMAND
${
EXECUTABLE
}
${
INPUT
}
${
outputs
}
COMMAND_EXPAND_LISTS
)
endfunction
()
add_image
(
"intro-1"
"
${
DOCUMENTATION_IMAGE_DIR
}
/Olena-c6gradi.png"
intro-1-1.png
)
...
...
@@ -40,18 +40,18 @@ add_image("cdt;4" "${DOCUMENTATION_IMAGE_DIR}/F.png" F-5-7-11.png)
add_image
(
"staff_lines"
"
${
DOCUMENTATION_IMAGE_DIR
}
/staff_lines.pbm"
morpho_hitormiss_1.png morpho_hitormiss_2.png staff_lines_markers.png morpho_reconstruction_1.png morpho_reconstruction_2.png
)
morpho_hitormiss_1.png morpho_hitormiss_2.png staff_lines_markers.png morpho_reconstruction_1.png morpho_reconstruction_2.png
)
add_image
(
"reconstruction"
"
${
DOCUMENTATION_IMAGE_DIR
}
/blobs2_binary.png"
morpho_reconstruction_dilated.png
morpho_reconstruction_markers.png
morpho_reconstruction_rec.png
morpho_reconstruction_out.png
)
"
${
DOCUMENTATION_IMAGE_DIR
}
/blobs2_binary.png"
morpho_reconstruction_dilated.png
morpho_reconstruction_markers.png
morpho_reconstruction_rec.png
morpho_reconstruction_out.png
)
add_image
(
"area_filter"
"
${
DOCUMENTATION_IMAGE_DIR
}
/blobs2_binary.png"
morpho_area_filter_dilated.png
morpho_area_filter_opening.png
morpho_area_filter_out.png
)
"
${
DOCUMENTATION_IMAGE_DIR
}
/blobs2_binary.png"
morpho_area_filter_dilated.png
morpho_area_filter_opening.png
morpho_area_filter_out.png
)
add_image
(
"blobs_watershed"
"
${
DOCUMENTATION_IMAGE_DIR
}
/blobs_binary.png"
blobs_distance_transform.png blobs_segmentation.png
)
...
...
@@ -63,7 +63,7 @@ add_image("watershed_hierarchy_example" "${PYLENE_IMAGE_DIR}/lena.ppm" watershed
add_image
(
"watershed_hierarchy_example"
"
${
PYLENE_IMAGE_DIR
}
/lena.pgm"
watershed_hierarchy_area_gray.png
)
add_custom_target
(
build-images
DEPENDS
"
${
DOCUMENTATION_IMAGES
}
"
)
DEPENDS
"
${
DOCUMENTATION_IMAGES
}
"
)
add_library
(
doc-lib lut.cpp
)
target_link_libraries
(
doc-lib Pylene::Pylene
)
...
...
@@ -88,7 +88,7 @@ target_compile_definitions(erosion-cli PRIVATE BOOST_ALL_NO_LIB)
# for program_options, need to separate CONAN and regular FindBoost
if
(
TARGET Boost::program_options
)
target_link_libraries
(
erosion-cli PRIVATE Boost::program_options
)
target_link_libraries
(
erosion-cli PRIVATE Boost::program_options
)
elseif
(
TARGET Boost::Boost
)
target_link_libraries
(
erosion-cli PRIVATE Boost::Boost
)
endif
()
\ No newline at end of file
target_link_libraries
(
erosion-cli PRIVATE Boost::Boost
)
endif
()
\ No newline at end of file
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