MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / GoldGeneratePyramids

Function GoldGeneratePyramids

tests/cvcuda/system/TestOpSIFT.cpp:201–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201inline void GoldGeneratePyramids(RawPyramidType &dstGaussianPyramid, RawPyramidType &dstDoGPyramid, long3 &baseStrides,
202 long3 &baseShape, int &numOctaves, const RawBufferType &srcVec,
203 const long3 &srcStrides, const long3 &srcShape, bool expandInput, float initSigma,
204 int numOctaveLayers)
205{
206 baseShape = expandInput ? long3{srcShape.x, srcShape.y * 2, srcShape.z * 2} : srcShape;
207
208 numOctaves = GoldNumberOfOctaves(baseShape.z, baseShape.y);
209
210 baseStrides = GoldStrides(baseShape);
211
212 RawBufferType srcBase(baseShape.x * baseStrides.x);
213
214 GoldCopy<WT, VT>(srcBase, baseStrides, baseShape, srcVec, srcStrides, srcShape);
215
216 std::vector<float> layerSigmas(numOctaveLayers + 3);
217
218 GoldGaussianSigmas(layerSigmas, initSigma, numOctaveLayers);
219
220 RawBufferType srcGaussBase(baseShape.x * baseStrides.x);
221
222 int srcScale = expandInput ? 4 : 1;
223 float sigma = layerSigmas[0];
224
225 sigma = std::sqrt(std::max(sigma * sigma - kPrevSigma * kPrevSigma * srcScale, kMinSigma));
226
227 double2 sigma2{sigma, sigma};
228
229 int2 kernelAnchor{-1, -1};
230 nvcv::Size2D kernelSize = GoldKernelSize(sigma);
231 std::vector<float> kernel = test::ComputeGaussianKernel(kernelSize, sigma2);
232
233 long3 currShape = baseShape;
234 long3 currStrides = baseStrides;
235 long3 prevShape = currShape;
236 long3 prevStrides = currStrides;
237
238 test::Convolve(srcGaussBase, baseStrides, srcBase, baseStrides, ConvolveShape(currShape), kWorkFormat, kernel,
239 kernelSize, kernelAnchor, kBorderGauss, kBorderValues);
240
241 dstGaussianPyramid.resize(numOctaves);
242 dstDoGPyramid.resize(numOctaves);
243
244 for (int octave = 0; octave < numOctaves; octave++)
245 {
246 dstGaussianPyramid[octave].resize(numOctaveLayers + 3);
247 dstDoGPyramid[octave].resize(numOctaveLayers + 2);
248
249 dstGaussianPyramid[octave][0].resize(currShape.x * currStrides.x);
250
251 if (octave > 0)
252 GoldCopy<WT, WT>(dstGaussianPyramid[octave][0], currStrides, currShape,
253 dstGaussianPyramid[octave - 1][numOctaveLayers], prevStrides, prevShape);
254 else
255 GoldCopy<WT, WT>(dstGaussianPyramid[octave][0], currStrides, currShape, srcGaussBase, prevStrides,
256 prevShape);
257
258 for (int layer = 1; layer < numOctaveLayers + 3; layer++)

Callers 1

GoldSIFTFunction · 0.85

Calls 9

GoldNumberOfOctavesFunction · 0.85
GoldStridesFunction · 0.85
GoldGaussianSigmasFunction · 0.85
sqrtFunction · 0.85
GoldKernelSizeFunction · 0.85
ComputeGaussianKernelFunction · 0.85
ConvolveFunction · 0.85
ConvolveShapeFunction · 0.85
resizeMethod · 0.45

Tested by

no test coverage detected