I have go through several tutorial about BRISQUE algorithm ,but most of them are old tutorial and those contain error . So anyone can write the code or give a reference for this ? I gone through this and this
1 | initial version |
I have go through several tutorial about BRISQUE algorithm ,but most of them are old tutorial and those contain error . So anyone can write the code or give a reference for this ? I gone through this and this
I have go through several tutorial about BRISQUE algorithm ,but most of them are old tutorial and those contain error . So anyone can write the code or give a reference for this ?
I gone through this and this tutorial
I have go through several tutorial about BRISQUE algorithm ,but most of them are old tutorial and those contain error . So anyone can write the code or give a reference for this ? I gone through and this tutorial . I wrote the following code by using those tutorial but it showing errors . int main() { Mat im = imread("C:/Users/Samjith.CP/Desktop/1.jpg");
if (im.empty())
{
cout << "img read fail" << endl;
}
else
{
cvtColor(im, im, COLOR_BGR2GRAY); // convert to grayscale
im.convertTo(im, 1.0 / 255); // normalize and copy the read image to orig_bw
Mat mu(im.size(), CV_64FC1, 1);
GaussianBlur(im, mu, Size(7, 7), 1.166); // apply gaussian blur
Mat mu_sq = mu.mul(mu);
// compute sigma
Mat sigma (im.size(), CV_64FC1, 1);
sigma = im.mul(im);
GaussianBlur(sigma, sigma, Size(7, 7), 1.166); // apply gaussian blur
subtract(sigma, mu_sq, sigma); // sigma = sigma - mu_sq
cv::pow(sigma, double(0.5), sigma); // sigma = sqrt(sigma)
add(sigma, Scalar(1.0 / 255), sigma); // to avoid DivideByZero Exception
Mat structdis(im.size(), CV_64FC1, 1);
subtract(im, mu, structdis); // structdis = im - mu
divide(structdis, sigma, structdis);
// declare shifting indices array
int shifts[4][2] = { { 0, 1 },{ 1, 0 },{ 1, 1 },{ -1, 1 } };
// calculate pair-wise products for every combination of shifting indices
for (int itr_shift = 1; itr_shift <= 4; itr_shift++)
{
int* reqshift = shifts[itr_shift - 1]; // the required shift index
// declare shifted image
Mat shifted_structdis(imdist_scaled.size(), CV_64F, 1);
// BwImage is a helper class to create a copy of the image and create helper functions to access it's pixel values
BwImage OrigArr(structdis);
BwImage ShiftArr(shifted_structdis);
// calculate pair-wise component for the given orientation
for (int i = 0; i < structdis.rows; i++)
{
for (int j = 0; j < structdis.cols; j++)
{
if (i + reqshift[0] >= 0 && i + reqshift[0] < structdis.rows && j + reqshift[1] >= 0 && j + reqshift[1] < structdis.cols)
{
ShiftArr[i][j] = OrigArr[i + reqshift[0]][j + reqshift[1]];
}
else
{
ShiftArr[i][j] = 0;
}
}
}
Mat shifted_new_structdis;
shifted_new_structdis = ShiftArr.equate(shifted_new_structdis);
// find the pairwise product
multiply(structdis, shifted_new_structdis, shifted_new_structdis);
}
// make a svm_node object and push values of feature vectors into it
struct svm_node x[37];
// features is a rescaled vector to (-1, 1)
for (int i =0 ; i < 36; ++i)
{
x[i].value = features[i];
x[i].index = i + 1; // svm_node indexes start from 1
}
// load the model from modelfile - allmodel
string model = "allmodel";
Ptr<ml::SVM> model = ml::SVM::load(modelfile.c_str());
// get number of classes from the model
int nr_class = svm_get_nr_class(model);
double *prob_estimates = (double *)malloc(nr_class * sizeof(double));
// predict the quality score using svm_predict_probability function
qualityscore = svm->predict_probability(model, x, prob_estimates);
}
}
I have go through several tutorial about BRISQUE algorithm ,but most of them are old tutorial and those contain error . So anyone can write the code or give a reference for this ?
I gone through and this tutorial
. I wrote the following code by using those tutorial but it showing errors .
.
int main()
{
Mat im = imread("C:/Users/Samjith.CP/Desktop/1.jpg");
if (im.empty())
{
cout << "img read fail" << endl;
}
else
{
cvtColor(im, im, COLOR_BGR2GRAY); // convert to grayscale
im.convertTo(im, 1.0 / 255); // normalize and copy the read image to orig_bw
Mat mu(im.size(), CV_64FC1, 1);
GaussianBlur(im, mu, Size(7, 7), 1.166); // apply gaussian blur
Mat mu_sq = mu.mul(mu);
// compute sigma
Mat sigma (im.size(), CV_64FC1, 1);
sigma = im.mul(im);
GaussianBlur(sigma, sigma, Size(7, 7), 1.166); // apply gaussian blur
subtract(sigma, mu_sq, sigma); // sigma = sigma - mu_sq
cv::pow(sigma, double(0.5), sigma); // sigma = sqrt(sigma)
add(sigma, Scalar(1.0 / 255), sigma); // to avoid DivideByZero Exception
Mat structdis(im.size(), CV_64FC1, 1);
subtract(im, mu, structdis); // structdis = im - mu
divide(structdis, sigma, structdis);
// declare shifting indices array
int shifts[4][2] = { { 0, 1 },{ 1, 0 },{ 1, 1 },{ -1, 1 } };
// calculate pair-wise products for every combination of shifting indices
for (int itr_shift = 1; itr_shift <= 4; itr_shift++)
{
int* reqshift = shifts[itr_shift - 1]; // the required shift index
// declare shifted image
Mat shifted_structdis(imdist_scaled.size(), CV_64F, 1);
// BwImage is a helper class to create a copy of the image and create helper functions to access it's pixel values
BwImage OrigArr(structdis);
BwImage ShiftArr(shifted_structdis);
// calculate pair-wise component for the given orientation
for (int i = 0; i < structdis.rows; i++)
{
for (int j = 0; j < structdis.cols; j++)
{
if (i + reqshift[0] >= 0 && i + reqshift[0] < structdis.rows && j + reqshift[1] >= 0 && j + reqshift[1] < structdis.cols)
{
ShiftArr[i][j] = OrigArr[i + reqshift[0]][j + reqshift[1]];
}
else
{
ShiftArr[i][j] = 0;
}
}
}
Mat shifted_new_structdis;
shifted_new_structdis = ShiftArr.equate(shifted_new_structdis);
// find the pairwise product
multiply(structdis, shifted_new_structdis, shifted_new_structdis);
}
// make a svm_node object and push values of feature vectors into it
struct svm_node x[37];
// features is a rescaled vector to (-1, 1)
for (int i =0 ; i < 36; ++i)
{
x[i].value = features[i];
x[i].index = i + 1; // svm_node indexes start from 1
}
// load the model from modelfile - allmodel
string model = "allmodel";
Ptr<ml::SVM> model = ml::SVM::load(modelfile.c_str());
// get number of classes from the model
int nr_class = svm_get_nr_class(model);
double *prob_estimates = (double *)malloc(nr_class * sizeof(double));
// predict the quality score using svm_predict_probability function
qualityscore = svm->predict_probability(model, x, prob_estimates);
}
}
I have go through several tutorial about BRISQUE algorithm ,but most of them are old tutorial and those contain error . So anyone can write the code or give a reference for this ? I gone through and this tutorial . I wrote the following code by using those tutorial but it showing errors .
int main()
{
Mat im =
}