double norm_m(double E)
{
- return sqrt(power(E,2));
+ return sqrt(pow(E,2));
}
void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _color_boost)
double ans1 = 0.0;
for(unsigned int i =0;i<alf.size();i++)
{
- ans = ((1 + alf[i])/2) * exp((-1.0 * 0.5 * power(temp[i],2))/power(sigma,2));
- ans1 =((1 - alf[i])/2) * exp((-1.0 * 0.5 * power(temp1[i],2))/power(sigma,2));
+ ans = ((1 + alf[i])/2) * exp((-1.0 * 0.5 * pow(temp[i],2))/pow(sigma,2));
+ ans1 =((1 - alf[i])/2) * exp((-1.0 * 0.5 * pow(temp1[i],2))/pow(sigma,2));
G_pos.push_back(ans);
G_neg.push_back(ans1);
}
};
int rounding(double a);
-double power(double term, int p);
-double sqroot(double m);
int rounding(double a)
{
return int(a + 0.5);
}
-double power(double term, int p)
-{
- double res = 1.0;
- for(int i=0;i<p;i++)
- {
- res *= term;
- }
- return res;
-}
-
-double sqroot(double m)
-{
- double i=0;
- double x1,x2;
- while( (i*i) <= m )
- i+=0.1;
- x1=i;
- for(int j=0;j<10;j++)
- {
- x2=m;
- x2/=x1;
- x2+=x1;
- x2/=2;
- x1=x2;
- }
- return x2;
-}
-
float sigma = .02;
double Decolor::energyCalcu(vector <double> &Cg, vector < vector <double> > &polyGrad, vector <double> &wei)
}
for(unsigned int i=0;i<polyGrad[0].size();i++)
- P.push_back(-1.0*log(exp(-1.0*power(temp[i],2)/sigma) + exp(-1.0*power(temp1[i],2)/sigma)));
+ P.push_back(-1.0*log(exp(-1.0*pow(temp[i],2)/sigma) + exp(-1.0*pow(temp1[i],2)/sigma)));
double sum = 0.0;
for(unsigned int i=0;i<polyGrad[0].size();i++)
double res =0.0;
for(unsigned int i=0;i<ImL.size();i++)
{
- res=sqrt(power(ImL[i],2) + power(Ima[i],2) + power(Imb[i],2))/100;
+ res=sqrt(pow(ImL[i],2) + pow(Ima[i],2) + pow(Imb[i],2))/100;
Cg.push_back(res);
}
lab.release();
for(int i = 0;i<h;i++)
for(int j=0;j<w;j++)
curIm.at<float>(i,j)=
- power(red.at<float>(i,j),r)*power(green.at<float>(i,j),g)*
- power(blue.at<float>(i,j),b);
+ pow(red.at<float>(i,j),r)*pow(green.at<float>(i,j),g)*
+ pow(blue.at<float>(i,j),b);
vector <double> curGrad;
gradvector(curIm,curGrad);
add_to_vector_poly(polyGrad,curGrad);
for(int i = 0;i<h;i++)
for(int j=0;j<w;j++)
Gray.at<float>(i,j)=Gray.at<float>(i,j) +
- (float) wei[kk]*power(red.at<float>(i,j),r)*power(green.at<float>(i,j),g)*
- power(blue.at<float>(i,j),b);
+ (float) wei[kk]*pow(red.at<float>(i,j),r)*pow(green.at<float>(i,j),g)*
+ pow(blue.at<float>(i,j),b);
kk=kk+1;
}
void texture_flatten(Mat &I, Mat &mask, Mat &wmask, double low_threshold, double high_threhold, int kernel_size, Mat &final);
};
-double power(double term, int p);
-
-double power(double term, int p)
-{
- double res = 1.0;
- for(int i=0;i<p;i++)
- {
- res *= term;
- }
- return res;
-}
-
void Cloning::getGradientx( const Mat &img, Mat &gx)
{
int w = img.size().width;
{
mag.at<float>(i,j*channel+c) =
- sqrt(power(srx32.at<float>(i,j*channel+c),2) + power(sry32.at<float>(i,j*channel+c),2));
+ sqrt(pow(srx32.at<float>(i,j*channel+c),2) + pow(sry32.at<float>(i,j*channel+c),2));
}
for(int i=0;i < h; i++)
if(srx32.at<float>(i,j*channel+c) != 0)
{
srx32.at<float>(i,j*channel+c) =
- power(alpha,beta)*srx32.at<float>(i,j*channel+c)*power(mag.at<float>(i,j*channel+c),-1*beta);
+ pow(alpha,beta)*srx32.at<float>(i,j*channel+c)*pow(mag.at<float>(i,j*channel+c),-1*beta);
sry32.at<float>(i,j*channel+c) =
- power(alpha,beta)*sry32.at<float>(i,j*channel+c)*power(mag.at<float>(i,j*channel+c),-1*beta);
+ pow(alpha,beta)*sry32.at<float>(i,j*channel+c)*pow(mag.at<float>(i,j*channel+c),-1*beta);
}
}