#include <bmdl_classify.h>
Classes | |
class | merge_map |
A helper class to manage merging of buildings. More... | |
Public Member Functions | |
bmdl_classify (unsigned int area_threshold=6, T height_resolution=0.5, T gnd_threshold=2.0, T veg_threshold_=1.0) | |
Constructor. | |
void | set_lidar_data (const vil_image_view< T > &first_return, const vil_image_view< T > &last_return) |
Set the first and last return images. | |
void | set_bare_earth (const vil_image_view< T > &bare_earth) |
Set the bare earth image. | |
T | estimate_bare_earth () |
Estimate a constant bare earth model. | |
T | estimate_height_noise_stdev () |
Estimate the standard deviation in height due to noise. | |
void | set_height_noise_stdev (T stdev) |
Manually specify the standard deviation in lidar height from noise. | |
void | set_area_threshold (unsigned int area) |
Specify the building area threshold. | |
void | set_ground_threshold (T gnd_threshold) |
Specify the ground threshold. | |
void | set_vegetation_threshold (T veg_threshold) |
Specify the vegetation threshold. | |
const vil_image_view< T > & | first_return () const |
Access the first returns image. | |
const vil_image_view< T > & | last_return () const |
Access the last returns image. | |
const vil_image_view< T > & | bare_earth () const |
Access the bare earth image. | |
T | first_min () const |
Access the minimum height in the first return image. | |
T | first_max () const |
Access the maximum height in the first return image. | |
T | last_min () const |
Access the minimum height in the last return image. | |
T | last_max () const |
Access the maximum height in the last return image. | |
void | label_lidar () |
Classify each pixel as Ground (0), Vegetation (1), or Building (>=2). | |
void | segment () |
Perform an initial segmentation at each pixel using thresholds. | |
void | cluster_buildings () |
Cluster pixels on buildings into groups of adjacent pixels with similar heights. | |
void | fill_ground_holes (unsigned int min_size) |
Replace small holes in buildings from ground to vegetation (unclaimed) labels. | |
void | threshold_building_area () |
Threshold buildings by area. | |
bool | dilate_buildings (unsigned int num=6) |
Dilate buildings into unclaimed (vegetation) pixel. | |
bool | greedy_merge () |
Greedy merging of adjacent buildings. | |
void | refine_buildings () |
Refine the building regions. | |
const vil_image_view< unsigned int > & | labels () const |
Access the resulting label image. | |
const vil_image_view< T > & | heights () const |
Access the resulting height image. | |
const vcl_vector< T > & | mean_heights () const |
Access the mean building heights. | |
const vcl_vector< unsigned int > & | building_area () const |
Access the building areas in pixels. | |
Private Member Functions | |
T | interpolate_parabola (T y_1, T y_0, T y_2, T &root_offset) const |
Parabolic interpolation of 3 points y_0 , y_1 , y_2 . | |
void | histogram (const vcl_vector< T > &data, vcl_vector< unsigned int > &bins, T minv, T maxv) const |
Compute a histogram of the data. | |
void | fit_gaussian_to_peak (const vcl_vector< T > &data, T minv, T maxv, T &mean, T &stdev) const |
Find the maximum peak in the data and fit a gaussian to it. | |
void | range (const vil_image_view< T > &image, T &minv, T &maxv) const |
Expand the range (minv, maxv) with the data in image. | |
bool | expand_buildings (vcl_vector< T > &means, vcl_vector< unsigned int > &sizes) |
Search for nearby pixel that can be added to each building. | |
vil_image_view< unsigned int > | bin_heights (T binsize=0.5) |
Group building pixel by height into bins of size binsize. | |
vcl_vector< bool > | close_buildings (unsigned int num_labels) |
Morphological clean up on each building independently. | |
Private Attributes | |
vil_image_view< T > | first_return_ |
first return image. | |
vil_image_view< T > | last_return_ |
last return image. | |
vil_image_view< T > | bare_earth_ |
bare earth estimate image. | |
T | hgt_stdev_ |
The estimated standard deviation of noise in height. | |
unsigned int | area_threshold_ |
A threshold on the minimum building area. | |
T | height_resolution_ |
The minimum height difference that does not merge. | |
T | gnd_threshold_ |
The minimum height above the ground for buildings. | |
T | veg_threshold_ |
The minimum distance between first and last returns for vegetation. | |
T | first_min_ |
The range spanned by the first returns. | |
T | first_max_ |
T | last_min_ |
The range spanned by the last returns. | |
T | last_max_ |
vcl_vector< T > | building_mean_hgt_ |
The mean height of each building. | |
vcl_vector< unsigned int > | building_area_ |
The area in pixels of each building. | |
vil_image_view< unsigned int > | labels_ |
computed segmentation labels. | |
vil_image_view< T > | heights_ |
clean up height estimates for use in meshing. | |
Friends | |
class | merge_map |
Definition at line 15 of file bmdl_classify.h.
bmdl_classify< T >::bmdl_classify | ( | unsigned int | area_threshold = 6 , |
T | height_resolution = 0.5 , |
||
T | gnd_threshold = 2.0 , |
||
T | veg_threshold = 1.0 |
||
) |
Constructor.
height_noise_stdev | is the standard deviation in lidar height This parameter can be set manually or estimated |
area_threshold | is the minimum area allowed for buildings |
height_resolution | is the height difference below which buildings are merged |
gnd_threshold | is the minimum height above the ground considered for buildings and vegetation |
veg_threshold | is the minimum distance between first and last returns for vegetation |
height_noise_stdev | is the standard deviation in lidar height This parameter can be set manually or estimated |
area_threshold | is the minimum area allowed for buildings |
height_resolution | is the height difference below which buildings are merged |
gnd_threshold | is the minimum height above the ground considered for buildings |
veg_threshold | is the minimum distance between first and last returns for vegetation |
Definition at line 33 of file bmdl_classify.txx.
const vil_image_view<T>& bmdl_classify< T >::bare_earth | ( | ) | const [inline] |
Access the bare earth image.
Definition at line 63 of file bmdl_classify.h.
vil_image_view< unsigned int > bmdl_classify< T >::bin_heights | ( | T | binsize = 0.5 | ) | [private] |
Group building pixel by height into bins of size binsize.
Definition at line 1082 of file bmdl_classify.txx.
const vcl_vector<unsigned int>& bmdl_classify< T >::building_area | ( | ) | const [inline] |
Access the building areas in pixels.
Definition at line 118 of file bmdl_classify.h.
vcl_vector< bool > bmdl_classify< T >::close_buildings | ( | unsigned int | num_labels | ) | [private] |
Morphological clean up on each building independently.
Definition at line 992 of file bmdl_classify.txx.
void bmdl_classify< T >::cluster_buildings | ( | ) |
Cluster pixels on buildings into groups of adjacent pixels with similar heights.
Cluster pixels on building into groups of adjacent pixels with similar heights.
Assign a new label to each groups. Returns building mean heights and pixel counts by reference
Definition at line 245 of file bmdl_classify.txx.
bool bmdl_classify< T >::dilate_buildings | ( | unsigned int | num = 6 | ) |
Dilate buildings into unclaimed (vegetation) pixel.
Only claim a vegetation pixel if surrounded by num pixels from the same building
Definition at line 879 of file bmdl_classify.txx.
T bmdl_classify< T >::estimate_bare_earth | ( | ) |
Estimate a constant bare earth model.
This function returns the constant height and also uses it to fill the bare earth image
Definition at line 80 of file bmdl_classify.txx.
T bmdl_classify< T >::estimate_height_noise_stdev | ( | ) |
Estimate the standard deviation in height due to noise.
Returns the estimate and stores it internally for later use
Definition at line 108 of file bmdl_classify.txx.
bool bmdl_classify< T >::expand_buildings | ( | vcl_vector< T > & | means, |
vcl_vector< unsigned int > & | sizes | ||
) | [private] |
Search for nearby pixel that can be added to each building.
Return true if any changes are made
Definition at line 808 of file bmdl_classify.txx.
void bmdl_classify< T >::fill_ground_holes | ( | unsigned int | min_size | ) |
Replace small holes in buildings from ground to vegetation (unclaimed) labels.
Replace small holes in buildings from ground to vegetation labels.
Holes are switch if area is less than min_size
Definition at line 407 of file bmdl_classify.txx.
T bmdl_classify< T >::first_max | ( | ) | const [inline] |
Access the maximum height in the first return image.
Definition at line 68 of file bmdl_classify.h.
T bmdl_classify< T >::first_min | ( | ) | const [inline] |
Access the minimum height in the first return image.
Definition at line 66 of file bmdl_classify.h.
const vil_image_view<T>& bmdl_classify< T >::first_return | ( | ) | const [inline] |
Access the first returns image.
Definition at line 57 of file bmdl_classify.h.
void bmdl_classify< T >::fit_gaussian_to_peak | ( | const vcl_vector< T > & | data, |
T | minv, | ||
T | maxv, | ||
T & | mean, | ||
T & | stdev | ||
) | const [private] |
Find the maximum peak in the data and fit a gaussian to it.
find a peak in the data and fit a gaussian to it.
Search in the range minv to maxv
Definition at line 739 of file bmdl_classify.txx.
bool bmdl_classify< T >::greedy_merge | ( | ) |
Greedy merging of adjacent buildings.
Definition at line 935 of file bmdl_classify.txx.
const vil_image_view<T>& bmdl_classify< T >::heights | ( | ) | const [inline] |
Access the resulting height image.
Definition at line 114 of file bmdl_classify.h.
void bmdl_classify< T >::histogram | ( | const vcl_vector< T > & | data, |
vcl_vector< unsigned int > & | bins, | ||
T | minv, | ||
T | maxv | ||
) | const [private] |
Compute a histogram of the data.
compute a histogram of the data.
Does not reset the initial bin values to zero
Definition at line 718 of file bmdl_classify.txx.
T bmdl_classify< T >::interpolate_parabola | ( | T | y_1, |
T | y_0, | ||
T | y_2, | ||
T & | root_offset | ||
) | const [private] |
Parabolic interpolation of 3 points y_0
, y_1
, y_2
.
y_peak
y_0
Definition at line 705 of file bmdl_classify.txx.
void bmdl_classify< T >::label_lidar | ( | ) |
Classify each pixel as Ground (0), Vegetation (1), or Building (>=2).
Each building is given an index sequentially starting with 2 and sorted by mean height.
Each building is given an index sequentially starting with 2 and sorted by mean height.
Definition at line 147 of file bmdl_classify.txx.
const vil_image_view<unsigned int>& bmdl_classify< T >::labels | ( | ) | const [inline] |
Access the resulting label image.
Definition at line 111 of file bmdl_classify.h.
T bmdl_classify< T >::last_max | ( | ) | const [inline] |
Access the maximum height in the last return image.
Definition at line 72 of file bmdl_classify.h.
T bmdl_classify< T >::last_min | ( | ) | const [inline] |
Access the minimum height in the last return image.
Definition at line 70 of file bmdl_classify.h.
const vil_image_view<T>& bmdl_classify< T >::last_return | ( | ) | const [inline] |
Access the last returns image.
Definition at line 60 of file bmdl_classify.h.
const vcl_vector<T>& bmdl_classify< T >::mean_heights | ( | ) | const [inline] |
Access the mean building heights.
Definition at line 116 of file bmdl_classify.h.
void bmdl_classify< T >::range | ( | const vil_image_view< T > & | image, |
T & | minv, | ||
T & | maxv | ||
) | const [private] |
Expand the range (minv, maxv) with the data in image.
Only finite values count
Definition at line 788 of file bmdl_classify.txx.
void bmdl_classify< T >::refine_buildings | ( | ) |
Refine the building regions.
Definition at line 566 of file bmdl_classify.txx.
void bmdl_classify< T >::segment | ( | ) |
Perform an initial segmentation at each pixel using thresholds.
Classify each pixel as Ground (0), Vegetation (1), or Building (2) Results are stored in the labels image
Definition at line 209 of file bmdl_classify.txx.
void bmdl_classify< T >::set_area_threshold | ( | unsigned int | area | ) | [inline] |
Specify the building area threshold.
Definition at line 50 of file bmdl_classify.h.
void bmdl_classify< T >::set_bare_earth | ( | const vil_image_view< T > & | bare_earth | ) |
Set the bare earth image.
Definition at line 68 of file bmdl_classify.txx.
void bmdl_classify< T >::set_ground_threshold | ( | T | gnd_threshold | ) | [inline] |
Specify the ground threshold.
Definition at line 52 of file bmdl_classify.h.
void bmdl_classify< T >::set_height_noise_stdev | ( | T | stdev | ) | [inline] |
Manually specify the standard deviation in lidar height from noise.
Definition at line 48 of file bmdl_classify.h.
void bmdl_classify< T >::set_lidar_data | ( | const vil_image_view< T > & | first_return, |
const vil_image_view< T > & | last_return | ||
) |
Set the first and last return images.
Definition at line 52 of file bmdl_classify.txx.
void bmdl_classify< T >::set_vegetation_threshold | ( | T | veg_threshold | ) | [inline] |
Specify the vegetation threshold.
Definition at line 54 of file bmdl_classify.h.
void bmdl_classify< T >::threshold_building_area | ( | ) |
Threshold buildings by area.
All buildings with area (in pixels) less than the threshold are removed and replace with a vegetation label.
All buildings with area (in pixels) less than the threshold are removed and replace with a vegetation label
Definition at line 532 of file bmdl_classify.txx.
friend class merge_map [friend] |
Definition at line 138 of file bmdl_classify.h.
unsigned int bmdl_classify< T >::area_threshold_ [private] |
A threshold on the minimum building area.
Definition at line 182 of file bmdl_classify.h.
vil_image_view<T> bmdl_classify< T >::bare_earth_ [private] |
bare earth estimate image.
Definition at line 177 of file bmdl_classify.h.
vcl_vector<unsigned int> bmdl_classify< T >::building_area_ [private] |
The area in pixels of each building.
Definition at line 197 of file bmdl_classify.h.
vcl_vector<T> bmdl_classify< T >::building_mean_hgt_ [private] |
The mean height of each building.
Definition at line 195 of file bmdl_classify.h.
T bmdl_classify< T >::first_max_ [private] |
Definition at line 190 of file bmdl_classify.h.
T bmdl_classify< T >::first_min_ [private] |
The range spanned by the first returns.
Definition at line 190 of file bmdl_classify.h.
vil_image_view<T> bmdl_classify< T >::first_return_ [private] |
first return image.
Definition at line 173 of file bmdl_classify.h.
T bmdl_classify< T >::gnd_threshold_ [private] |
The minimum height above the ground for buildings.
Definition at line 186 of file bmdl_classify.h.
T bmdl_classify< T >::height_resolution_ [private] |
The minimum height difference that does not merge.
Definition at line 184 of file bmdl_classify.h.
vil_image_view<T> bmdl_classify< T >::heights_ [private] |
clean up height estimates for use in meshing.
Definition at line 202 of file bmdl_classify.h.
T bmdl_classify< T >::hgt_stdev_ [private] |
The estimated standard deviation of noise in height.
Definition at line 180 of file bmdl_classify.h.
vil_image_view<unsigned int> bmdl_classify< T >::labels_ [private] |
computed segmentation labels.
Definition at line 200 of file bmdl_classify.h.
T bmdl_classify< T >::last_max_ [private] |
Definition at line 192 of file bmdl_classify.h.
T bmdl_classify< T >::last_min_ [private] |
The range spanned by the last returns.
Definition at line 192 of file bmdl_classify.h.
vil_image_view<T> bmdl_classify< T >::last_return_ [private] |
last return image.
Definition at line 175 of file bmdl_classify.h.
T bmdl_classify< T >::veg_threshold_ [private] |
The minimum distance between first and last returns for vegetation.
Definition at line 188 of file bmdl_classify.h.