#include
#include
#include
#include
#include // Gaussian Blur
#include
#include
#include "JPEGQ.h"
using namespace cv;
using namespace std;
Mat dojob(Mat &img);
int main()
{
char filename[100];
double threshold = 7.7;
int num = 13;
for (int a = 7; a < num; a++){
sprintf(filename, "test2018/test%d.jpg", a);
cout << a << "=================" << filename << endl;
Mat x1 = imread(filename, IMREAD_GRAYSCALE);
//imshow("image", x1);
int M = x1.rows;
int N = x1.cols;
cout << "height :" << M << " " << " width :" << N << endl;
//Mat x;
//x1.convertTo(x, CV_64F);//转换成浮点运算
//JPEGQ *jpegq = new JPEGQ();
//jpegq->h_feature(x, M, N);
//jpegq->v_feature(x, M, N);
//jpegq->combine_feature();
//double score = jpegq->qual_predict();
//if (score(Point(i, j)) = q;
}
}
t.copyTo(t1);
t2 = dojob(x1);
Size s2(t2.cols / 4, t2.rows / 4);
resize(t2, t, s2);
for (i = 0; i(Point(i, j)) = q;
}
t.copyTo(t2);
t3 = dojob(x1);
Size s3(t3.cols / 2, t3.rows / 2);
resize(t3, t, s3);
for (i = 0; i(Point(i, j)) = q;
}
t.copyTo(t3);
imshow("w1",t1);
imshow("w2",t2);
imshow("w3",t3);
//waitKey(0);
//Time to check
//cout<(Point(i, j)) * 255;
q = t2.at(Point(i, j)) * 255;
r = t3.at(Point(i, j)) * 255;
if (p<30 && q<30 && r<30) continue;
// cerr<<"Edge detected"<q && q>r)da++;
if (pp && q>r)gr++;
if (pp)bl++;
}
//cerr<(2, 2) <<
1, 1, 1, 1);
r = (Mat_(2, 2) <<
1, 1,
-1, -1);
c = (Mat_(2, 2) <<
1, -1,
1, -1);
d = (Mat_(2, 2) <<
1, -1,
-1, 1);
Mat row, col, dia, blu;
Mat temp, ans;
Size size(img.cols / 2, img.rows / 2);
filter2D(img, temp, CV_64F, r);
resize(temp, row, size);
filter2D(img, temp, CV_64F, c);
resize(temp, col, size);
filter2D(img, temp, CV_64F, d);
resize(temp, dia, size);
Mat t, tt;
multiply(row, row, t);
t.copyTo(tt);
multiply(col, col, t);
tt += t;
multiply(dia, dia, t);
tt += t;
sqrt(t, ans);
normalize(ans, ans, 0, 1, NORM_MINMAX);
filter2D(img, temp, CV_64F, b);
resize(temp, blu, size);
blu.copyTo(img);
img /= 4;
return ans;
}
https://blog.csdn.net/purgle/article/details/73719101
http://sse.tongji.edu.cn/linzhang/IQA/IQA.htm
Taily老段的微信公众号,欢迎交流学习
https://blog.csdn.net/taily_duan/article/details/81214815