everyone.
I'd like to know if there is any improvement to a pixelizing algorithm I'm working on.
The algorithm it's written in C++ using OpenCV library and works like this:
- Increase the contrast of the Mat a little bit;
- Resize the Mat to D% of its size, using nearest-neighbor interpolation;
- Resize the Mat back to its original size, also using nni;
[D = density, a parameter of the function]
Is there any way to make the result look better?
Mat pixelize(Mat src, int density){
Size s(src.cols, src.rows);
src.convertTo(src, -1, 1.1, 0);
resize(src, src, percent(s, density), 1, 1, INTER_NEAREST);
resize(src, src, s, 1, 1, INTER_NEAREST);
resize(src, src, Size(640, 480));
return src;
}