MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / HatDescSearch

Function HatDescSearch

jni/stasm/hatdesc.cpp:143–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141// this function and its callees do not modify any data that is not on the stack.
142
143void HatDescSearch( // search in a grid around the current landmark
144 double& x, // io: (in: old position of landmark, out: new position)
145 double& y, // io:
146 const HatFit hatfit) // in: func to estimate descriptor match
147{
148 // If HAT_SEARCH_RESOL is 2, force x,y positions to be divisible
149 // by 2 to increase cache hit rate. This increases the mean hit rate
150 // from about 67% to 88% and barely affects landmark accuracy.
151 int ix = HAT_SEARCH_RESOL == 2? round2(x): cvRound(x);
152 int iy = HAT_SEARCH_RESOL == 2? round2(y): cvRound(y);
153
154 double fit_best = -FLT_MAX;
155
156 int xoffset_best = 0, yoffset_best = 0; // in pixels
157
158 for (int yoffset = -HAT_MAX_OFFSET;
159 yoffset <= HAT_MAX_OFFSET;
160 yoffset += HAT_SEARCH_RESOL)
161 {
162 for (int xoffset = -HAT_MAX_OFFSET;
163 xoffset <= HAT_MAX_OFFSET;
164 xoffset += HAT_SEARCH_RESOL)
165 {
166 const double fit = GetHatFit(ix + xoffset, iy + yoffset, hatfit);
167 if (fit > fit_best)
168 {
169 fit_best = fit;
170 xoffset_best = xoffset;
171 yoffset_best = yoffset;
172 }
173 }
174 }
175 x += xoffset_best;
176 y += yoffset_best;
177}
178
179} // namespace stasm

Callers 1

DescSearch_Method · 0.85

Calls 2

round2Function · 0.85
GetHatFitFunction · 0.85

Tested by

no test coverage detected