# Can't compute power of float point [closed]

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);
}
```

you got i and j reversed here:

filter.at<float>(i,j)=1/(1+d_fin); // should be filter.at<float>(j,i)

oh wait, you don't need pow for a simple euclidean distance, do you ? and then if you remove the sqrt, you already saved a power of two later