void _stdcall cvCenterOfGravity(LPSAFEARRAY FAR *image_in, unsigned short Bmp_Width, unsigned short Bmp_Height)
{
long lElements; HRESULT lResult; // return code for OLE functions
Color_RGB *pArray_in; // pointer to the elements of the array
// how many elements are there in the array
// lElements=(*image_in)->rgsabound->cElements;
lElements=Bmp_Width*Bmp_Height;
// locking the array before using its elements
lResult=SafeArrayLock(*image_in);
// using the array
pArray_in=(Color_RGB*) ((*image_in)->pvData);
IplImage *src=cvCreateImage( cvSize(Bmp_Width,Bmp_Height), IPL_DEPTH_8U, 3 );
memcpy(src->imageData,pArray_in ,lElements*3);
lResult=SafeArrayUnlock(*image_in);