http://www.opencv.org.cn/forum/viewtopic.php?t=2143
OpenCv 里边很多函数以IplImage类型作为参数, VB传递有困难,
建议对OpenCV的函数用自己编写的DLL进行封装一下, 把VB传递
过来的图像数据(byte)传递给自己的dll, 在自己的dll函数头部把数据
格式转化成IplImage, 然后调用Opencv的函数.
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*) ((*im