//对数变换
void Log(Mat src, Mat intermediate,int c)
{
for (int i = 0;i < src.rows;i++)
{
for (int j = 0;j < src.cols;j++)
{
int b = c*log(1+src.at
int d = b % 256;
intermediate.at
}
}
}
//幂次变换
void Power(Mat src, Mat intermediate,float gamma)
{
for (int i = 0;i < src.rows;i++)
{
for (int j = 0;j < src.cols;j++)
{
float c = pow(255, 1 - gamma);
int b = c*pow(src.at
int d = b % 256;
intermediate.at
}
}
}
//对比拉伸
void Stretch(Mat src, Mat intermediate,float r1, float s1, float r2, float s2 )
{
float k1, k2, k3, b1, b2, b3;
k1 = s1 / r1;
b1 = 0.0;
k2 = (s2 - s1) / (r2 - r1);
b2 = (s1*r2 - s2*r1) / (r2 - r1);
k3 = (255.0 - s2) / (255.0 - r2);
b3 = (255.0*s2-r2*255.0) / (255.0 - r2);
cout << b3;
for (int i = 0;i < src.rows;i++)
{
for (int j = 0;j < src.cols;j++)
{
if (src.at
{
int a = k1*src.at
int b = a % 256;
intermediate.at
}
if (src.at
{
int a = k2*src.at
int b = a % 256;
intermediate.at
}
if (src.at
{
int a = k3*src.at
int b = a % 256;
intermediate.at
}
}
}
}
评论
查看更多