BlagojeBlagojevic / image.h

Low level image processing header only libary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Image Processing Library

This is a simple C library for basic image processing operations, including loading images, arithmetic operations, filtering, and manipulation.

Table of Contents

Introduction

This library provides a set of functions to work with images represented as matrices of pixel values. It offers functionalities to perform operations such as addition, subtraction, multiplication, division, convolution, black and white filtering, channel manipulation, and more.

Features

  • Load images from files
  • Basic arithmetic operations on images
  • Convolution with custom kernels
  • Black and white filtering
  • Channel manipulation
  • Drawing rectangles on images

Installation

To use this library, simply include the image.h header file in your C project, along with the stb_image.h and stb_image_write.h libraries, which are included by default.

#include "image.h"

Usage

The library provides a set of functions that operate on the Image struct defined in image.h. Before using any functions, make sure to allocate memory for the Image struct using the provided functions.

Image myImage = Image_Alloc(100, 100, 3); // Allocate a 100x100 RGB image

Once an image is allocated, you can perform various operations on it, such as saving the image, applying filters, manipulating channels, and more.

Examples

Here's an example of loading an image, applying a filter, and saving the result:

#include <stdio.h>
#define IMAGE_IMPLEMENTATION
#include "image.h"

int main() {
    // Load an image from file
    Image inputImage = Image_Alloc_Name("input.jpg");

    // Apply a custom kernel for convolution
    float customKernel[] = {0, 0, 0, 0, 1, 0, 0, 0, 0};
    Image filteredImage = Image_Apply_Kernel(inputImage, customKernel, 3, 3);

    // Save the filtered image
    Image_Save(filteredImage, "output.jpg");

    // Free allocated memory
    Image_Free(inputImage);
    Image_Free(filteredImage);

    return 0;
}

Contributing

Contributions are welcome! If you have any ideas for improvements or new features, feel free to open an issue or submit a pull request.

License

This library is licensed under the MIT License. See the LICENSE file for details.


Feel free to adjust the content according to your preferences or add more sections as needed.

About

Low level image processing header only libary

License:MIT License


Languages

Language:C++ 75.0%Language:C 25.0%