OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Wed, 25 Sep 2013 15:17:14 -0500Can't compute power of float pointhttp://answers.opencv.org/question/21359/cant-compute-power-of-float-point/Hi,
i have a Mat<float> image. After making the fourier spectrum of the image i have to apply a Butterworth filter of equation:
H(u,v)=1/(1+[D(u,v)/250]⁴) where
D(u,v)=[(u-(image.col/2)²)+(v-(image.row/2)²))]^0.5
as you can see there are many power function in the image. My image is a Mat_<float>, so i suppose that the result of each computation should be a float, so i can change each pixel of the image with the result of the equation. Unfortuntely my code seems not to work , i have problems with the function pow..seems to work only for certain type..
here is my code
Mat_<float> filter;
moon_spectrum.copyTo(filter);//giving the same dimentions
for (int i=0;i<filter.cols;i++)
{
for (int j=0;j<filter.rows;j++)
{
float d_x=pow((i-filter.cols),2);
float d_y=pow((j-filter.rows),2);
float d=pow((d_x+d_y),2);
float d_fin=pow((d/250),4);
filter.at<float>(i,j)=1/(1+d_fin);
}
GiulSDUWed, 25 Sep 2013 15:17:14 -0500http://answers.opencv.org/question/21359/cv::sqrt() and cv::pow() throwing exceptionshttp://answers.opencv.org/question/3070/cvsqrt-and-cvpow-throwing-exceptions/Hi, i've got a strange problem. I can't use sqrt() or pow() with power value <1.0, i'm just getting exceptions. Using pow() with any power value >= 1.0 works with no problems. Anybody have any idea what's wrong? (OpenCV 2.4.9, MS VS 2010)luko28Thu, 11 Oct 2012 04:55:47 -0500http://answers.opencv.org/question/3070/