/image-processor

A library to perform image processing operations and apply advanced algorithms (blur, edge detection, resizing, sharpening, pixelization...).

Primary LanguageC++

Image Processor

Welcome to my Image Processing library which provides a set of functions to manipulate images in various ways. It uses the stb library to read and write images.

To use the library, simply import the files and read the filename of your choice. You can then use the library's functions before writing back to disk. Supported formats are png, jpg, bmp and tga.

Image img("flower.jpg");

if (img.is_valid())
{
	// Manipulate image here
	img.write("new-flower.jpg");
}

Base Image:

Images/flower.jpg

Flipping Images

Image& flipX();

Images/flower-flipX.jpg

Image& flipY();

Images/flower-flipY.jpg

Cropping

Image& crop(uint16_t start_x, uint16_t start_y, uint16_t new_height, uint16_t new_width);

Images/flower-crop.jpg

Resizing

Image& resize(int new_width, int new_height);
Image& scale(double ratio);

Images/flower-resized.jpg

Images/flower-resized%201.jpg

Grayscaling

Image& grayscale_avg();

Images/flower-avg.jpg

Image& grayscale_lum();

Images/flower-lum.jpg

Pixelization

Image& pixelize(int strength = 2);

strength represents the width and height of a visible pixel in pixels (i.e. strength of 2 means a 4x4 area of pixels will be regrouped together)

Images/flower-pixel.jpg

Images/flower-pixel2.jpg

Blur

Image& gaussian_blur(int strength = 2);

strength between 1 and 4

Images/flower-blur.jpg

Edge Detection

Image& edge_detection(double cutoff = 115);

*cutoff should be a number between 1 and 255 and represents the value at which pixels > cutoff will be set to 255 and the pixels ≤ cutoff will be set to 0*

Images/flower-edge1.jpg

Sharpening

Image& sharpen();

Images/flower-sharpen.jpg

Masks

Image& color_mask(float r, float g, float b);

Images/flower-mask.jpg

Credits: