Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/blagojeblagojevic/image.h

Low level image processing header only libary
https://github.com/blagojeblagojevic/image.h

c header-only image-processing stb stb-image

Last synced: 12 days ago
JSON representation

Low level image processing header only libary

Awesome Lists containing this project

README

        

---

# 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](#introduction)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Examples](#examples)
- [Contributing](#contributing)
- [License](#license)

## 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.

```c
#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.

```c
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:

```c
#include
#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](LICENSE) file for details.

---

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