Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

## Center of Gravity - Image Processing

Beginner
1,162 Views
Hello there,

I'm new with IPP and I'm looking for a simple way to calculate the center of gravity of an image.
At the moment I'm using:

IppStatus ippiMoments64s_(const Ipp8u* pSrc, int srcStep, IppiSize roiSize, IppiMomentState_64s* pState);
and
IppStatus ippiGetSpatialMoment_64s(const IppiMomentState_64s* pState, int mOrd, int nOrd, int nChannel, IppiPoint roiOffset, Ipp64s* pValue, int scaleFactor);

as decriped in the ipp manual 11-47 p.774 to get the center of gravity in x and y.

This costs me 144us on a Core2Duo 2,15Mhz and 850us on an Atom 1,6Ghz.

Is there a faster way to calculate the center of gravity? My feeling is that a simple for-loop is already faster than calculation all the moments.

Thanks
Trucki
5 Replies
Employee
1,162 Views

Hi Trucki,

It seems yes, to calculte the center of gravity, the simple for-loop may faster than calculation all the moments.
oruse some ofipp function combinations, for exmaple,
M(0,0)=ippisum();
M(1,0)=ippiDotProd (pSrc, X Coordinate matrix)
M(0,1)=ippiDotProd (PSrc, y Coordinate matrix)

Would you like submit this as a feature request, for example ippiGetCenterGravity()?

Regards,
Ying

Employee
1,162 Views
It looks like you might be interested to try DMIP (Defered Mode Image Processing) layer we built on top of IPP which help in creation processing pipeline consisting from several IPP calls.

Beginner
1,162 Views
Hi,

I'm going to test ippisum and ippidotprod.
I don't think, that I will need a COG-Funktion in the next ipp lib, because I have to find a solution now.

What is DMIP? Do you have a link?

Trucki
Employee
1,162 Views

Trucki,

DMIP is a parallel processing layer we built on top of IPP. It is available as IPP sample (separate download).

Regards,