Mat 数据元素进行 sum mean 运算 与opecv 库函数进行对比


opencv 库函数  sum 、 mean 调用 ,,自己写的函数 返回 为 0 

  double Cbsum = 0.0, Cbmean = 0.0, Cbvar = 0.0, Crsum = 0.0, Crmean = 0.0, Crvar = 0.0;
  sumMat(Cb, Cbsum, Cbmean);
  sumMat(Cr, Crsum, Crmean);

  varMat(Cb, Cbmean, Cbvar);
  varMat(Cr, Crmean, Crvar);
  
  // opencv库函数
  Scalar Cbsum2 = sum(Cb);
  Scalar Crsum2 = sum(Cr);
  Scalar Cbmean2 = mean(Cb);
  Scalar Crmean2 = mean(Cr);
  cout << "sum:" << endl << Cbsum << "---" << Cbsum2 << endl;
  cout << "mean:" << endl << Cbmean << "---" << Cbmean2 << endl;






你可能感兴趣的:(c++)