Commit 27014494 authored by David Tschumperlé's avatar David Tschumperlé

Initial commit

parents
language: cpp
compiler:
- gcc
script:
- cd examples
- make CXX='g++-4.8' travis
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
- clang
- libpng12-dev
- libjpeg-dev
- libmagick++-dev
- libgraphicsmagick++1-dev
- libfftw3-dev
- zlib1g-dev
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<a href="http://cimg.eu">![Logo](http://cimg.eu/img/CImgLogo2.jpg)</a>
##### http://cimg.eu
------------------
The **CImg Library** is a **small** and **open-source** **C++ toolkit** for **image processing**, designed with these properties in mind:
![Usefulness](http://cimg.eu/img/item_usefulness.jpg) **CImg** defines *classes* and *methods* to manage images in your own C++ code. You can use **CImg** to load/save various file formats, access pixel values, display/transform/filter images, draw primitives (text, faces, curves, 3d objects, ...), compute statistics, manage user interactions on images, and so on...
![Genericity](http://cimg.eu/img/item_genericity.jpg) **CImg** defines a single image class able to represent datasets having up to *4-dimensions* (from 1d scalar signals to 3d hyperspectral volumetric images), with *template pixel types* (`bool,char,int,float,...`). It also handles image *collections* and *sequences*.
![Portability](http://cimg.eu/img/item_portability.jpg) **CImg** is *self-contained*, *thread-safe* and *highly portable*. It fully works on *different operating systems* (`Unix,Windows,MacOS X,*BSD,...`) and is compatible with *various C++ compilers* (`Visual C++,g++,clang++,icc,...`).
![Simplicity](http://cimg.eu/img/item_simplicity.jpg) **CImg** is *lightweight*. It is made of a single header file [`CImg.h`](https://raw.githubusercontent.com/dtschump/CImg/master/CImg.h) that must be included in your C++ source. It defines only *four* different classes, encapsulated in the namespace `cimg_library`. It can be compiled using a minimal set of standard C++ and system libraries only. *No need for exotic or complex dependencies*.
![Extensibility](http://cimg.eu/img/item_extensibility.jpg) Although not mandatory, **CImg** can use functionalities of external tools/libraries such as [Board](http://libboard.sourceforge.net/), [FFMPEG](http://ffmpeg.mplayerhq.hu/), [FFTW3](http://www.fftw.org/), [GraphicsMagick](http://www.graphicsmagick.org/), [ImageMagick](http://www.imagemagick.org/), [Lapack](http://www.netlib.org/lapack/), [libcurl](http://curl.haxx.se/libcurl/), [libjpeg](http://www.ijg.org/), [libpng](http://www.libpng.org/pub/png/libpng.html), [libtiff](http://www.libtiff.org/), [Magick++](http://www.imagemagick.org/Magick++/), [OpenEXR](http://www.openexr.com/), [OpenCV](http://http://opencv.willowgarage.com/wiki/), [OpenMP](http://www.openmp.org/) or [XMedCon](http://xmedcon.sourceforge.net/). Moreover, a simple *plug-in* mechanism allows any user to directly enhance the library capabilities according to his needs.
![Freedom](http://cimg.eu/img/item_freedom.jpg) **CImg** is a *free, open-source library* distributed under the [*CeCILL-C*](http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.txt) (close to the GNU LGPL) or [CeCILL](http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt) (compatible with the GNU GPL) licenses. It can be used in commercial applications.
------------------
> **CImg** stands for **Cool Image** : It is _easy to use_, _efficient_ and is intended to be a very pleasant toolbox to design image processing algorithms in C++. Due to its generic conception, it can cover a wide range of image processing applications.
------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
____ _ _ ____
(_ _)( )_( )( ___)
)( ) _ ( )__)
(__) (_) (_)(____)
___ ____ __ __ ___ __ ____ ____ ____ __ ____ _ _
/ __)(_ _)( \/ )/ __) ( ) (_ _)( _ \( _ \ /__\ ( _ \( \/ )
( (__ _)(_ ) (( (_-. )(__ _)(_ ) _ < ) / /(__)\ ) / \ /
\___)(____)(_/\/\_)\___/ (____)(____)(____/(_)\_)(__)(__)(_)\_) (__)
C++ Template Image Processing Toolkit
( http://cimg.eu )
_cimg_version
--------------------------------------------------------------------------------
# Summary
#---------
The CImg Library is a small and open-source C++ toolkit for image processing.
It consists in a single header file 'CImg.h' providing a minimal set of C++
classes and methods that can be used in your own sources, to load/save,
process and display images. Very portable (Unix/X11,Windows, MacOS X, FreeBSD, .. ),
efficient, easy to use, it's a pleasant library for developing image processing
algorithms in C++.
# Authors and contributors :
#----------------------------
- David Tschumperle (project leader) ( http://tschumperle.users.greyc.fr/ )
- Maksim Aizenshtein
- Alberto Albiol
- Antonio Albiol
- Simon Barthelme
- Neil Brown
- Haz-Edine Assemlal
- Vincent Barra
- Wolf Blecher
- Romain Blei
- Yohan Bentolila
- Jerome Boulanger
- Pierre Buyssens
- Sebastien Coudert
- Frederic Devernay
- Olivier D'Hondt
- Francois-Xavier Dupe
- Gerd von Egidy
- Eric Fausett
- Jean-Marie Favreau
- Sebastien Fourey
- Alexandre Fournier
- Hon-Kwok Fung
- Vincent Garcia
- David Grimbichler
- Jinwei Gu
- Jean-Daniel Guyot
- Cedric Hammiche
- Matt Hanson
- Sebastien Hanel
- Michael Holroyd
- Christoph Hormann
- Werner Jainek
- Daniel Kondermann
- Pierre Kornprobst
- Jan W. Krieger
- Orges Leka
- Francois Lauze
- Xie Long
- Thomas Martin
- Cesar Martinez
- Jean Martinot
- Arnold Meijster (Center for High Performance Computing and Visualization, University of Groningen/The Netherlands)
- Nikita Melnichenko
- Julien Morat
- Baptiste Mougel
- Jovana Milutinovich
- Guillaume Nee
- Adam Newgas
- Francisco Oliveira
- Andrea Onofri
- Renaud Peteri
- Martin Petricek
- Paolo Prete
- Adrien Reboisson
- Klaus Schneider
- Jakob Schluttig
- Veronique Souchaud
- Konstantin Spirin
- David G. Starkweather
- Rainer Steffens
- Grzegorz Szwoch
- Thierry Thomas
- Yu-En-Yun
- Vo Duc Khanh
- Phillip Wood
- Bug Zhao
- Haibo Zheng
# Institution
#-------------
GREYC Image / CNRS UMR 6072 / FRANCE
The CImg Library project started in 2000, at the INRIA-Sophia
Antipolis/France ( http://www-sop.inria.fr/ ), in the ROBOTVIS / ODYSSEE Team.
Since October 2004, it is maintained and developed in the Image team of
the GREYC Lab (CNRS, UMR 6072), in Caen/France.
Team web page : http://www.greyc.fr/image
# Licenses
#----------
The source code of the CImg Library is distributed under
two distinct licenses :
- The main library file 'CImg.h' is *dual-licensed* :
It can be either distributed under the CeCILL-C or CeCILL license.
(see files 'Licence_CeCILL-C_V1-en.txt' and 'Licence_CeCILL_V2-en.txt').
Both are Free-Software licenses :
* CeCILL-C is adapted to the distribution of
library components, and is close in its terms to the well known GNU LGPL license
(the 'CImg.h' file can thus be used in closed-source products under certain
conditions, please read carefully the license file).
* CeCILL is close to (and even compatible with) the GNU GPL license.
- Most of the other files are distributed under the CeCiLL license
(file 'Licence_CeCILL_V2-en.txt'). See each file header to see what license applies.
These two CeCiLL licenses ( http://www.cecill.info/index.en.html ) have been
created under the supervision of the three biggest research institutions on
computer sciences in France :
- CNRS ( http://www.cnrs.fr/ )
- CEA ( http://www.cea.fr/ )
- INRIA ( http://www.inria.fr/ )
You have to RESPECT these licenses. More particularly, please carefully read
the license terms before using the CImg library in commercial products.
# Package structure :
#--------------------
The main package directory CImg/ is organized as follows :
- README.txt : This file.
- Licence_CeCILL-C_V1-en.txt : A copy of the CeCiLL-C license file.
- Licence_CeCILL_V2-en.txt : A copy of the CeCiLL license.
- CImg.h : The single header file that constitutes the library itself.
- examples/ : A directory containing a lot of example programs performing
various things, using the CImg library.
- html/ : A directory containing a copy of the CImg web page in html
format. The reference documentation is generated
automatically with the tool 'doxygen' (http://www.doxygen.org).
- resources/ : A directory containing some resources files for compiling
CImg examples or packages with various C++ compilers and OS.
- plugins/ : A directory containing CImg plug-ins files that can be used to
add specific extra functionalities to the CImg library.
# Getting started
#-----------------
If you are new to CImg, you should first try to compile the different examples
provided in the 'examples/' directory, to see what CImg is capable of
(as CImg is a template-based library, no prior compilation of the library is mandatory).
Look at the 'resources/' directory to ease this compilation on different platforms.
Then, you can look at the documentation 'html/reference/' to learn more about CImg
functions and classes. Finally, you can participate to the 'Forum' section
of the CImg web page and ask for help if needed.
# End of file
#------------
This diff is collapsed.
#
# File : CMakeLists.txt
# ( Configuration file for 'cmake' utility )
#
# Description : CMakeLists.txt configuration file for compiling CImg-based code.
# This file is a part of the CImg Library project.
# ( http://cimg.eu )
#
# Copyright : Antonio Albiol
# ( http://personales.upv.es/~aalbiol/ )
#
# License : CeCILL v2.0
# ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html )
#
# This software is governed by the CeCILL license under French law and
# abiding by the rules of distribution of free software. You can use,
# modify and/ or redistribute the software under the terms of the CeCILL
# license as circulated by CEA, CNRS and INRIA at the following URL
# "http://www.cecill.info".
#
# As a counterpart to the access to the source code and rights to copy,
# modify and redistribute granted by the license, users are provided only
# with a limited warranty and the software's author, the holder of the
# economic rights, and the successive licensors have only limited
# liability.
#
# In this respect, the user's attention is drawn to the risks associated
# with loading, using, modifying and/or developing or reproducing the
# software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also
# therefore means that it is reserved for developers and experienced
# professionals having in-depth computer knowledge. Users are therefore
# encouraged to load and test the software's suitability as regards their
# requirements in conditions enabling the security of their systems and/or
# data to be ensured and, more generally, to use and operate it in the
# same conditions as regards security.
#
# The fact that you are presently reading this means that you have had
# knowledge of the CeCILL license and that you accept its terms.
#
cmake_minimum_required(VERSION 2.6)
PROJECT(Examples-CIMG)
# Prevent compilation in-source
if( ${CMAKE_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR} )
Message( " " )
Message( FATAL_ERROR "Source and build directories are the same.
Create an empty build directory,
change into it and re-invoke cmake")
endif()
# To use PKG_CHECK_MODULES to find some optional packages
find_package(PkgConfig)
# Tell CMake where to leave executables
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
#Path of CImg.h file relative to this file path
set(CIMG_H_PATH ${PROJECT_SOURCE_DIR}/..)
include_directories( ${PROJECT_SOURCE_DIR} )
include_directories( ${CIMG_H_PATH} )
# ### CIMG related stuff
# Flags to enable fast image display, using the XSHM library.
SET(CIMG_XSHM_CCFLAGS -Dcimg_use_xshm)
# Flags to enable screen mode switching, using the XRandr library.
SET(CIMG_XRANDR_CCFLAGS -Dcimg_use_xrandr)
# Flags to enable native support for JPEG image files, using the JPEG library.
# ( http://www.ijg.org/ )
SET(CIMG_JPEG_CCFLAGS -Dcimg_use_jpeg)
# Flags to enable native support for TIFF image files, using the TIFF library.
# ( http://www.libtiff.org/ )
SET(CIMG_TIFF_CCFLAGS -Dcimg_use_tiff)
# Flags to enable native support for PNG image files, using the PNG library.
# ( http://www.libpng.org/ )
SET(CIMG_PNG_CCFLAGS -Dcimg_use_png)
#Flags to enable OPENCV support (Camera)
# ( http://www.opencv.org/ )
SET(CIMG_OPENCV_CCFLAGS-Dcimg_use_opencv)
# Flags to enable native support for EXR image files, using the OpenEXR library.
# ( http://www.openexr.com/ )
SET(CIMG_OPENEXR_CCFLAGS -Dcimg_use_openexr)
# Flags to enable native support for various video files, using the FFMPEG library.
# ( http://www.ffmpeg.org/ )
SET(CIMG_FFMPEG_CCFLAGS -Dcimg_use_ffmpeg)
# Flags to enable native support of most classical image file formats, using the Magick++ library.
# ( http://www.imagemagick.org/Magick++/ )
SET(CIMG_MAGICK_CCFLAGS -Dcimg_use_magick)
# Flags to enable faster Discrete Fourier Transform computation, using the FFTW3 library
# ( http://www.fftw.org/ )
SET(CIMG_FFTW3_CCFLAGS -Dcimg_use_fftw3)
# ### Search Additional Libraries ##########
FIND_PACKAGE(OpenCV)
FIND_PACKAGE(JPEG)
FIND_PACKAGE(TIFF)
FIND_PACKAGE(PNG)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(LAPACK)
FIND_PACKAGE(BLAS)
PKG_CHECK_MODULES(FFTW3 fftw3)
PKG_CHECK_MODULES(OPENEXR OpenEXR)
PKG_CHECK_MODULES(MAGICK Magick++)
# PKG_CHECK_MODULES(LIBAVCODEC libavcodec)
# PKG_CHECK_MODULES(LIBAVFORMAT libavformat)
# PKG_CHECK_MODULES(LIBSWSCALE libswscale)
# PKG_CHECK_MODULES(LIBAVUTIL libavutil)
if(NOT WIN32)
FIND_PACKAGE(X11)
FIND_PACKAGE(Threads REQUIRED)
endif()
# #### End of additional libraries search ##########
### Configure Paths according to detected packages
if(TIFF_FOUND)
get_filename_component(TIFF_LIB_DIRS ${TIFF_LIBRARIES} PATH)
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_TIFF_CCFLAGS}")
link_directories(${TIFF_LIB_DIRS})
include_directories(${TIFF_INCLUDE_DIR})
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${TIFF_LIBRARIES})
endif()
if(JPEG_FOUND)
get_filename_component(JPEG_LIB_DIRS ${JPEG_LIBRARIES} PATH)
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_JPEG_CCFLAGS}")
link_directories(${JPEG_LIB_DIRS})
include_directories(${JPEG_INCLUDE_DIR})
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${JPEG_LIBRARIES})
endif()
if (ZLIB_FOUND)
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_ZLIB_CCFLAGS}")
link_directories(${ZLIB_LIB_DIRS})
include_directories(${ZLIB_INCLUDE_DIR})
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${ZLIB_LIBRARIES})
# PNG requires ZLIB
if(PNG_FOUND)
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_PNG_CCFLAGS}")
link_directories(${PNG_LIB_DIRS})
include_directories(${PNG_INCLUDE_DIR} )
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${PNG_LIBRARIES} )
endif()
endif()
if(FFTW3_FOUND)
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_FFTW3_CCFLAGS}")
link_directories( ${FFTW3_LIBRARY_DIRS} )
include_directories( ${FFTW3_INCLUDE_DIRS} )
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${FFTW3_LIBRARIES} )
endif()
if(OPENEXR_FOUND)
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_OPENEXR_CCFLAGS}")
link_directories( ${OPENEXR_LIBRARY_DIRS} )
include_directories( ${OPENEXR_INCLUDE_DIRS} )
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${OPENEXR_LIBRARIES} )
endif()
if(MAGICK_FOUND)
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_MAGICK_CCFLAGS}")
link_directories( ${MAGICK_LIBRARY_DIRS} )
include_directories( ${MAGICK_INCLUDE_DIRS} )
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${MAGICK_LIBRARIES} )
endif()
if( LIBAVCODEC_FOUND AND LIBAVFORMAT_FOUND AND LIBSWSCALE_FOUND AND LIBAVUTIL_FOUND )
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_FFMPEG_CCFLAGS}")
link_directories( ${LIBAVFORMAT_LIBRARY_DIRS} )
link_directories( ${LIBAVCODEC_LIBRARY_DIRS} )
link_directories( ${LIBSWSCALE_LIBRARY_DIRS} )
link_directories( ${LIBAVUTIL_LIBRARY_DIRS} )
include_directories( ${LIBAVFORMAT_INCLUDE_DIRS} ${LIBAVFORMAT_INCLUDE_DIRS}/libavformat)
include_directories( ${LIBAVCODEC_INCLUDE_DIRS} ${LIBAVCODEC_INCLUDE_DIRS}/libavcodec )
include_directories( ${LIBSWSCALE_INCLUDE_DIRS} ${LIBSWSCALE_INCLUDE_DIRS}/libswscale)
include_directories( ${LIBAVUTIL_INCLUDE_DIRS} ${LIBAVUTIL_INCLUDE_DIRS}/libavutil )
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBAVFORMAT_LIBRARIES} )
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBAVCODEC_LIBRARIES} )
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBSWSCALE_LIBRARIES} )
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBAVUTIL_LIBRARIES} )
endif()
if(NOT APPLE)
if(NOT WIN32)
if(X11_FOUND)
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_XSHM_CCFLAGS} ${CIMG_XRANDR_CCFLAGS}")
SET(SYSTEM_LIBS ${SYSTEM_LIBS} Xext Xrandr)
endif()
endif(NOT WIN32)
endif(NOT APPLE)
if(X11_FOUND)
link_directories(${X11_LIB_DIRS})
include_directories(${X11_INCLUDE_DIR})
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${X11_LIBRARIES} )
endif()
if (NOT WIN32)
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${CMAKE_THREAD_LIBS_INIT} )
endif()
if( WIN32)
SET( SYSTEM_LIBS ${SYSTEM_LIBS} gdi32 )
endif()
if (OpenCV_FOUND)
message("OpenCV Found")
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_OPENCV_CCFLAGS}")
include_directories(${OpenCV_INCLUDE_DIRS})
link_directories(${OpenCV_LIB_DIRS})
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${OpenCV_LIBS} )
endif()
if(LAPACK_FOUND)
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_LAPACK_CCFLAGS}")
link_directories( ${LAPACK_LIBRARY_DIRS} )
include_directories( ${LAPACK_INCLUDE_DIRS} )
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${LAPACK_LIBRARIES} )
endif()
if(BLAS_FOUND)
SET(CIMG_CFLAGS "${CIMG_CFLAGS} ${CIMG_BLAS_CCFLAGS}")
link_directories( ${BLAS_LIBRARY_DIRS} )
include_directories( ${BLAS_INCLUDE_DIRS} )
SET( SYSTEM_LIBS ${SYSTEM_LIBS} ${BLAS_LIBRARIES} )
endif()
# Add CIMG Flags to Compilation Flags
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CIMG_CFLAGS}")
SET(CIMG_FILES CImg_demo
captcha
curve_editor2d
dtmri_view3d
edge_explorer2d
fade_images
gaussian_fit1d
generate_loop_macros
hough_transform2d
image_registration2d
image2ascii
image_surface3d
jawbreaker
mcf_levelsets2d
mcf_levelsets3d
odykill
pde_heatflow2d
pde_TschumperleDeriche2d
plotter1d
radon_transform2d
scene3d
spherical_function3d
tetris
tron
tutorial
wavelet_atrous
use_draw_gradient
use_nlmeans
use_skeleton
use_RGBclass
)
foreach(program ${CIMG_FILES})
add_executable(${program} ${program}.cpp)
target_link_libraries(${program} ${SYSTEM_LIBS} )
endforeach(program)
This diff is collapsed.
/*
#
# File : captcha.cpp
# ( C++ source file )
#
# Description : Captcha images generator.
# This file is a part of the CImg Library project.
# ( http://cimg.eu )
#
# Copyright : David Tschumperle
# ( http://tschumperle.users.greyc.fr/ )
#
# License : CeCILL v2.0
# ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html )
#
# This software is governed by the CeCILL license under French law and
# abiding by the rules of distribution of free software. You can use,
# modify and/ or redistribute the software under the terms of the CeCILL
# license as circulated by CEA, CNRS and INRIA at the following URL
# "http://www.cecill.info".
#
# As a counterpart to the access to the source code and rights to copy,
# modify and redistribute granted by the license, users are provided only
# with a limited warranty and the software's author, the holder of the
# economic rights, and the successive licensors have only limited
# liability.
#
# In this respect, the user's attention is drawn to the risks associated
# with loading, using, modifying and/or developing or reproducing the
# software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also
# therefore means that it is reserved for developers and experienced
# professionals having in-depth computer knowledge. Users are therefore
# encouraged to load and test the software's suitability as regards their
# requirements in conditions enabling the security of their systems and/or
# data to be ensured and, more generally, to use and operate it in the
# same conditions as regards security.
#
# The fact that you are presently reading this means that you have had
# knowledge of the CeCILL license and that you accept its terms.
#
*/
#ifndef cimg_debug
#define cimg_debug 1
#endif
#include "CImg.h"