Compare commits

..

No commits in common. "3176a1e15e724e0d30bb7c978f3878447642b1e9" and "04c2054e8e03c8fe0a223c129593e988d6f74153" have entirely different histories.

2 changed files with 7 additions and 25 deletions

View File

@ -25,16 +25,15 @@ math::matrix<float> BlurGaussian::getMask(int size, Mode)
{
math::matrix<float> mask(size, size);
for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++)
mask(i, j) = getGauss(i - radius, j - radius, sigma);
qDebug() << Q_FUNC_INFO << "Not implemented yet!";
return mask;
}
float BlurGaussian::getGauss(int x, int y, float sigma)
{
float expValue = exp(-(pow(x, 2) + pow(y, 2)) / (2 * pow(sigma, 2)));
return (1 / (2 * M_PI * pow(sigma, 2))) * expValue;
qDebug() << Q_FUNC_INFO << "Not implemented yet!";
return 0;
}

View File

@ -10,32 +10,15 @@ BlurLinear::BlurLinear(PNM* img, ImageViewer* iv) :
{
}
PNM* BlurLinear::transform() {
PNM* BlurLinear::transform()
{
int maskSize = getParameter("size").toInt();
QList<QVariant> tmpMask = getParameter("mask").toList();
bool normalize = getParameter("normalize").toBool();
math::matrix<float> mask(maskSize, maskSize);
int currentMask = 0;
for (int x = 0; x < maskSize; x++) {
for (int y = 0; y < maskSize; y++) {
mask(x, y) = tmpMask.at(currentMask).toDouble();
currentMask++;
}
}
if (normalize) {
float summed = sum(mask);
if (summed == 0) {
summed = 1.0;
}
for (int x = 0; x < maskSize; x++) {
for (int y = 0; y < maskSize; y++) {
mask(x, y) /= summed;
}
}
}
qDebug() << Q_FUNC_INFO << "Not implemented yet!";
return convolute(mask, RepeatEdge);
}