Il seguente codice elabora i frame di una videocamera ad alta risoluzione.
C'è qualcuno che mi spiega riga per riga il codice:

codice:
 __declspec(dllexport) void pcBuildProfiles(unsigned char * pImage,int iWidth, int iHeight,int iWidthStep, int iLaserOrientation,int threshold, float * fvCentroids,float * fvWeights,int iVectorDim)
  {
		unsigned int *ivCentr;
		unsigned int *ivWeight;
		unsigned int *ivCentrRun;
		unsigned int *ivWeightRun;

		CleanVector(fvCentroids,iVectorDim);
		CleanVector(fvWeights,iVectorDim);
        ivCentr =(unsigned int *)malloc(iVectorDim*sizeof(unsigned int));
        ivWeight =(unsigned int *)malloc(iVectorDim*sizeof(float));
		memset(ivCentr,0,iVectorDim*sizeof(unsigned int));
		memset(ivWeight,0,iVectorDim*sizeof(unsigned int));

		
            int x;
            int y;
            unsigned char * pPixel;
            unsigned char Pixel;

			ivCentrRun=ivCentr;
			ivWeightRun=ivWeight;

            for (y = 0; y < iHeight; y++)
            {
				pPixel= pImage;
                pPixel +=iWidthStep* y;
                for (x = 0; x < iWidth; x++, pPixel++)
                {
                    Pixel = *pPixel;
                    if (Pixel > threshold)
                    {
                        Pixel -= threshold;
                        *ivCentrRun += (Pixel * x);
                        *ivWeightRun +=  Pixel;
                    }
                }
                if (ivWeightRun > 0)
                {
                    fvCentroids[y] = (float)*ivCentrRun/ *ivWeightRun;
                    fvWeights[y] = (float)*ivWeightRun;
                }
				ivCentrRun++;
				ivWeightRun++;
            }
        }     
		free(ivCentr);
		free(ivWeight);
  }