MCPcopy Create free account
hub / github.com/creatale/node-dv / magnitude

Function magnitude

deps/opencv/modules/core/src/mathfuncs.cpp:354–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352\****************************************************************************************/
353
354void magnitude( InputArray src1, InputArray src2, OutputArray dst )
355{
356 Mat X = src1.getMat(), Y = src2.getMat();
357 int type = X.type(), depth = X.depth(), cn = X.channels();
358 CV_Assert( X.size == Y.size && type == Y.type() && (depth == CV_32F || depth == CV_64F));
359 dst.create(X.dims, X.size, X.type());
360 Mat Mag = dst.getMat();
361
362 const Mat* arrays[] = {&X, &Y, &Mag, 0};
363 uchar* ptrs[3];
364 NAryMatIterator it(arrays, ptrs);
365 int len = (int)it.size*cn;
366
367 for( size_t i = 0; i < it.nplanes; i++, ++it )
368 {
369 if( depth == CV_32F )
370 {
371 const float *x = (const float*)ptrs[0], *y = (const float*)ptrs[1];
372 float *mag = (float*)ptrs[2];
373 Magnitude_32f( x, y, mag, len );
374 }
375 else
376 {
377 const double *x = (const double*)ptrs[0], *y = (const double*)ptrs[1];
378 double *mag = (double*)ptrs[2];
379 Magnitude_64f( x, y, mag, len );
380 }
381 }
382}
383
384
385void phase( InputArray src1, InputArray src2, OutputArray dst, bool angleInDegrees )

Callers 1

cvCartToPolarFunction · 0.85

Calls 7

Magnitude_32fFunction · 0.85
Magnitude_64fFunction · 0.85
getMatMethod · 0.45
typeMethod · 0.45
depthMethod · 0.45
channelsMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected