MCPcopy Create free account
hub / github.com/davisking/dlib / mean_aspect_ratio

Function mean_aspect_ratio

tools/imglab/src/cluster.cpp:136–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134// ----------------------------------------------------------------------------------------
135
136double mean_aspect_ratio (
137 const image_dataset_metadata::dataset& data
138)
139{
140 double sum = 0;
141 double cnt = 0;
142 for (unsigned long i = 0; i < data.images.size(); ++i)
143 {
144 for (unsigned long j = 0; j < data.images[i].boxes.size(); ++j)
145 {
146 rectangle rect = data.images[i].boxes[j].rect;
147 if (rect.area() == 0 || data.images[i].boxes[j].ignore)
148 continue;
149 sum += rect.width()/(double)rect.height();
150 ++cnt;
151 }
152 }
153
154 if (cnt != 0)
155 return sum/cnt;
156 else
157 return 0;
158}
159
160// ----------------------------------------------------------------------------------------
161

Callers 1

cluster_datasetFunction · 0.85

Calls 4

sizeMethod · 0.45
areaMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected