Simple program to load a JPEG file, manipulate the data (YUV I420), and store the result as a JPEG file.
-
Depends on libjpeg
-
A kaleidoscope effect is included in my_library
- On Debian run
sudo apt-get install libjpeg-dev
- On macOS run
brew install libjpeg
- On windows follow the instructions here
Cd to project root and run: make
Then run: ./imageloader <input.jpg> <out.jpg>
The kaleidoscope function takes jpeg as an input, applies the kaleidoscope effect similar to how it is shown in this video and saves the result in a jpeg file. The effect as it is shown in the video has multiple processing stages such as: dimming the background, scaling down the image and then moving the pixels around to create the kaleidoscope effect.
Our kaleidoscope dims the pixels outside the kalidoscope rim and provides an option as to how many sectors the kaleidoscope may display.
I420 YUV pixel format is explained in this link. More visual explanation at the bottom of this wikipedia article.
- Had to include the following library in the libjpeg.h to avoid the error
/usr/local/include/jpeglib.h:774:3: error: unknown type name 'size_t
#ifndef _STDIO_H_
#include <stdio.h>
#endif
-
The kaleidoscope effect is implemented in the function
kaleidoscope
that is declaredmy_library.h
and defined inmy_library.c
. Further, some helper functions are used and are defined after thekaleidoscope
function. -
The the main triangle and the basic 6 o' clock triangle of the kaleidoscope that are used during 'shrink and rotate' are shown below.