Skip to content

Commit

Permalink
✨ Simple tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
JuInria committed Feb 16, 2022
1 parent 4582388 commit 539c713
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tutorials/cpp_integration/tutorial_cpp_integration.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// OpenCV
#include <opencv2/opencv.hpp>

// Internal
Expand All @@ -8,19 +9,16 @@ int
main( int argc, char **argv )
{
const auto model_path = std::string( "/root/deep-learning-ws/yolox/example/hole_detector/models/tiny_yolox" );
const auto hole_localizer = std::make_unique< detector::DnnHoleLocalizer >( model_path, 416, 0.5 );
const auto hole_localizer = std::make_unique< detector::DnnHoleLocalizer >( model_path );

auto cv_color = cv::imread( "/root/deep-learning-ws/yolox/example/hole_detector/data/Images/frame0001.jpg" );
for ( const auto &detection : hole_localizer->detect( cv_color ) )
{
const auto pt1 = cv::Point( detection.bbox.getTopLeft().get_u(), detection.bbox.getTopLeft().get_v() );
const auto pt2 = cv::Point( detection.bbox.getBottomRight().get_u(), detection.bbox.getBottomRight().get_v() );
auto cv_color = cv::imread( "/root/deep-learning-ws/yolox/example/hole_detector/data/Images/frame0000.jpg" );

cv::rectangle( cv_color, pt1, pt2, cv::Scalar( 0, 255, 0 ) );
}
const auto detections = hole_localizer->detect( cv_color );
std::for_each( begin( detections ), end( detections ),
[&cv_color]( const auto &detection ) { detection.display( cv_color ); } );

cv::imshow( "Hole detection", cv_color );
cv::waitKey( 0 );
cv::waitKey();

return EXIT_SUCCESS;
}

0 comments on commit 539c713

Please sign in to comment.