//可以构造无名对象赋值给d = complex <double>(3.14,-2);
In fact now I am writing code about Gradient information of one image. Then the gradient have module and orientation, so I set the real of complex is X difference, imag is Y difference. Then the absolute is module, the argment is angle.
itemp1 = pImage[i*iWid+j+2] - pImage[i*iWid+j-2];
itemp0 = pImage[i*iWid+iWid+j] - pImage[i*iWid-iWid+j];
m_pGradient[i*iWid+j] = complex<double>::complex((double)itemp0,(double)itemp1);
so:
m(x,y) = abs(m_pGradient[y*m_ImgWid+x]);
θ(x,y) =arg(m_pGradient[y*m_imgWid+x]);