#include <sdet_edgel_regions.h>
Definition at line 60 of file sdet_edgel_regions.h.
Public Types | |
| enum | RegionLabel { UNLABELED = 0, EDGE, LABEL } |
Public Member Functions | |
| sdet_edgel_regions (int array_scale=2, bool verbose=false, bool debug=false) | |
| ~sdet_edgel_regions () | |
| bool | compute_edgel_regions (vil1_image const &image, vcl_vector< vtol_edge_2d_sptr > &sgrp, vcl_vector< vtol_intensity_face_sptr > &faces) |
| The key process loop. | |
| bool | compute_edgel_regions (vil_image_resource_sptr const &image, vcl_vector< vtol_edge_2d_sptr > &sgrp, vcl_vector< vtol_intensity_face_sptr > &faces) |
| bool | compute_edgel_regions (gevd_bufferxy *buf, vcl_vector< vtol_edge_2d_sptr > &sgrp, vcl_vector< vtol_intensity_face_sptr > &faces) |
| void | SetVerbose () |
| void | ClearVerbose () |
| void | SetDebug () |
| void | ClearDebug () |
| unsigned int | BaseLabel (unsigned int label) |
| Get the most basic label equivalent to a given label. | |
| unsigned int | GetMaxRegionLabel () const |
| void | SetMaxRegionLabel (unsigned int label) |
| vbl_array_2d< unsigned int > const & | GetRegionArray () const |
| int | GetXSize () const |
| int | GetYSize () const |
| vil1_image | GetEdgeImage (vcl_vector< vtol_edge_2d_sptr > &edgels) |
| Return label image (255/0) indicating edgels. | |
| bool | InsertRegionEquivalence (unsigned int label_b, unsigned int label_a) |
| assign equivalence of region label b to region label a. | |
| void | GrowEquivalenceClasses () |
| Form equivalence classes by transitive closure on each label. | |
| void | PropagateEquivalence () |
| Populate the label_map_ to reflect the equivalences between labels. | |
| unsigned int | GetLabel (vtol_edge_2d_sptr e, unsigned int nr) const |
| Get the a region label for an edge used to construct the boundaries. | |
| void | print_region_array () |
| Print the region label array. | |
| void | print_region_equivalence () |
| Print the contents of the forward equivalence index. | |
| void | print_reverse_region_equivalence () |
| Print the contents of the reverse equivalence index. | |
| void | print_base_equivalence () |
| Print the reduced equivalence relation. | |
| void | print_intensity_data () |
| Print the fitted intensity data for all faces. | |
Protected Member Functions | |
| bool | GroupContainsEdges (vcl_vector< vtol_edge_2d_sptr > &sg) |
| Check if the vtol_edge list sg (spatial group) contains edge(s) - NYI. | |
| bool | InitRegionArray (vcl_vector< vtol_edge_2d_sptr > &sg) |
| Initialize the region label array. | |
| unsigned char | label_code (unsigned int label) |
| Get code for a given label. | |
| bool | add_to_forward (unsigned int key, unsigned int value) |
| Add a new pair to the forward equivalence list. | |
| bool | add_to_reverse (unsigned int key, unsigned int value) |
| Add a new pair to the reverse equivalence list. | |
| unsigned char | EncodeNeighborhood (unsigned int ul, unsigned int ur, unsigned int ll, unsigned int lr) |
| Encode a 2x2 neighborhood with the state of the region array for a given location. | |
| void | UpdateConnectedNeighborhood (unsigned int x, unsigned int y) |
| Propagate connected components. | |
| void | AssignEdgeLabels (unsigned int x, unsigned int y) |
| After connected components have been generated pass over the array and assign region labels to the sdet_region_edge(s). | |
| void | ApplyRegionEquivalence () |
| Scan the region_label_array_ and apply the region equivalence map. | |
| bool | out_of_bounds (unsigned int x, unsigned int y) |
| Bounds check on region_label_array_. | |
| void | insert_adjacency (unsigned int region, vtol_edge_2d_sptr e) |
| Insert an Edge into the adjacency list for a region. | |
| void | CollectEdges () |
| Get the edges adjacent to each region. | |
| void | CollectFaceEdges () |
| Trace through the topology network keeping regions on the left. | |
| void | ConstructFaces () |
| Construct face(s) from edge(s) in the face_edge_index_ array. | |
| void | AccumulateMeans () |
| Accumulate intensity statistics from each region and update the vtol_intensity_face parameters. | |
| void | AccumulateRegionData () |
| Insert region pixels into the vtol_intensity_face arrays. | |
| void | InsertFaceData () |
| Do both a scatter matrix update and insertion into the region pixel arrays of each intensity face. | |
| unsigned int | X (unsigned int x) |
| The region array can be offset from the corner of the ROI. | |
| unsigned int | Y (unsigned int y) |
| The region array can be offset from the corner of the ROI. | |
| float | Xf (float x) |
| Transforms the image x coordinate to the array coordinate with a scale factor. | |
| float | Yf (float y) |
| bool | insert_edgel (float pre_x, float pre_y, float x, float y, sdet_region_edge_sptr const &e) |
| A utility for inserting an edgel into the region_label_array_. | |
| void | insert_equivalence (unsigned int ll, unsigned int ur, unsigned int &lr) |
| This is the fundamental assignment of label equivalence. | |
| bool | merge_equivalence (vcl_map< unsigned int, vcl_vector< unsigned int > * > &tab, unsigned int cur_label, unsigned int label) |
| Find the set of labels equivalent to label from a given hash table and merge into equivalence_set_. | |
| bool | get_next_label (vcl_vector< unsigned int > *labels, unsigned int &label) |
| Find the next label not accounted for in the current equivalence set. | |
| void | print_edge_colis (unsigned int x, unsigned int y, sdet_region_edge_sptr const &r1, sdet_region_edge_sptr const &r2) |
| A collision is defined by the condition where an region is bounded by two different edges at adjacent pixels without crossing a vertex. | |
| bool | remove_hairs (vcl_vector< vtol_edge_2d_sptr > &edges) |
| Remove hairs from region boundary. | |
| void | get_buffer_row (unsigned int row) |
| get a row from a BufferXY. | |
| void | get_image_row (unsigned int row) |
| Get an image row. | |
| unsigned short | get_intensity (unsigned int x) |
| Get the intensity of a single pixel. | |
| int | bytes_per_pix () |
| bool | compute_edgel_regions (vcl_vector< vtol_edge_2d_sptr > &sgrp, vcl_vector< vtol_intensity_face_sptr > &faces) |
Protected Attributes | |
| bool | verbose_ |
| bool | debug_ |
| bool | image_source_ |
| bool | buf_source_ |
| int | s_ |
| vil1_image | image_ |
| gevd_bufferxy * | buf_ |
| vbl_array_2d< sdet_region_edge_sptr > | edge_boundary_array_ |
| vbl_array_2d< unsigned int > | region_label_array_ |
| unsigned int | min_region_label_ |
| unsigned int | max_region_label_ |
| float | Xob_ |
| float | Yob_ |
| unsigned int | xo_ |
| unsigned int | yo_ |
| unsigned int | xend_ |
| unsigned int | yend_ |
| unsigned int | xs_ |
| unsigned int | ys_ |
| vcl_map< unsigned int, vcl_vector< unsigned int > * > | region_pairs_forward_ |
| vcl_map< unsigned int, vcl_vector< unsigned int > * > | region_pairs_reverse_ |
| vcl_map< unsigned int, vcl_vector< unsigned int > * > | equivalence_set_ |
| vcl_map< unsigned int, unsigned int > | label_map_ |
| vcl_map< int, sdet_region_edge_sptr > | region_edges_ |
| vcl_map< unsigned int, vcl_vector< vtol_edge_2d_sptr > * > | region_edge_adjacency_ |
| vcl_vector< vtol_intensity_face_sptr > * | faces_ |
| vtol_intensity_face_sptr * | intensity_face_index_ |
| vcl_vector< vtol_edge_2d_sptr > ** | face_edge_index_ |
| vcl_vector< vtol_edge_2d_sptr > * | failed_insertions_ |
| unsigned char * | ubuf_ |
| unsigned short * | sbuf_ |
|
|
Definition at line 63 of file sdet_edgel_regions.h. |
|
||||||||||||||||
|
Definition at line 182 of file sdet_edgel_regions.cxx. |
|
|
Definition at line 212 of file sdet_edgel_regions.cxx. |
|
|
Accumulate intensity statistics from each region and update the vtol_intensity_face parameters.
Definition at line 1738 of file sdet_edgel_regions.cxx. |
|
|
Insert region pixels into the vtol_intensity_face arrays.
Definition at line 1784 of file sdet_edgel_regions.cxx. |
|
||||||||||||
|
Add a new pair to the forward equivalence list. That is, a ==> b. Note that there can be multiple equivalences which are stored in a vcl_vector Definition at line 879 of file sdet_edgel_regions.cxx. |
|
||||||||||||
|
Add a new pair to the reverse equivalence list. That is, b==>a. Note that there can be multiple equivalences which are stored in a vcl_vector Definition at line 912 of file sdet_edgel_regions.cxx. |
|
|
Scan the region_label_array_ and apply the region equivalence map. The result is that all equivalences are reconciled with the smallest labels. Definition at line 1458 of file sdet_edgel_regions.cxx. |
|
||||||||||||
|
After connected components have been generated pass over the array and assign region labels to the sdet_region_edge(s). As in UpdateConnectedNeighborhood, the algorithm uses a 2x2 neigborhood E.G., ee But the purpose is to assign labels. No updating of the aa region_label_array_ is carried out. Note that the 2x2 neighborhood is encoded as uchar = [ul|ur|ll|lr] 2 2 2 2 bits Definition at line 1313 of file sdet_edgel_regions.cxx. |
|
|
Get the most basic label equivalent to a given label. If the label_map_ is not defined, this function uses the forward label hash table. Otherwise 0 is returned. Definition at line 416 of file sdet_edgel_regions.cxx. |
|
|
Definition at line 714 of file sdet_edgel_regions.cxx. |
|
|
Definition at line 85 of file sdet_edgel_regions.h. |
|
|
Definition at line 83 of file sdet_edgel_regions.h. |
|
|
Get the edges adjacent to each region.
Definition at line 1513 of file sdet_edgel_regions.cxx. |
|
|
Trace through the topology network keeping regions on the left. At this point, we have a list of edges for each region. We will trace out the list and form OneCycle(s). Then the set of OneCycle(s) will form the boundary of the face corresponding to the region. Definition at line 1542 of file sdet_edgel_regions.cxx. |
|
||||||||||||
|
Definition at line 317 of file sdet_edgel_regions.cxx. |
|
||||||||||||||||
|
Definition at line 251 of file sdet_edgel_regions.cxx. |
|
||||||||||||||||
|
Definition at line 293 of file sdet_edgel_regions.cxx. |
|
||||||||||||||||
|
The key process loop. Carries out the steps:
Definition at line 270 of file sdet_edgel_regions.cxx. |
|
|
Construct face(s) from edge(s) in the face_edge_index_ array. This method has been made virtual so that sub-classes of vtol_intensity_face can be constructed by sub-classes of sdet_edgel_regions. Definition at line 1621 of file sdet_edgel_regions.cxx. |
|
||||||||||||||||||||
|
Encode a 2x2 neighborhood with the state of the region array for a given location.
The Neighborhood The states are:
ul ur UNLABELED, EDGE, LABEL
ll lr 0 1 2
Definition at line 951 of file sdet_edgel_regions.cxx. |
|
|
get a row from a BufferXY.
Definition at line 1674 of file sdet_edgel_regions.cxx. |
|
|
Get an image row.
Definition at line 1698 of file sdet_edgel_regions.cxx. |
|
|
Get the intensity of a single pixel.
Definition at line 1719 of file sdet_edgel_regions.cxx. |
|
||||||||||||
|
Find the next label not accounted for in the current equivalence set. The set of labels is searched to find a label larger than label, but not in the set, labels. Definition at line 533 of file sdet_edgel_regions.cxx. |
|
|
Return label image (255/0) indicating edgels. Paint the edgels into the region label array and then output an image where the value is 255 if the pixel is an edge, 0 otherwise Definition at line 431 of file sdet_edgel_regions.cxx. |
|
||||||||||||
|
Get the a region label for an edge used to construct the boundaries. A return corresponding to UNLABELED means the domain outside the ROI or nr is larger than the number of adjacent regions. Definition at line 1485 of file sdet_edgel_regions.cxx. |
|
|
Definition at line 90 of file sdet_edgel_regions.h. |
|
|
Definition at line 92 of file sdet_edgel_regions.h. |
|
|
Definition at line 93 of file sdet_edgel_regions.h. |
|
|
Definition at line 94 of file sdet_edgel_regions.h. |
|
|
Check if the vtol_edge list sg (spatial group) contains edge(s) - NYI.
Definition at line 655 of file sdet_edgel_regions.cxx. |
|
|
Form equivalence classes by transitive closure on each label. The resulting label equivalence is stored in the map, equivalence_set_. The idea is to add labels to the current equivalence set, cur_set, from either forward or reverse equivalence classes until no new equivalences can be found. The current equivalence class, cur_set, is repeatedly scanned when new labels are added to pick up new equivalence groups. Old equivalence entries are removed from forward and reverse forward and reverse equivalence maps as they are used. When the cur_set is completely closed, i.e. no new labels can be added, then a new label not in cur_set is used to seed a new equivalence class. Definition at line 575 of file sdet_edgel_regions.cxx. |
|
|
Initialize the region label array. There are three types of region label symbols:
Definition at line 734 of file sdet_edgel_regions.cxx. |
|
||||||||||||
|
Insert an Edge into the adjacency list for a region.
Definition at line 1495 of file sdet_edgel_regions.cxx. |
|
||||||||||||||||||||||||
|
A utility for inserting an edgel into the region_label_array_. An edgel and a previous edgel in the chain are used to interpolate intermediate edgels to take account of pixel quantization Definition at line 670 of file sdet_edgel_regions.cxx. |
|
||||||||||||||||
|
This is the fundamental assignment of label equivalence.
Definition at line 976 of file sdet_edgel_regions.cxx. |
|
|
Do both a scatter matrix update and insertion into the region pixel arrays of each intensity face. AccumulateScatterData is done first so that the number of pixels can be determined. Definition at line 1823 of file sdet_edgel_regions.cxx. |
|
||||||||||||
|
assign equivalence of region label b to region label a.
Definition at line 403 of file sdet_edgel_regions.cxx. |
|
|
Get code for a given label.
Definition at line 865 of file sdet_edgel_regions.cxx. |
|
||||||||||||||||
|
Find the set of labels equivalent to label from a given hash table and merge into equivalence_set_. cur_label is the equivalence set being formed. label is the table key of equivalences to be merged. The labels equivalent to label are in the input map, tab. Definition at line 473 of file sdet_edgel_regions.cxx. |
|
||||||||||||
|
Bounds check on region_label_array_.
Definition at line 1476 of file sdet_edgel_regions.cxx. |
|
|
Print the reduced equivalence relation.
Definition at line 126 of file sdet_edgel_regions.cxx. |
|
||||||||||||||||||||
|
A collision is defined by the condition where an region is bounded by two different edges at adjacent pixels without crossing a vertex. This can happen since boundary positions are sub-pixel and region definition is at pixel granularity. The edge collison causes a needed edge to be superseeded. Definition at line 1201 of file sdet_edgel_regions.cxx. |
|
|
Print the fitted intensity data for all faces.
Definition at line 136 of file sdet_edgel_regions.cxx. |
|
|
Print the region label array.
Definition at line 64 of file sdet_edgel_regions.cxx. |
|
|
Print the contents of the forward equivalence index.
Definition at line 82 of file sdet_edgel_regions.cxx. |
|
|
Print the contents of the reverse equivalence index.
Definition at line 104 of file sdet_edgel_regions.cxx. |
|
|
Populate the label_map_ to reflect the equivalences between labels.
Definition at line 449 of file sdet_edgel_regions.cxx. |
|
|
Remove hairs from region boundary. This condition can occur because the region labels are not sub-pixel. A "hair" is an extra edge joined at a vertex which is part of a continuous chain. Unattached vertices are detected by incrementing a count at each vertex for each attached edge in the input array, "edges". Such hairs are removed from the input array. Definition at line 1253 of file sdet_edgel_regions.cxx. |
|
|
Definition at line 84 of file sdet_edgel_regions.h. |
|
|
Definition at line 91 of file sdet_edgel_regions.h. |
|
|
Definition at line 82 of file sdet_edgel_regions.h. |
|
||||||||||||
|
Propagate connected components. Uses an unsigned char encoding a 2x2 neighborhood to propagate region labels. For example: aa -> aa
xx -> aa
Note that the 2x2 neighborhood is encoded as uchar = [ul|ur|ll|lr] 2 2 2 2 bits Definition at line 1006 of file sdet_edgel_regions.cxx. |
|
|
The region array can be offset from the corner of the ROI. This method transforms from the ROI coordinate system to the region label array coordinate system. Definition at line 151 of file sdet_edgel_regions.cxx. |
|
|
Transforms the image x coordinate to the array coordinate with a scale factor.
Definition at line 166 of file sdet_edgel_regions.cxx. |
|
|
The region array can be offset from the corner of the ROI. This method transforms from the ROI coordinate system to the region label array coordinate system. Definition at line 159 of file sdet_edgel_regions.cxx. |
|
|
Definition at line 174 of file sdet_edgel_regions.cxx. |
|
|
Definition at line 165 of file sdet_edgel_regions.h. |
|
|
Definition at line 162 of file sdet_edgel_regions.h. |
|
|
Definition at line 160 of file sdet_edgel_regions.h. |
|
|
Definition at line 166 of file sdet_edgel_regions.h. |
|
|
Definition at line 181 of file sdet_edgel_regions.h. |
|
|
Definition at line 189 of file sdet_edgel_regions.h. |
|
|
Definition at line 187 of file sdet_edgel_regions.h. |
|
|
Definition at line 190 of file sdet_edgel_regions.h. |
|
|
Definition at line 164 of file sdet_edgel_regions.h. |
|
|
Definition at line 161 of file sdet_edgel_regions.h. |
|
|
Definition at line 188 of file sdet_edgel_regions.h. |
|