Ejemplo n.º 1
0
	/**
	 * Calculate the variance of all values in the matrix
	 */
	double variance(double mn=-1) {
		double mean=0;
		if(mn == -1)
			mean = meanVal();
		else mean = mn;

		double temp=0;
		for(unsigned i=0; i<rows_; ++i)
			for(unsigned j=0; j<cols_; ++j)
				temp += (data_[cols_*i+j] - mean) * (data_[cols_*i+j] - mean);
		return ( temp/((cols_*rows_)-1) );
	}
Ejemplo n.º 2
0
void CKinectProc::BatchAngel(double *data,double *outputData,int height,int width,int channel)
{
	int lineWidth = channel * width;
	for (int i = 0; i < height; ++i)
	{
		vector<double> meanVal(channel,0);
		GetBodyCenter(data + i*lineWidth,width,channel,meanVal);
		std::cout<<"BodyNo:"<<i<<".  "<<" body center ok!"<<std::endl;
		for (int j = 0; j < width; ++j)
		{
			vector<double> val(channel,0);
			GetAngle(data + i*lineWidth + j * channel,&meanVal[0],channel,val);
			for (int k = 0; k < channel; ++k)
			{
				outputData[i*lineWidth + j * channel + k] = val[k];
			}
			//val.clear();
		}
		std::cout<<"BodyNo:"<<i<<".  "<<" Angle ok!"<<std::endl;
		//meanVal.clear(); 
	}	
}