@@ -56,7 +56,7 @@ namespace pcl
56
56
RangeImageBorderExtractor::RangeImageBorderExtractor (const RangeImage* range_image) :
57
57
range_image_ (range_image), range_image_size_during_extraction_(0 ),
58
58
surface_structure_ (nullptr ), border_descriptions_(nullptr ), shadow_border_informations_(nullptr ), border_directions_(nullptr ),
59
- surface_change_scores_ ( nullptr ), surface_change_directions_(nullptr )
59
+ surface_change_directions_ (nullptr )
60
60
{
61
61
}
62
62
@@ -88,13 +88,13 @@ RangeImageBorderExtractor::clearData ()
88
88
if (border_directions_!=nullptr )
89
89
delete border_directions_[i];
90
90
}
91
- delete[] surface_structure_; surface_structure_ = nullptr ;
92
- delete[] shadow_border_informations_; shadow_border_informations_ = nullptr ;
93
- delete[] border_directions_; border_directions_ = nullptr ;
94
- delete border_descriptions_; border_descriptions_ = nullptr ;
91
+ surface_structure_. reset () ;
92
+ shadow_border_informations_. reset () ;
93
+ border_directions_. reset () ;
94
+ border_descriptions_. reset () ;
95
95
96
- delete[] surface_change_scores_; surface_change_scores_ = nullptr ;
97
- delete[] surface_change_directions_; surface_change_directions_ = nullptr ;
96
+ surface_change_directions_. reset () ;
97
+ surface_change_scores_. clear () ;
98
98
}
99
99
100
100
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -560,7 +560,7 @@ RangeImageBorderExtractor::calculateBorderDirections ()
560
560
void
561
561
RangeImageBorderExtractor::calculateSurfaceChanges ()
562
562
{
563
- if (surface_change_scores_!= nullptr )
563
+ if (!surface_change_scores_. empty () )
564
564
return ;
565
565
566
566
calculateBorderDirections ();
@@ -570,8 +570,8 @@ RangeImageBorderExtractor::calculateSurfaceChanges ()
570
570
int width = range_image_->width ,
571
571
height = range_image_->height ,
572
572
size = width*height;
573
- surface_change_scores_ = new float [ size] ;
574
- surface_change_directions_ = new Eigen::Vector3f[size] ;
573
+ surface_change_scores_. resize ( size) ;
574
+ surface_change_directions_ = std::make_unique< Eigen::Vector3f[]>(size) ;
575
575
#pragma omp parallel for \
576
576
default (none) \
577
577
shared (height, width) \
@@ -618,7 +618,7 @@ RangeImageBorderExtractor::blurSurfaceChanges ()
618
618
const RangeImage& range_image = *range_image_;
619
619
620
620
Eigen::Vector3f* blurred_directions = new Eigen::Vector3f[range_image.width *range_image.height ];
621
- float * blurred_scores = new float [ range_image.width *range_image.height ] ;
621
+ std::vector< float > blurred_scores ( range_image.width *range_image.height ) ;
622
622
for (int y=0 ; y<int (range_image.height ); ++y)
623
623
{
624
624
for (int x=0 ; x<int (range_image.width ); ++x)
@@ -664,9 +664,9 @@ RangeImageBorderExtractor::blurSurfaceChanges ()
664
664
new_score /= counter;
665
665
}
666
666
}
667
- delete[] surface_change_directions_;
668
- surface_change_directions_ = blurred_directions;
669
- delete[] surface_change_scores_;
667
+ surface_change_directions_. reset () ;
668
+ surface_change_directions_ = std::unique_ptr<Eigen::Vector3f[]>( std::move ( blurred_directions)) ;
669
+ surface_change_scores_. clear () ;
670
670
surface_change_scores_ = blurred_scores;
671
671
}
672
672
0 commit comments