Commit 18d559f6 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Add app to superimpose the result of the detection.

        *  apps/smartdoc/CMakeLists.txt,
        *  apps/smartdoc/prettyview.cpp,
parent 484e6486
......@@ -10,12 +10,16 @@ add_executable(smartdoc_app2 main2.cpp
$<TARGET_OBJECTS:g2-tools>
)
add_executable(prettyview prettyview.cpp)
add_executable(smartdoc_cli smartdoc-cli.cpp smartdoc.cpp)
add_executable(challenge2 challenge2.cpp unhomo.cpp border_detection.cpp)
target_link_libraries(smartdoc_cli ${FreeImage_LIBRARIES})
target_link_libraries(prettyview ${FreeImage_LIBRARIES})
target_link_libraries(smartdoc_app
-lavcodec -lavformat -lswscale
${FreeImage_LIBRARIES})
......
#include <mln/core/image/image2d.hpp>
#include <mln/core/algorithm/fill.hpp>
#include <mln/core/se/ball.hpp>
#include <mln/io/imread.hpp>
#include <mln/io/imsave.hpp>
#include <mln/morpho/structural/gradient.hpp>
#include <mln/colors/literal.hpp>
#include <apps/tos/Kinterpolate.hpp>
int main(int argc, char** argv)
{
if (argc < 3) {
std::cerr << "Usage: " << argv[0] << "detection.png original.png output.png\n"
"Dessine les contours de la détection en superimosition de l'image d'origine.\n";
std::exit(1);
}
using namespace mln;
image2d<rgb8> f;
image2d<rgb8> ori;
io::imread(argv[1], f);
io::imread(argv[2], ori);
f = Kadjust_to(f, ori.domain());
image2d<bool> mask = eval(red(f) > 127);
auto ball = se::make_ball2d(10);
auto m2 = morpho::structural::external_gradient(mask, ball);
fill(ori | m2, colors::literal::red);
io::imsave(ori, argv[3]);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment