Exemplo n.º 1
0
void test_ring (Args & args)
{
  const size_t dim = args.pop(10);
  const size_t radius = 2;
  const size_t degree = radius + 1 + radius;

  Vector<uint16_t> nbhd(dim * degree);
  Vector<float> Pxx(dim * degree);
  Vector<float> Pxy(dim * degree);
  Vector<float> Fxy(dim * degree);

  for (size_t i = 0; i < dim; ++i) {
    for (size_t n = 0; n < degree; ++n) {
      size_t knn_pos = degree * i + n;

      float dx = n - 2.0f;

      nbhd[knn_pos] = (i + dim + n - radius) % dim;
      Pxx[knn_pos] = expf(-sqr(dx));
      Pxy[knn_pos] = expf(-sqr(dx - 0.5) / 2);
    }
  }

  PRINT_MAT(dim, degree, Pxx);
  PRINT_MAT(dim, degree, Pxy);

  LinAlg::sparse_symmetric_solve(dim, degree, nbhd, Pxx, Pxy, Fxy);

  PRINT_MAT(dim, degree, Fxy);
}
Exemplo n.º 2
0
Mat makePxy(const vector<Mat>& P, int x, int y, config_SystemParameter *param){
	CV_Assert( x>=0 && y>=0 && x<P[0].cols && y<P[0].rows);
	
	Mat Pxy(param->numFeature,1,CV_64F);
	
	for(int i = 0; i <param->numFeature; i++){
		double* Pxyi = Pxy.ptr<double>(i);
		Pxyi[0] = P[i].at<double>(y,x);
	}
	return Pxy;
}