MCPcopy Create free account
hub / github.com/YACReader/yacreader / setFilter

Method setFilter

YACReader/render.cpp:133–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133QImage MeanNoiseReductionFilter::setFilter(const QImage &image)
134{
135 int width = image.width();
136 int height = image.height();
137 QImage result(width, height, image.format());
138 int filterSize = sqrt((float)neighborghoodSize);
139 int bound = filterSize / 2;
140 QRgb pix;
141 int r, g, b;
142 for (int j = bound; j < height - bound; j++) {
143 for (int i = bound; i < width - bound; i++) {
144 r = g = b = 0;
145 for (int y = j - bound; y <= j + bound; y++) {
146 for (int x = i - bound; x <= i + bound; x++) {
147 pix = image.pixel(x, y);
148 r += qRed(pix);
149 g += qGreen(pix);
150 b += qBlue(pix);
151 }
152 }
153 result.setPixel(i, j, QColor(r / neighborghoodSize, g / neighborghoodSize, b / neighborghoodSize).rgb());
154 // qDebug((QString::number(redChannel.at(4))+" "+QString::number(greenChannel.at(4))+" "+QString::number(blueChannel.at(4))).toAscii());
155 // qDebug((QString::number(redChannel.size())+" "+QString::number(greenChannel.size())+" "+QString::number(blueChannel.size())).toAscii());
156 }
157 }
158 return result;
159}
160
161//-----------------------------------------------------------------------------
162// MedianNoiseReductionFilter

Callers 10

mainFunction · 0.80
processMethod · 0.80
openFolderFromPathMethod · 0.80
getSiblingComicsMethod · 0.80
runMethod · 0.80
runMethod · 0.80
createMethod · 0.80
updateMethod · 0.80
loadLibraryMethod · 0.80

Calls 5

QColorClass · 0.85
changeBrightnessFunction · 0.85
changeContrastFunction · 0.85
changeGammaFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected