我就是这样完成matlab中的三角函数计算的:
Mat unwrappingPhase::CvAtan2(Mat a,Mat b)
{
Mat dst = Mat::zeros(a.size(), a.type());
int rows = a.rows;
int cols = a.cols;
for ( int row = 0; row < rows; row++)
{
const floatcurrent_a = a.ptr(row);
const floatcurrent_b = b.ptr(row);
float*current_dst = dst.ptr(row);
for (int col = 0; col< cols; col++)
{
current_dst[col] = atan2f(current_a[col], current_b[col]);
}
}
return dst;
}