Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
A library to create kaleidoscope effect on images. You can build on all platforms using CMake.
The library is written in C language so you can use Foreign Function Interface (FFI) to call functions from your favorite programming language. You can download from python package from PyPI. It also has C++ header only library to provide easier interface for C++ users and CUDA support for people who have doubts about performance. Check for mathematical explanation of the kaleidoscope effect from my webpage
pip install LibKaleidoscope
Python users check python/python-test.py in GitHub for basic usage
Use the following commands,
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --parallel
If you want to enable CUDA backend,
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DKALEIDOSCOPE_ENABLE_CUDA=ON ..
cmake --build . --parallel
There is no direct dependency for libjpeg-turbo inside from the library. It is just for test and demonstration purposes. If you don't want to install/compile just disable command line tool compilation with -DKALEIDOSCOPE_ENABLE_CMD_TOOL=OFF
The library has a simple usage and you need only three functions to use it. Check the sample usage at src/kaleidoscope-cmd.c
int initKaleidoscope(KaleidoscopeHandle *handler, int n, int width, int height, double scaleDown)
void processKaleidoscope(KaleidoscopeHandle *handler, double k, unsigned char *imgIn, unsigned char *imgOut)
void deInitKaleidoscope(KaleidoscopeHandle *handler)
Alternatively you can directly use the command line program to create kaleidoscope effect with ./kaleidoscope-cmd <Input Image Path> <Output Image Path> <N>
. You can see an example below for N=8
For C++ and CUDA usage check the unit tests at tests/processingTest.cpp
and tests/processingTest.cu
. It is very easy! Just include the header and construct the Kaleidoscope
class from kalos
namespace.
#include <kaleidoscope.hpp>
int main()
{
kalos::Kaleidoscope handler(n, width, height, nComponents, scaleDown, k);
/* ... */
handler.processImage(inData, outData, nPixel);
/* ... */
return 0;
}
#include <cuda/kaleidoscope.cuh>
int main()
{
kalos::cuda::Kaleidoscope handler(n, width, height, nComponents, scaleDown, k);
/* ... */
// Make sure inData and outData is device allocated!
handler.processImage(inData, outData, nPixel);
/* ... */
return 0;
}
It is really fast! On a Intel i7-11800H CPU it achieves,
resolution images. The performance estimation can be seen at the below
$$ FPS = a\text{ }e^{b\text{ }nPixels}+c\text{ }e^{d\text{ }nPixels} $$
$$ a = 2492 \text{, } b = -2.165\text{ }10^{-6} \text{, } c = 364.9 \text{, } d = -2.08\text{ }10^{-7} $$
If you want to benchmark code on your system make sure you configured with -DCMAKE_BUILD_TYPE=Release
and use this command,
./kaleidoscope-cmd <Input Image Path> <Output Image Path> <N> <Number of loop>
FAQs
A library to create kaleidoscope effect on images.
We found that LibKaleidoscope demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.