https://github.com/caseymcc/imglib
https://github.com/caseymcc/imglib
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/caseymcc/imglib
- Owner: caseymcc
- License: mit
- Created: 2020-10-18T16:36:56.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-01-08T19:02:26.000Z (over 4 years ago)
- Last Synced: 2026-01-01T23:19:06.018Z (6 months ago)
- Language: C++
- Size: 106 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# imglib - This is a work in progress (WIP)
imglib is a simple image library based on templates. All of the functions included work on your data types with a little bit of template vodoo.
Expected features (WIP)
- IO
- color convertion
- resize
- opengl/opencl/cuda support
- equality testing
imglib works with a concept of an image. It expects images to have a location (system memory, cuda, opencl, etc...), format (RGB, RGBA, etc...), bit depth of channels (8bit, 16bit, etc...), width, stride (line lenght if padded), height, data (buffer) and data size. There is a SimpleImage class in the library that can be used but it is really setup to use whatever image class you already have defined.
To get imglib to use your data structure you need to define the following im the imglib namespace.
````
namespace imglib
{
template<>
Format format<{YourType}>(const _Image &){return Format::Unknown;}
template<>
Depth depth<{YourType}>(const _Image &){return Depth::Unknown;}
template<>
Location location<{YourType}>(const _Image &){return Location::System;}
template<>
size_t width<{YourType}>(const _Image &){return 0;}
template<>
size_t height<{YourType}>(const _Image &){return 0;}
template<>
size_t stride<{YourType}>(const _Image &){return 0;}
template<>
size_t nativeId<{YourType}>(const _Image &){return 0;}
template<>
uint8_t *data<{YourType}>(_Image &){return nullptr;}
template<>
size_t dataSize<{YourType}>(const _Image &){return 0;}
template<>
bool resize<{YourType}>(_Image &image, Format format, Depth depth, size_t width, size_t height){return false;}
}
````
An example of how to do this can be seen with the `SimpleImage` in the simpleImage.h file.
Once the above functions are defined you can make any calls to the library, like
````
#include
#include
SimpleImage image;
imglib::load(image, "test.jpg");
````