2121#include < array>
2222#include < memory>
2323#include < limits>
24+ #include < string>
25+ #include < utility>
2426
2527namespace nav2_costmap_2d
2628{
@@ -77,7 +79,7 @@ void morphologyOperation(
7779 const Image<uint8_t > & input, Image<uint8_t > & output,
7880 const Image<uint8_t > & shape, AggregateFn aggregate);
7981
80- using ShapeBuffer3x3 = std::array<uint8_t , 9 >;
82+ using ShapeBuffer3x3 = std::array<uint8_t , 9 >; // NOLINT
8183inline Image<uint8_t > createShape (ShapeBuffer3x3 & buffer, ConnectivityType connectivity);
8284} // namespace imgproc_impl
8385
@@ -95,7 +97,7 @@ inline void dilate(
9597 const Image<uint8_t > & input, Image<uint8_t > & output,
9698 ConnectivityType connectivity, Max && max_function)
9799{
98- using namespace imgproc_impl ;
100+ using namespace imgproc_impl ; // NOLINT
99101 ShapeBuffer3x3 shape_buffer;
100102 Image<uint8_t > shape = createShape (shape_buffer, connectivity);
101103 morphologyOperation (input, output, shape, max_function);
@@ -376,7 +378,7 @@ struct EquivalenceLabelTreesBase
376378
377379struct LabelOverflow : public std ::runtime_error
378380{
379- LabelOverflow (const std::string & message)
381+ explicit LabelOverflow (const std::string & message)
380382 : std::runtime_error(message) {}
381383};
382384
@@ -464,7 +466,6 @@ class EquivalenceLabelTrees : public EquivalenceLabelTreesBase
464466 {
465467 Label k = 1 ;
466468 for (Label i = 1 ; i < next_free_; ++i) {
467-
468469 if (labels_[i] < i) {
469470 labels_[i] = labels_[labels_[i]];
470471 } else {
@@ -504,7 +505,7 @@ class EquivalenceLabelTrees : public EquivalenceLabelTreesBase
504505 * '~' - row continuation in the same style */
505506 max_labels = (rows * columns) / 3 + 1 ;
506507 }
507- ++max_labels; // add zero label
508+ ++max_labels; // add zero label
508509 max_labels = std::min (max_labels, size_t (std::numeric_limits<Label>::max ()));
509510 return max_labels;
510511 }
@@ -568,7 +569,7 @@ struct ProcessPixel<ConnectivityType::Way8>
568569 {
569570 Label & current = label.e ();
570571
571- // The decision tree traversal. See reference article for details
572+ // The decision tree traversal. See reference article for details
572573 if (!is_bg (image.e ())) {
573574 if (label.b ()) {
574575 current = label.b ();
@@ -760,17 +761,20 @@ void morphologyOperation(
760761 };
761762
762763 // Apply the central shape row.
763- // This operation is applicable to all rows of the image, because at any position of the sliding window,
764+ // This operation is applicable to all rows of the image,
765+ // because at any position of the sliding window,
764766 // its central row is located on the image. So we start from the zero line of input and output
765767 probeRows (input, 0 , output, 0 , shape.row (1 ), set);
766768
767769 if (input.rows () > 1 ) {
768770 // Apply the top shape row.
769771 // In the uppermost position of the sliding window, its first row is outside the image border.
770- // Therefore, we start filling the output image starting from the line 1 and will process input.rows() - 1 lines in total
772+ // Therefore, we start filling the output image starting from the line 1 and will process
773+ // input.rows() - 1 lines in total
771774 probeRows (input, 0 , output, 1 , shape.row (0 ), update);
772775 // Apply the bottom shape row.
773- // Similarly, the input image starting from the line 1 and will process input.rows() - 1 lines in total
776+ // Similarly, the input image starting from the line 1 and will process
777+ // input.rows() - 1 lines in total
774778 probeRows (input, 1 , output, 0 , shape.row (2 ), update);
775779 }
776780}
@@ -812,8 +816,8 @@ Label connectedComponentsImpl(
812816 const Image<uint8_t > & image, Image<Label> & labels,
813817 imgproc_impl::EquivalenceLabelTrees<Label> & label_trees, const IsBg & is_background)
814818{
815- using namespace imgproc_impl ;
816- using PixelPass = ProcessPixel<connectivity>;
819+ using namespace imgproc_impl ; // NOLINT
820+ using PixelPass = ProcessPixel<connectivity>; // NOLINT
817821
818822 // scanning phase
819823 // scan row 0
@@ -1036,7 +1040,7 @@ Image<Label> connectedComponents(
10361040 const IsBg & is_background,
10371041 Label & total_labels)
10381042{
1039- using namespace imgproc_impl ;
1043+ using namespace imgproc_impl ; // NOLINT
10401044 const size_t pixels = image.rows () * image.columns ();
10411045
10421046 if (pixels == 0 ) {
0 commit comments