PillowResize
library is a C++ porting of the resize method from the Pillow python library.
It is written in C++ using OpenCV for matrix support
The main difference with respect to the resize
method of OpenCV is the use of an anti aliasing filter, that is missing in OpenCV and could introduce some artifacts, in particular with strong down-sampling.
See also blog.
The only requirement is OpenCV
, so install it from your package manager.
git clone --recurse https://github.com/zurutech/pillow-resize.git
cd pillow-resize
git submodule update --init --recursive
mkdir build && cd build
cmake ..
make
If you want to run also the tests, you need to install gtest
.
cmake -DBUILD_TESTS=ON ..
make
make test
The tests are based on a pixelwise comparison between the images resized using Pillow from Python and the images created with this library.
To install PillowResize
as a package ensure that you have OpenCV
installed system-wide, then simply compile and install.
mkdir build && cd build
cmake ..
sudo make install
To uninstall PillowResize
and all the things it brings with it simply run
cd build
sudo make uninstall
The library uses cmake
, hence this library can be added as a subdirectory and built together with your project or use the installed package as a normal CMake package.
find_package(PillowResize REQUIRED)
add_subdirectory(path-to-subdir)
target_link_libraries(your-target PUBLIC PillowResize)
The library defines also the variable PILLOWRESIZE_LIBS
, so you can replace PillowResize
in the command above with "${PILLOWRESIZE_LIBS}"
.