Home

IM
Image Representation, Storage, Capture and Processing
Version 3.6

IM is a toolkit for Digital Imaging. IM is based on 4 concepts: Image Representation, Storage, Processing and Capture. The main goal of the library is to provide a simple API and abstraction of images for scientific applications.

The most popular file formats are supported: TIFF, BMP, PNG, JPEG, GIF and AVI. Image representation includes scientific data types. About a hundred Image Processing operations are available.

This work was developed at Tecgraf/PUC-Rio by means of the partnership with PETROBRAS/CENPES.

Project Management:

Antonio Escaño Scuri

Tecgraf - Computer Graphics Technology Group, PUC-Rio, Brazil
http://www.tecgraf.puc-rio.br/im


IM

Overview

IM is a toolkit for Digital Imaging. IM is based on 4 concepts: Image Representation, Storage, Processing and Capture. Image Visualization is a task that it is left for a graphics library.

It provides support for image capture, several image file formats and many image processing operations. The most popular file formats are supported: TIFF, BMP, PNG, JPEG, GIF and AVI.

Image representation includes scientific data types (like IEEE floating point data) and attributes (or metadata like GeoTIFF and Exif tags). Animation, video and volumes are supported as image sequences, but there is no digital audio support.

The main goal of the library is to provide a simple API and abstraction of images for scientific applications.

The toolkit API is written in C. The core library source code is implemented in C++ and it is very portable, it can be compiled in Windows and UNIX with no modifications. New image processing operations can be implemented in C or in C++.

IM is free software, can be used for public and commercial applications.

IM has been used in Tecgraf for many theses and dissertations. Check the Publications in Tecgraf's web site http://www.tecgraf.puc-rio.br/.

Availability

The library is available for several compilers:

  • GCC and CC, in the UNIX environment
  • Visual C++, Borland C++, Watcom C++ and GCC (Cygwin and MingW), in the Windows environment

The library is available for several operating systems:

  • UNIX (SunOS, IRIX, AIX, FreeBSD and Linux)
  • Microsoft Windows NT/2K/XP

Support

The official support mechanism is by e-mail, using im@tecgraf.puc-rio.br. Before sending your message:

  • Check if the reported behavior is not described in the user guide.
  • Check if the reported behavior is not described in the specific format characteristics.
  • Check the History to see if your version is updated.
  • Check the To Do list to see if your problem has already been reported.

After all of the above have been checked, report the problem, including in your message: function, element, format, platform, and compiler.

We host the IM support features at SourceForge: http://sourceforge.net/projects/imtoolkit/. It provides us Mailing List, CVS Repository and Downloads.

The discussion list is available at: http://lists.sourceforge.net/lists/listinfo/imtoolkit-users.
Source code, pre-compiled binaries and documentation can be downloaded at: http://sourceforge.net/project/showfiles.php?group_id=241318.
The CVS can be browsed at: http://imtoolkit.cvs.sourceforge.net/imtoolkit/.

If you want us to develop a specific feature for the toolkit, Tecgraf is available for partnerships and cooperation. Please contact tcg@tecgraf.puc-rio.br.

Lua documentation and resources can be found at http://www.lua.org/.

Credits

This work was developed at Tecgraf by means of the partnership with PETROBRAS/CENPES.

Library Author:

  • Antonio Scuri

Thanks to the people that worked and contributed to the library:

  • Antonio Nabuco Tartarini
  • Carolina Alfaro
  • Diego Fernandes Nehab
  • Erick de Moura Ferreira
  • Luiz Henrique Figueiredo
  • Marcelo Gattass

We also thank the developers of the third party libraries:

  • Sam Leffler (libTIFF author)
  • Frank Warmerdam, Andrey Kiselev, Mike Welles and Dwight Kelly (libTIFF actual maintainers)
  • Thomas Lane (libJPEG)
  • Lutz Müller (libExif)
  • Glenn Randers-Pehrson (libPNG)
  • Jean-loup Gailly and Mark Adler (zlib)
  • Gershon Elber (GIFLib)
  • Michael Adams (libJasper)
  • Svein Bøe, Tor Lønnestad and Otto Milvang (XITE)
  • Jason Perkins (Premake)
  • Marc Alexander Lehmann (libLZF)
  • (to many others that contribute to these library, keeping them free and updated)

The IM toolkit distribution includes the some third party libraries that are not developed by Tecgraf. Their license are also free and have the same freedom as the Tecgraf Library License. You can read the respective licenses in the files: zlib.txt, libpng.txt, libjpeg.txt, libtiff.txt, libjasper.txt, liblzf.txt, libexif.txt.

Thanks for the SourceForge for hosting the support features. Thanks for the LuaForge team for previously hosting the support features for many years.

IM is registered at the National Institute of Intellectual Property in Brazil (INPI) under the number 07570-6, and so it is protected against illegal use. See the Tecgraf Library License for further usage information and Copyright.

Documentation

This toolkit is available at http://www.tecgraf.puc-rio.br/im.

The full documentation can be downloaded from the Download Files. The documentation is also available in Adobe Acrobat and Windows HTML Help formats.

The HTML navigation uses the WebBook tool, available at http://www.tecgraf.puc-rio.br/webbook.

The library Reference documentation is generated by Doxygen ( http://www.stack.nl/~dimitri/doxygen/ ).

Publications

  • Scuri, A. "IM - Imaging Toolkit". Software Developer's Journal. Jan/2006. [http://en.sdjournal.org/products/articleInfo/25]
  • Scuri, A., "IM – An Imaging Tool", Poster, SIBGRAPI 2004 [poster.pdf, poster_text.pdf]


Tecgraf Library License

The Tecgraf products under this license are: IUP, CD and IM.

All the products under this license are free software: they can be used for both academic and commercial purposes at absolutely no cost. There are no paperwork, no royalties, no GNU-like "copyleft" restrictions, either. Just download and use it. They are licensed under the terms of the MIT license reproduced below, and so are compatible with GPL and also qualifies as Open Source software. They are not in the public domain, PUC-Rio keeps their copyright. The legal details are below.

The spirit of this license is that you are free to use the libraries for any purpose at no cost without having to ask us. The only requirement is that if you do use them, then you should give us credit by including the copyright notice below somewhere in your product or its documentation. A nice, but optional, way to give us further credit is to include a Tecgraf logo and a link to our site in a web page for your product.

The libraries are designed, implemented and maintained by a team at Tecgraf/PUC-Rio in Brazil. The implementation is not derived from licensed software. The library was developed by request of Petrobras. Petrobras permits Tecgraf to distribute the library under the conditions here presented.

Copyright © 1994-2010 Tecgraf, PUC-Rio.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Download

The download site for pre-compiled binaries, documentation and sources is at SourceForge:

http://sourceforge.net/projects/imtoolkit/files/

Use this link for the latest version: http://sourceforge.net/projects/imtoolkit/files/3.6.3/

Before downloading any precompiled binaries, you should read before the Tecgraf Library Download Tips.

Some other files are available directly at the IM download folder:

http://www.tecgraf.puc-rio.br/im/download/


Library Download Tips

Tecgraf/PUC-Rio Library Download Tips

All the libraries were build using Tecmake. Please use it if you intend to recompile the sources. Tecmake can be found at http://www.tecgraf.puc-rio.br/tecmake.

The IM files can be downloaded at http://sourceforge.net/projects/imtoolkit/files/.
The CD files can be downloaded at http://sourceforge.net/projects/canvasdraw/files/.
The IUP files can be downloaded at http://sourceforge.net/projects/iup/files/.
The Lua files can be downloaded at http://sourceforge.net/projects/luabinaries/files/.

Build Configuration

Libraries and executables were built using speed optimization. In UNIX the dynamic libraries were NOT built with the -fpic parameter. In MacOS X the dynamic libraries are in bundle format. The source code along with the "config.mak" files for Tecmake are also available.

The DLLs were built using the cdecl calling convention. This should be a problem for Visual Basic users.

In Visual C++ 6 and 7 we use the single thread C Run Time Library for static libraries and the multi thread C RTL for DLLs. Because this were the default in Visual Studio for new projects. Since Visual C++ 8, both use the multithread C RTL.

Packaging

The package files available for download are named according to the platform where they were build.

In UNIX all strings are based in the result of the command "uname -a". The package name is a concatenation of the platform uname, the system major version number and the system minor version number. Some times a suffix must be added to complement the name. The compiler used is always gcc. Binaries for 64-bits receive the suffix: "_64". In Linux when there are different versions of gcc for the same uname, the platform name is created adding the major version number of the compiler added as a suffix: "g3" for gcc 3 and "g4" for gcc 4.

In Windows the platform name is the compiler and its major version number.

All library packages (*_lib*) contains pre-compiled binaries for the specified platform and includes. Packages with "_bin" suffix contains executables only.

The package name is a general reference for the platform. If you have the same platform it will work fine, but it may also work in similar platforms.

Here are some examples of packages:

iup2_4_Linux26_lib.tar.gz = IUP 2.4 32-bits Libraries and Includes for Linux with Kernel version 2.6 built with gcc 3.
iup2_4_Linux26g4_64_bin.tar.gz = IUP 2.4 64-bits Executables for Linux with Kernel version 2.6 built with gcc 4.
iup2_4_Win32_vc8_lib.tar.gz = IUP 2.4 32-bits Static Libraries and Includes for Windows to use with Visual C++ 8 (2005).
iup2_4_Win32_dll9_lib.tar.gz = IUP 2.4 32-bits Dynamic Libraries (DLLs), import libraries and Includes for Windows to use with Visual C++ 9 (2008).
iup2_4_Docs_html.tar.gz = IUP 2.4 documentation files in HTML format (the web site files can be browsed locally).
iup2_4_Win32_bin.tar.gz = IUP 2.4 32-bits Executables for Windows.

The documentation files are in HTML format. They do not include the CHM and PDF versions. These two files are provided as a separate download, but they all have the same documentation.

Installation

For any platform we recommend you to create a folder to contain the third party libraries you download. Then just unpack the packages you download in that folder. The packages already contains a directory structure that separates each library or toolkit. For example:

\mylibs\
        iup\
            bin\
            html\
            include\
            lib\Linux26
            lib\Linux26g4_64
            lib\vc8
            src
        cd\
        im\
        lua5.1\

This structure will also made the process of building from sources more simple, since the projects and makefiles will assume this structure .

Usage

For makefiles use:

1) "-I/mylibs/iup/include" to find include files
2) "-L/mylibs/iup/lib/Linux26" to find library files
3) "-liup" to specify the library files

For IDEs the configuration involves the same 3 steps above, but each IDE has a different dialog. The IUP toolkit has a Guide for some IDEs:

Borland C++ BuilderX - http://www.tecgraf.puc-rio.br/iup/en/ide_guide/cppbx.html
Code Blocks - http://www.tecgraf.puc-rio.br/iup/en/ide_guide/codeblocks.html
Dev-C++ - http://www.tecgraf.puc-rio.br/iup/en/ide_guide/dev-cpp.html
Eclipse for C++ - http://www.tecgraf.puc-rio.br/iup/en/ide_guide/eclipse.html
Microsoft Visual C++ (Visual Studio 2003) - http://www.tecgraf.puc-rio.br/iup/en/ide_guide/msvc.html
Microsoft Visual C++ (Visual Studio 2005) - http://www.tecgraf.puc-rio.br/iup/en/ide_guide/msvc8.html
Open Watcom - http://www.tecgraf.puc-rio.br/iup/en/ide_guide/owc.html

Available Platforms

The following platforms can be available:

Package Name | Description
AIX43 | IBM AIX 4.3 (ppc) / gcc 2.95 / Motif 2.1
IRIX65 | SGI IRIX 6.5 (mips) / gcc 3.0 / Motif 2.1
IRIX6465 | SGI IRIX 6.5 (mips) / gcc 3.3 / Motif 1.2
Linux24 | Red Hat 7.3 (x86) / Kernel 2.4 / gcc 2.95 / Open Motif 2.1 / GTK 2.0
Linux24g3 | CentOS 3.9 (x86) / Kernel 2.4 / gcc 3.2 / Open Motif 2.2 3 / GTK 2.2
Linux24g3_64 | Red Hat E.L. WS 3 (x64) / Kernel 2.4 / gcc 3.2 / Open Motif 2.2 3 / GTK 2.2
Linux26 | CentOS 4.6 (x86) / Kernel 2.6 / gcc 3.4 / Open Motif 2.2 3 / GTK 2.4
Linux26_64 | CentOS 4.6 (x64) / Kernel 2.6 / gcc 3.4 / Open Motif 2.2 3 / GTK 2.4
Linux26g4 | CentOS 5.3 (x86) / Kernel 2.6 / gcc 4.1 / Open Motif 2.2 3 / GTK 2.12
Linux26g4_64 | CentOS 5.2 (x64) / Kernel 2.6 / gcc 4.1 / OpenMotif 2.2 3 / GTK 2.10
Linux26g4ppc | Ubuntu 7.10 (ppc) / Kernel 2.6 / gcc 4.1 / Open Motif 2.2 3 / GTK 2.?
Linux26_ia64 | Red Hat E.L. AS 4 (ia64) / Kernel 2.6 / gcc 3.4 / Open Motif 2.2 3 / GTK 2.4
SunOS57 | Sun Solaris 7 (sparc) / gcc 2.95 / Motif 2.1
SunOS58 | Sun Solaris 8 (sparc) / gcc 3.4 / Motif 2.1
SunOS510 | Sun Solaris 10 (sparc) / gcc 3.4 / Motif 2.1
SunOS510x86 | Sun Solaris 10 (x86) / gcc 3.3 / Motif 2.1
FreeBSD54 | Free BSD 5.4 (x86) / gcc 3.4
MacOS104 | Mac OS X 10.4 (ppc) [Tiger] / Darwin Kernel 8 / gcc 4.0
MacOS104x86 | Mac OS X 10.4 (x86) [Tiger] / Darwin Kernel 8 / gcc 4.0
MacOS105x86 | Mac OS X 10.5 (x86) [Leopard] / Darwin Kernel 9 / gcc 4.0
MacOS106 | Mac OS X 10.6 (x64) [Snow Leopard] / Darwin Kernel 10 / gcc 4.2
Win32_vc6 | Static library built with Microsoft Visual C++ 6 (static RTL/single thread)
Win32_vc7 | Static library built with Microsoft Visual C++ 7.1 (.NET 2003) (static RTL/single thread) Also compatible with Microsoft Visual C++ Toolkit 2003
Win32_vc8 | Static library built with Microsoft Visual C++ 8.0 (2005) (static RTL/multithread) Also compatible with Microsoft Visual C++ 2005 Express Edition
Win32_vc9 | Static library built with Microsoft Visual C++ 9.0 (2008) (static RTL/multithread) Also compatible with Microsoft Visual C++ 2008 Express Edition
Win32_vc10 | Static library built with Microsoft Visual C++ 10.0 (2010) (static RTL/multithread) Also compatible with Microsoft Visual C++ 2010 Express Edition - http://www.microsoft.com/express/vc/ ¹
Win32_dll6 | DLL and import library built with vc6, creates dependency with MSVCRT.DLL
Win32_dll7 | DLL and import library built with vc7, creates dependency with MSVCR71.DLL
Win32_dll8 | DLL and import library built with vc8, creates dependency with MSVCR80.DLL
Win32_dll9 | DLL and import library built with vc9, creates dependency with MSVCR90.DLL
Win32_dll10 | DLL and import library built with vc10, creates dependency with MSVCR100.DLL
Win64_vc8 | Same as Win32_vc8 but for 64-bits systems using the x64 standard.
Win64_vc9 | Same as Win32_vc9 but for 64-bits systems using the x64 standard.
Win64_vc10 | Same as Win32_vc10 but for 64-bits systems using the x64 standard.
Win64_dll8 | Same as Win32_dll8 but for 64-bits systems using the x64 standard.
Win64_dll9 | Same as Win32_dll9 but for 64-bits systems using the x64 standard.
Win64_dll10 | Same as Win32_dll10 but for 64-bits systems using the x64 standard.
Win32_gcc3 | Static library built with Cygwin gcc 3.4 (Depends on Cygwin DLL 1.5)
Win32_gcc4 | Static library built with Cygwin gcc 4.3 (Depends on Cygwin DLL 1.7) - http://www.cygwin.com/ ¹
Win32_cygw15 | Same as Win32_gcc3, but using the Cygwin Posix system and also with a DLL and import library
Win32_cygw17 | Same as Win32_gcc4, but using the Cygwin Posix system and also with a DLL and import library
Win32_dllg4 | DLL and import library built with Cygwin gcc 4.3 (See Win32_gcc4)
Win32_mingw3 | Static library built with MingW gcc 3.4
Win32_mingw4 | Static library built with MingW gcc 4.3 - http://www.mingw.org/ ¹ Also compatible with Dev-C++ - http://www.bloodshed.net/devcpp.html and with Code Blocks - http://www.codeblocks.org/ ¹
Win32_dllw4 | DLL and import library built with MingW gcc 4.3 (See Win32_mingw4)
Win32_owc1 | Static library built with Open Watcom 1.5 - http://www.openwatcom.org/
Win32_bc55 | Static library built with Borland C++ 5.5 Compiler - https://downloads.embarcadero.com/free/c_builder ¹
Win32_bc56 | Static library built with Borland C++ BuilderX 1.0 / Borland C++ 5.6 Compiler ¹,² (the C++ BuilderX IDE can also be configured to use mingw3 or gcc3 versions.)
Win32_bc6 | Static library built with Embarcadero C++ Builder 2010 / Embarcadero C++ 6 Compiler - https://downloads.embarcadero.com/free/c_builder (trial)
Win32_bin | Executables only for Windows NT/2000/XP/Vista/7 (can be generated by any of the above compilers)
Win64_bin | Same as Win32_bin but for 64-bits systems using the x64 standard
Win32_cygw15_bin | Executables only for Windows NT/2000/XP, but using the Cygwin Posix system (See Win32_cygw15)
Win32_cygw17_bin | Executables only for Windows NT/2000/XP, but using the Cygwin Posix system (See Win32_cygw17)

¹ - Notice that all the Windows compilers with links here are free to download and use.
² - Recently Borland removed the C++ Builder X from download. But if you bought a book that has the CD of the compiler, then it is still free to use.
3 - OpenMotif 2.2 is classified as 'experimental' by the Open Group.


CVS

The CVS repository is at SourceForge. It can also be interactively browsed at:

http://imtoolkit.cvs.sourceforge.net/imtoolkit/

To checkout use the module name "im" and the CVSROOT:

:pserver:anonymous@imtoolkit.cvs.sourceforge.net:/cvsroot/imtoolkit


History

History of Changes

Version 3.6.3 (09/Nov/2010)

  • New: function imImageCreateFromOpenGLData.
  • Changed: the function imConvertPacking now has one more parameter so src_depth can be different from dst_depth.
  • Fixed: imImageGetOpenGLData for some configurations.
  • Fixed: write support for alpha in TGA format. (Thanks to Nicolas Noble)

Version 3.6.2 (22/Jun/2010)

  • New: function imVideoCaptureReleaseDevices.
  • Changed: ICON format now supports writing up to 10 images.
  • Changed: replaced old "arg" usage for "..." to improve better compatibility with LuaJIT.
  • Changed: control of LOHs inclusion moved from the source code to the makefile.
  • Changed: removed compatibility with require"imlua51", now LuaBinaries must be used or LUA_CPATH must be set.
  • Changed: added compatibility with Lua 5.2.
  • Fixed: image:HasAlpha() method in Lua was returning a number instead of a boolean, so im.ImageCreateBased was adding an alpha channel to all new images.

Version 3.6.1 (23/Apr/2010)

  • Fixed: invalid memory access in imProcessResize when one dimension is equal to the original.
  • Fixed: imProcessCompose parameter parsing in Lua.
  • Fixed: invalid memory access when saving an image with the JPEG 2000 format.

Version 3.6 (26/Jan/2010)

  • New: function imImageCopyPlane.
  • New: function imProcessCompose.
  • New: function imImageSetAlpha.
  • Changed: libTIFF downgraded to version 3.8.2 because of the JPEG support in TIFF not working on the newer versions.
  • Changed: included alpha support in imProcessSplitComponents and imProcessMergeComponents. Included alpha support in all geometric and size operations.
  • Fixed: invalid memory access in imAnalyzeFindRegions when more than 16k regions where found.
  • Fixed: memory leak in imFileOpen.
  • Fixed: alpha support in image:CopyPlane() and in channel indexing in Lua.
  • Fixed: incomplete initialization of the array in imAnalyzeMeasureArea.
  • Fixed: imProcessRemoveByArea inside/outside logic.

Version 3.5 (02/Oct/2009)

  • New: functions imProcessUnsharp and imProcessSharp.
  • New: function imImageGetOpenGLData.
  • New: functions im.ConvertDataTypeNew, im.ConvertColorSpaceNew and im.ConvertToBitmapNew in Lua.
  • New: file attributes "FileFormat", "FileCompression" and "FileImageCount" when reading from file. Available for all formats.
  • New: ASCII compression for RAW format to access text data instead of binary.
  • Changed: libPNG updated to version 1.2.39. Removed changes to the library that made it incompatible with other libPNG distributions.
  • Changed: libLZF updated to version 3.5.
  • Changed: libJPEG updated to version 7.
  • Changed: libEXIF updated to version 0.6.17.
  • Changed: libTIFF updated to version 3.9.1.
  • Changed: library im_fftw3 to use an external library.
  • Changed: imImageCreateBased and imConvertColorSpace now also consider the alpha plane.
  • Changed: imProcessPrune renamed to imProcessRemoveByArea, and added a new parameter to select inside or outside the interval.
  • Changed: removed IM_UN_INC operation from imProcessUnArithmeticOp. It was not an unary operation. Can simply be done in place by imProcessArithmeticOp and IM_BIN_ADD.
  • Changed: now imProcessUnArithmeticOp, imProcessArithmeticConstOp and imProcessArithmeticOp willl crop the result to 0-255 if destiny has data type byte.
  • Fixed: PNG attribute TransparencyIndex. new PNG attribute TransparencyMap. TransparentColor renamed to TransparencyColor.
  • Fixed: invalid convertion from MAP to GRAY when loading imImages.
  • Fixed: new image size computation of im.ProcessCropNew in Lua.
  • Fixed: loading of RAW data.
  • Fixed: imImageClear to initialize data just like imImageCreate does.
  • Fixed: imImageReshape when the image has an alpha plane. Image is not cleared anymore.
  • Fixed: boolean parameters in file:ReadImageData, im.ConvertDataType, im.ConvertToBitmap, im.ProcessSplitComplex, im.ProcessQuantizeRGBUniform, im.ProcessBitPlane, im.ProcessRotateRef, im.ProcessRotate90, im.ProcessBinMorphConvolve, im.ProcessMergeComplex, im.CalcHistogram, im.CalcGrayHistogram and im.AnalyzeFindRegions in Lua. Changed im.Capture* functions to use boolean values in Lua.
  • Fixed: RAW format initialization.

Version 3.4.2 (26/Jun/2009)

  • Changed: removed "lua5.1.so" dependency in UNIX.
  • Fixed: AVI format when reading 32 and 16 bpp frames.
  • Fixed: xmin and ymin check in im.ProcessCrop and in im.ProcessInsert in Lua.

Version 3.4.1 (15/Dec/2008)

  • Changed: function imColorHSI_Smax removed from public, now it is used only internally. HSI space now uses S already normalized between 0-Smax.
  • Fixed: imColorHSI2RGB conversion.
  • Fixed: imConvertDataType when converting a floating point to integer, there were rounding problems.
  • Fixed: loading and saving two or more files of the same format at the same time.

Version 3.4 (14/Oct/2008)

  • New: imlua_avi, imlua_wmv and imlua_jp2 libraries so the respective formats can be dynamically loaded using require.
  • Changed: IMPORTANT - the "imlua_cd" library moved from IM to CD under the name "cdluaim".
  • Changed: IMPORTANT - the support services (Downloads, Mailing List and CVS) moved from LuaForge to SourceForge.
  • Changed: All dll8 and dll9 DLLs now have a Manifest file that specifies the correct MSVCR*.DLL.
  • Changed: Makefiles for UNIX now uses a compact version of Tecmake that does not need any installation, just type "make".
  • Changed: premake files are used now only internally and were removed from the distribution.
  • Changed: Copyright notice modified to reflect the registration at INPI (National Institute of Intellectual Property in Brazil). License continues under the same terms.
  • Fixed: reviewed and fixed the parameter checking of all IMLua processing functions. Also reviewed all IMLua parameter checking. Thanks to Lucas Lorensi.
  • Fixed: loading of TIFF format with old JPEG compression.
  • Fixed: loading and saving of PNM format when data in textual format and gray values are greatter than 255.
  • Fixed: Bicubic and Zero order interpolation for all geometric operations for pixels near the image border when increasing image size.
  • Fixed: Lua samples.
  • Fixed: ICON format in 64 bits Linux.

Version 3.3 (26/Nov/2007)

  • New: read support for ECW using the ERMapper ECW JPEG 2000 SDK.
  • Changed: libTIFF updated to version 3.8.2.
  • Changed: libPNG updated to version 1.2.22.
  • Changed: libJasper updated to libGeoJasper 1.4.0 (using Jasper version 1.900.1). Better support for counter progress, Geo tags and several speed improvements. New GeoTIFFBox and XMLPacket attributes.
  • Changed: renamed macro imPutImage to imcdCanvasPutImage, and added canvas as the first parameter.
  • Changed: renamed the imImage Lua methods to image:cdCanvasPutImageRect, image:wdCanvasPutImageRect and image:cdCanvasGetImage, and added canvas as the first parameter. Now imlua_cd depends on cdlua from CD version 5.0.
  • Changed: metatable names in Lua are now the same as the C struct names.
  • Changed: new read EXIF tags support in TIFF format (no write support yet). Renamed attributes "GeoTransMatrix" and "IntergraphMatrix", to "GeoTransformationMatrix" and "Intergraph TransformationMatrix" for libGeoTIFF compatibility. Better support for known TIFF tags. New support for reading one band of a multiband gray image in TIFF format. New support for DNG files.
  • Fixed: imConvertDataType gamma function when converting real to/from integer.
  • Fixed: small error at the image border when resampling, rotating or other geometric operations.
  • Fixed: imProcessCanny invalid division by zero when input image is all zero.
  • Fixed: imFileReadImageInfo when loading MAP images with a scrambled gray palette. They were incorrectly converted to GREY.
  • Fixed: support for IM_ALPHA and 32 bpp in ICO format.
  • Fixed: number of lines returned in imProcessHoughLinesDraw.

Version 3.2 (24/Nov/2006)

  • New: imProcessRotateRef to rotate relative to a reference point.
  • New: geometric distortion imProcessSwirl.
  • New: imProcessInterlaceSplit.
  • New: function imGaussianKernelSize2StdDev.
  • New: convolutions imProcessBarlettConvolve, imProcessPrewittConvolve, imProcessSplineEdgeConvolve, imProcessConvolveDual and imProcessConvolveSep.
  • New: "im_kernel.h" module with simple functions to create know pre-defined kernels like sobel, laplacian, gaussian, etc.
  • New: imVideoCaptureSetInOut to control input and output in capture devices.
  • New: function imBinMemoryRelease to release internal memory allocated by the BinMemory file when saving.
  • New: functions for capture device information: imVideoCaptureDeviceExDesc, imVideoCaptureDevicePath and imVideoCaptureDeviceVendorInfo.
  • New: function imFileOpenAs to open a file of a specific format.
  • New: functions imFormatRegisterInternal and imFormatRemoveAll to control format registration.
  • Changed: imProcessGaussianConvolve to used separable convolution and now is stddev is negative will use its magnitude as the kernel size. Removed Rep functions imProcessGaussianConvolveRep, imProcessDiffOfGaussianConvolveRep and imGaussianStdDev2Repetitions.
  • Changed: imProcessBlend to use an image instead of a constant. Old function renamed to imProcessBlendConst.
  • Changed: imFileHandle prototype. Now the function has an index parameter to specify which handle it should return. index=0 is always an imBinFile* handle. Use index=1 or greater to return other internal handles that are format dependent.
  • Changed: the Removed the include "im.h" to not include "im_lib.h". "im_lib.h" must be included when necessary.
  • Changed: imAnalyzeMeasureArea and imAnalyzeMeasurePerimeter prototypes to include the number of regions as a parameter. Fixed: these functions to internally initialize the results array to zero (this was necessary and not documented).
  • Changed: imProcessFlip and imProcessMirror so they can be done in-place.
  • Fixed: missing implementation of imVideoCaptureOneFrame in Lua 5.
  • Fixed: imAnalyzeFindRegions when pixel is at the width-1 column.
  • Fixed: file format identification when TIFF identification failed was not closing the file.
  • Fixed: imAnalyzeMeasurePerimeter when perimeter line is at the first or last lines. Thanks to Takeshi Mitsunaga.
  • Fixed: invalid return value in imVideoCaptureConnect in Lua 5.
  • Fixed: imProcessRotate for IM_MAP images.
  • Fixed: Lua binding of imFileImageSave, wrong parameters order. New: image:Save(filename, format) alias for imImage objects.
  • Fixed: BMP format implementation when reading and writing RGBA 32 bits images.
  • Fixed: imFileLoadImageFrame and imFileLoadBitmapFrame index parameter in Lua.
  • Fixed: alpha channel allocation in imImage.

Version 3.1 (12/Dez/2005)

  • New: Download, Discussion List, Submission of Bugs, Support Requests and Feature Requests, are now available thanks to the LuaForge site.
  • New: Binding for Lua 5
  • New: support for alpha in imImage.
  • New: organization of the documentation.
  • New: in ICON format the TransparencyIndex is used to for IM_MAP images without an alpha channel.
  • New: video capture functions: imVideoCaptureFormatCount, imVideoCaptureGetFormat and imVideoCaptureSetFormat, to access the available capture video formats.
  • New: functions imFileLoadImageFrame and imFileLoadBitmapFrame to reuse the image data when loading.
  • New: function imFileImageSave.
  • New: function imImageCreateBased.
  • New: imProcessInsert.
  • New: compression functions imCompressDataLZF and imCompressDataUnLZF, using libLZF.
  • New: module for imBinFile, IM_FILEHANDLE that allows to access an already opened file using the system file handle as file name. Thanks to Frederico Abraham.
  • Changed: in JPEG file format YcbCr are now automatically converted to RGB when loaded. RGB images were already automatically converted to YCbCr when saved. Now this behavior can be controlled by the AutoYCbCr attribute.
  • Changed: the imAnalyzeFindRegions to include an additional parameter that control if regions touching the border are computed or not. The function imProcessPrune now will only eliminate the regions in the selected size range.
  • Changed: third party libraries, updated to newest versions: libExif, libTIFF, libPNG and zlib. Added OLD JPEG support in libTIFF.
  • Changed: optimization flags to ON when building the library in all platforms.
  • Changed: imProcessPerimeterLine, imAnalyzeMeasurePerimeter, imAnalyzeMeasurePerimArea, imAnalyzeMeasureCentroid and imAnalyzeMeasurePrincipalAxis to consider pixels that touch the borders.
  • Changed: macro name cdPutBitmap to imPutBitmap.
  • Changed: function names imImageLoad and imImageLoadBitmap, to imFileImageLoad and imFileImageLoadBitmap.
  • Fixed: overflow in imCalcImageStatistics fo IM_INT and IM_USHORT images.
  • Fixed: error management in system file I/O in UNIX.
  • Fixed: some small defines for 64-bits compatibility in libExif, libPNG and libJPEG.
  • Fixed: incorrect interpretation of 16 bit data from PNG files.
  • Fixed: imFileReadImageInfo can be called many times with the same index that will return the correct result without accessing the file again.
  • Fixed: small bug in sample iupglcap.
  • Fixed: TIFF format read for images with multiple bands in ExtraSamples.
  • Fixed: ICON format can_sequence was 0.
  • Fixed: imProcessMergeHSI and imProcessSplitHSI documentation, and implementation for IM_BYTE images.
  • Fixed: imProcessRangeContrastThreshold, imProcessLocalMaxThreshold and imProcessRankClosestConvolve when processing near the border.
  • Fixed: invalid file permissions in UNIX when saving a new file.
  • Fixed: name for imProcessLocalMaxThresEstimate.
  • Fixed: imProcessReduceBy4 for images with odd width and/or height.
  • Fixed: imAttribTableSet when replacing an attribute (thanks to Takeshi Mitsunaga).
  • Fixed: memory leaks in imConvertToBitmap and imConvertDataType (thanks to Takeshi Mitsunaga).
  • Fixed: imProcessZeroCrossing for the last pixel column (thanks to Takeshi Mitsunaga). Also fixed for some crossings that were lost.
  • Fixed: imProcessGrayMorphConvolve for IM_FLOAT images with IM_FLOAT kernel (thanks to Takeshi Mitsunaga).

Version 3.0.3 (14/Oct/2004)

  • New: Image Transform imProcessDistanceTransform.
  • New: group of functions Image Analysis: imAnalyzeFindRegions, imAnalyzeMeasureArea, imAnalyzeMeasurePerimArea, imAnalyzeMeasureCentroid, imAnalyzeMeasurePrincipalAxis, imAnalyzeMeasureHoles, imProcessPerimeterLine, imAnalyzeMeasurePerimeter, imProcessPrune, imProcessFillHoles.
  • New: imConvertMapToRGB to help loading data as RGB.
  • New: sample iupglcap.
  • New: imProcessRenderChessboard and imProcessRenderGrid.
  • Changed: imProcessThreshold, imProcessRangeContrastThreshold and imProcessLocalMaxThreshold now also supports IM_USHORT and IM_INT data types.
  • Changed: the default color conversion to binary so it can be done for all color spaces.
  • Changed: im_process.h to split into 4 files: im_process_pont.h, im_process_loc.h, im_process_glo.h, im_process_ana.h. But it still exists and includes the new files for compatibility.
  • Changed: the border extensions in several types of convolution. Rank convolution do not extend the borders. Binary morphology use zero extension. Gray morphology do not extend the borders.
  • Fixed: file read with bitmap conversion when original data changes only data type.
  • Fixed: rank convolution operations that did not accept even kernel sizes.
  • Fixed: imProcessHoughLinesDraw that was ignoring some lines.

Version 3.0.2 (25/Aug/2004)

- New: utility functions imPaletteHighContrast, imImageLoadImage and imImageLoadBitmap.
- New: operation imProcessNormalizeComponents.
- Changed: name imProcessGaussianConvolve to imProcessGaussianConvolveRep. New: operation imProcessGaussianConvolve that uses a float kernel. New: utility functions imGaussianStdDev2Repetitions and imGaussianStdDev2KernelSize.
- Changed: name imProcessDiffOfGaussianConvolve to imProcessDiffOfGaussianConvolveRep. New: operation imProcessDiffOfGaussianConvolve that uses a float kernel.
- Changed: IM_GAMUT_BRIGHTCONT parameters to the interval [-100,100]. Fixed: IM_GAMUT_EXPAND and IM_GAMUT_BRIGHTCONT normalization.
- Changed: logical operations, flag IM_BIT_NOT replaced by operation imProcessBitwiseNot.
- Changed: imImageSetAttribute count can be -1 for zero terminated data.
- Fixed: operations imProcessBitwiseNot and imProcessNegative for IM_BINARY images.
- Fixed: the color_mode_flags parameter interpretation by imFileReadImageData.
- Fixed: imProcessEqualizeHistogram and imProcessExpandHistogram for color images.
- Fixed: imProcessMultipleStdDev.
- Fixed: imProcessDifusionErrThreshold for IM_GRAY images.
- Fixed: "KRN" format, internal format is topdown.
- Fixed: initialization of TGA image_count.

Version 3.0.1 (22/Apr/2004)

- Improved compatibility with the old version, it was missing the load of Map images with imLoadRGB.
- The FFTW code was from version 2.1.3, not from 2.1.5 as suposed, it was updated. The FFT functions were condensed in only one file with an "#ifdef" for FFTW version 2 and 3. The FFT functions also were renamed to remove the "W" that belongs only to the FFTW library.
- The SetAttribute functions now accept NULL in data to remove the attribute.
- New: imProcessCrossCorrelation and imProcessAutoCorrelation functions.
- The imCalcGrayHistogram function now can calculate the histogram of IM_MAP and IM_BINARY images.

Version 3.0 (April 2004)

A major rewrite of the library. Everything changed, check the manual, but backward compatibility is kept for old applications. A new API more flexible, new formats, support for attributes and video, image capture and image processing. New: color spaces and data types. The library now got a professional look for scientific applications.

Version 2.6 (May 2002)

Correction of bug in resolution reading and writing for format JPEG.

Version 2.5 (August 2001)

Correction of bug in the default GIF compression. Two new callbacks: transparency color index for GIF files and image description for TIFF files.

Version 2.4 (February 2000)

Change in the treatment of LZW compression in formats TIFF and GIF. Now compression is no longer the default.

Version 2.3 (June 1998)

Close function of the access driver for files in memory corrected. JPEG library updated to 6b. Correction of a problem with the reading of some JPEG files.

Version 2.2 (November 1997)

The definition of the counter callback was changed to inform, in a parameter, the type of access being performed, either reading or writing. Type imCallback defined to make type casting easier when using function imRegisterCallback. Correction of a problem with the makefile in UNIX, which was generating link errors in some platforms.

Version 2.1 (October 1997)

Correction of a problem with internal memory liberation when reading Map images in TIFF files. Conversion RGB to Map is now made using the algorithm implemented by LibJPEG. The algorithm of imResize was improved for cases in which the size is being reduced instead of increased. Correction of a problem with functions imImageInfo and imFileFormat: when the provided file was not in a format recognized by IM, there was an error in format TGA which caused these functions to access an invalid memory area.

Version 2.0 (September 1997)

The library was virtually rewritten to implement a new structure which allowed greater flexibility, simplifying the addition of new formats. Formats TGA, PCL, JPEG and LED were added to the list of supported formats, and new functions were added: imMap2RGB, imRGB2Gray, imMap2Gray, imResize, imStretch.

Version 1.1 (June 1996)

Small corrections to increase portability. Changes in return codes. Identifiers were created to return codes and predefined parameters. Online manual concluded.

Version 1.0 (October 1995)


To Do

General

  • MOV (using QuickTime SDK and QT4Linux)
  • DICOM
  • TIFF Annotations
  • Linux Capture (using Video4Linux)
  • Use libavcodec and libavformat in Linux. AVI using libavifile in Linux (UNIX ?)
  • MPEG-2 (using MSSG?)
  • VC-1 Coded using Microsoft VC-1 Encoder SDK
  • In SunOS using the Sun WorkShop 6 C++, an error occurs when linking an application.
  • In AIX we do not have the C++ for AIX installed, so the library is not available.

For the Processing library:

  • Support for OpenMP
  • Support for the Intel® Integrated Performance Primitives
  • Dithering Techniques
  • Adaptative Thresholds
  • Warping
  • Rolling Ball Filter
  • Butterworth, Deconvolution
  • Inverse Filter, Homomorphic Restoration
  • Watershed, Convex Hull
  • Other Measures

Our plans for the future include:

  • Imaging Tutorial in the documentation
  • JPEG and TIFF Thumbnails
  • Formats: FLI, DV, FPX (Flash Pix), EXR (Industrial Light & Magic High Dynamic Range Format), MNG, Microsoft HD Photo
  • ECW write
  • OpenML?
  • WIA and TWAIN?

Suggestions? im@tecgraf.puc-rio.br


Other Toolkits

Comparing IM with Other Imaging Toolkits

Still today there is a need for something easier to code and understand in Imaging. The available free libraries are sometimes close, sometimes very far from “easier”. IM is an unexplored solution and proposed as a simple and clean one. It is another Imaging tool with a different approach to the many possibilities in the area. Its organization was designed so it can be used for teaching Imaging concepts. We invite you to try it.

First we list some libraries mainly target for storage, then some scientific libraries, and then a small comparsion of IM and those libraries.

Here are some free storage libraries:

Imlib2

Last Update 2003-09 / Version 1.1.0
http://www.enlightenment.org/pages/imlib2.html
Language C
Documentation is terrible. Depends on the X-Windows System libraries.
It is designed for display/rendering performance.

Corona

Last Update 2003-09 / Version 1.0.2
http://corona.sourceforge.net/
Language C++
Very simple library. Only a few formats. Only bitmap images, no video.

PaintLib

Last Update 2004-04 / Version 2.61
http://www.paintlib.de/paintlib/
Language C++
A very simple library.
Has an interesting ActiveX component. Only bitmap images, no video.

NetPBM

Last Update 2004-07 / Version 10.23
http://netpbm.sourceforge.net/
Language C
A traditional library that starts at the Pbmplus package more than 10 years ago.
Very stable, it has support for the PNM format family and many processing operations.
Only bitmap images, no video.

DevIL ***

Last Update 2004-06 / Version 1.6.7
http://openil.sourceforge.net/
Language C (Has also a C++ Wrapper)
Called initially OpenIL. Supports many formats and have a very interesting API, that works very similar the OpenGL API (that's why the original name). Also supports the display in several graphics systems. Has several data types as OpenGL has.

FreeImage ***

Last Update 2004-07 / Version 3.4.0
http://freeimage.sourceforge.net/
Language C (Has also a C++ Wrapper)
Supports many formats. Many data types, but only RGB and subclasses (gray, map, etc).
Very well written, stable and simple to use.

ImageMagick and GraphicsMagick ***

Last Update 2004-07 / Version 6.0.3 || Last Update 2004-04 / Version 1.0.6
http://www.imagemagick.org/ || http://www.graphicsmagick.org/
Language C (Has also a C++ Wrapper)
The two libraries are listed together because GraphicsMagick is totally and explicitly based on ImageMagick version 5.5.2.
They have very similar or identical APIs but the development process is completely different. GraphicsMagick propose a more organized development process (a more precise comparison requires detailed knowledge about the two libraries).
These are very complete libraries. They support lots of file formats, several color spaces, but use only the byte data type.
They use a big image structure with everything inside. Image creation may involve about 40 parameters.

And here are some free scientific libraries:

TINA

Last Update 2002-03 / Version 4.0.2
http://www.niac.man.ac.uk/Tina
Language C
Very UNIX oriented. Lots of functions for Computer Vision. Developed by a researcher of the University of Manchester.

XITE

Last Update 2002-09 / Version 3.44
http://www.ifi.uio.no/forskning/grupper/dsb/Software/Xite/
Language C
Very UNIX oriented, but compiles fine in Windows. Several separated command line routines, it is a package not a library. But inspired several aspects of the IM library. Seems to be not updated anymore. Developed by a researcher of the University of Oslo.

VIGRA

Last Update 2004-09 / Version 1.3.0
http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/
Language C++
STL based. Many operators. Developed by a researcher of the University of Hamburg.

Wild Magic

Last Update 2004-09 / Version 2.4
http://www.magic-software.com/
Language C++
Game development oriented, very rich in mathematics. Developed by Magic Software, Inc.

VIPS

Last Update 2004-09 / Version 7.10.2
http://www.vips.ecs.soton.ac.uk/
Language C/C++
Support for very large images. Powerful macro laguage. Good implementation. Many functions. Developed by researchers at the University of Southampton and The National Gallery in the UK.

MegaWave2

Last Update 2004-06 / Version 2.3
http://www.cmla.ens-cachan.fr/Cmla/Megawave/
Language C
Very UNIX oriented. Good implementation. Many functions. C preprocessor. Developed by French researchers at l'École Normale Supérieure de Cachan.

JAI

Last Update 2003-07 / Version 1.1.2
http://java.sun.com/products/java-media/jai/index.jsp
Language Java
It is becoming more and more popular. Java is slow than C/C++ but the performance of the image processing operations is very acceptable. Also it has several C optimized functions. Developed by the Sun Corporation.

OpenCV ***

Last Update 2004-08 / Version 4.0
http://sourceforge.net/projects/opencvlibrary/
Language C/C++
Only a few formats but lots of image processing operations. One of the most interesting libraries available. It is more than an Imaging library, it is designed for Computer Vision. Developed by Intel Russian researchers.

VTK ***

Last Update 2004-03 / Version 4.2
http://www.vtk.org/
Language C++
Another very important library. Very huge. Much more than Imaging, includes also 3D Computer Graphics and Visualization. Has a book about the library. Developed by Kitware Inc.

IM

Last Update 2004-08 / Version 3.0.2
http://www.tecgraf.puc-rio.br/im
Language C/C++
Support for several data types, i.e. scientific images and different color spaces. Support for input and output of image sequences. Support for generic image attributes (metadata), which includes several standard TIFF tags, GeoTIFF tags and Exif tags. Image storage and capture data can be accessed using an image structure or with raw data. Internal implementation in C++ but with a simple C API. Code is portable for Windows and UNIX. Many image processing operations.

Comparsion

The idea behind IM was to create a toolkit that was not so complex as OpenCV, neither so big as VTK, but that can be used as a solid base to the development of thesis and dissertations, as for commercial applications.

As the academic environment is very heterogeneous the IM project choose some directives:

  • Portability (Windows and UNIX)
  • C API
  • Totally Free, Open Source
  • Focus in Scientific Applications
  • Easy to Learn
  • Easy to Reuse

Considering these directives there are only a few similar toolkits. Making some exceptions the following should be mentioned:

  • JAI - Java, Sun.com
  • VIGRA - C++ / STL Based, University
  • VIPS - Large Images / Macros, University
  • VTK - C++ / Huge / Visualization, Kitware.com
  • OpenCV – “best” similar choice, Intel.com

Today OpenCV and VTK are the most professional and complete choices of free libraries that are similar to IM. But they are more complicated than IM. For instance VTK it is very large, it has about 700 C++ classes.

Although OpenCV has many resources, its code is very hard to reuse. The simplicity of the IM code, mainly the image processing routines, make it a good reference to be reused by other applications extracting only the code needed with little changes. And can be used as an complement to learn image processing algorithms and techniques.

This page was last updated in Sep 2004.


Guide

Getting Started

It is important to understand that IM is based in 4 concepts: Image Representation, Image Storage, Image Processing and Image Capture. The following picture illustrates the relation between theses concepts.

IM does not have support for Image Visualization, because we think this is a task for a graphics library like OpenGL, Windows GDI or CD - Canvas Draw.

Image Representation describes the image model and its details. Which color systems are going to be used, which data types, how the data is organized in memory, and how other image characteristics are accessed.

Image Storage describers the file format model and how images are obtained or saved. Image Capture describes the access to a capture device and obtaining an image from it. Image Processing describes the image processing operations.

There are infinite ways to implement these concepts. There is no common definition in the literature, but there is a standard called Programmer's Imaging Kernel System (PIKS) published at the ISO/IEC 12087. PIKS is a very complete and also complex standard, very hard to implement. There are only a few implementations available, and the one that I know is commercial software, Pixel Soft of William Pratt http://www.pixelsoft.com/, also author of several books on the subject.

But we want something easier to implement and understand. The free available libraries that we found where sometimes close to what we want, sometimes very far. So we developed our own.

The documentation contains Overview, Guide, Samples and Reference sections for each one of the IM concepts.

The Guide is where you are going to find the explanation about the concepts and decisions made during the library design. It is the best place to understand how things works.

The Reference contains pure essential information for function and structure usage. But there is no information on how to put the functions to work together. It is generated automatically from the source code using Doxygen, this means also that the include files (*.h) are very well commented.

Building Applications

Inside you code you should at least include the <im.h> header and link with the "im.lib/libim.a/libim.so" library. This library contains all the Image Representation functions and all the Image Storage functions (with the exception of the external formats: AVI, JP2 and WMV).

Each external format or processing usually needs a <im_xx.h> file and a "im_xx.lib/libim_xx.a/libim_xx.so" file.

Even if your application is only in C, you must link with a C++ capable linker. Using Tecmake set "LINKER := g++" in your "config.mak" when compiling with gcc (UNIX and Windows).

The download files list includes the Tecgraf/PUC-Rio Library Download Tips document, with a description of all the available binaries.

Building the Library

In the Downloads you will be able to find pre-compiled binaries for many platforms, all those binaries were built using Tecmake. Tecmake is a command line multi compiler build tool based on GNU make, available at http://www.tecgraf.puc-rio.br/tecmake. Tecmake is used by all the Tecgraf libraries and many applications.

In UNIX, you do not need to install Tecmake, a version for Posix systems is already included in the source code package. Just type "make" in the command line on the "src" folder and all libraries will be build. Set the TECTOOLS_HOME environment variable to the folder were the Lua libraries are installed, by default it will assume "TECTOOLS_HOME=../..".

In Linux, check the "Building Lua, IM, CD and IUP in Linux" guide.

In Windows, the easiest way to build everything is to install the Tecmake tool into your system. It is easy and helps a lot. The Tecmake configuration files (*.mak) available at the "src" folder are very easy to understand also. There are files named make_uname.bat that build the libraries using Tecmake. To build for Windows using Visual C 9.0 (2008) for example, just execute "make_uname vc9" , or for the DLLs type "make_uname dll9". The Visual Studio workspaces with the respective projects available in the source package is for debugging purposes only.

If you don't want to install Tecmake you can use the version for Windows systems that is included in the source code package. BUt is is more complicated that its Posix counterpart. First the GNU make must be installed and in the PATH before other makes. In the command line you must specify the compiler path and the TEC_UNAME variable. For example:

make -f tecmakewin.mak TEC_UNAME=mingw4 MINGW4=c:/mingw
make -f tecmakewin.mak TEC_UNAME=gcc4 GCC4=c:/cygwin           (Cygwin building for Win32)

Make sure you have all the dependencies for the library you want installed, see the documentation bellow.

If you are going to build all the libraries, the makefiles and projects expect the following directory tree:

\mylibs\
        im\
        lua5.1\

Libraries Dependencies

im -> libjpeg (included)
   -> libpng  (included)
   -> libtiff (included)
   -> zlib    (included)
   -> liblzf  (included)
   -> libexif (included)
im_jp2 -> im
       -> libJasper (included)
im_avi -> im
       -> vfw32 (system - Windows)
im_wmv -> im
       -> wmvcore (system - Windows)
im_ecw -> im
       -> NCSEcw (system)
im_capture -> strmiids (system - Windows)
im_process -> im
im_fftw -> im
        -> fftw (included)
imlua51 -> im
        -> lua5.1
imlua_capture51 -> imlua51
                -> im_capture
imlua_fftw51 -> imlua51
             -> im_fftw
imlua_process51 -> imlua51
                -> im_process

As a general rule (excluding system dependencies and included third party libraries): IM has NO external dependencies, and IMLua depends on Lua.

The Lua binding for IM (Makefiles and Pre-compiled binaries) depend on the LuaBinaries distribution. So if you are going to build all use the LuaBinaries source package also, not the Lua.org original source package. If you like to use another location for the Lua files define LUA_SUFFIX, LUA_INC, LUA_LIB and LUA_BIN before using Tecmake or Tecmake Compact.

CD Compatibility

IM version 2 was designed to perfectly work with the CD - Canvas Draw toolkit. Version 3 has many more options and only for a subset of the images called Bitmaps can be used with the CD functions. Theses images have data type IM_BYTE, and color mode IM_RGB, IM_GRAY, IM_MAP or IM_BINARY. They can not have the flags IM_TOPDOWN and IM_PACKED. But it can have the flag IM_ALPHA for IM_RGB images.

You can convert an image to a bitmap version of it using the function imConvertToBitmap, see Image Representation / Conversion.

Function cdCanvasGetImageRGB captures an image from the active canvas. Functions cdCanvasPutImageRect* draw a client image on the active canvas. These functions allow reducing or increasing the image when drawing.

For applications in systems with only 256 colors available, we recommend the use of function cdCanvasPalette before drawing the image, to improve its quality.

When using the imImage structure the macro imcdCanvasPutImage can be used. It is defined as:

#define imcdCanvasPutImage(_canvas, _image, _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax)     \
  {                                                                         \
    if (_image->color_space == IM_RGB)                                      \
    {                                                                       \
      if (image->has_alpha)                                                 \
        cdCanvasPutImageRectRGBA(_canvas, _image->width, _image->height,    \
                          (unsigned char*)_image->data[0],                  \
                          (unsigned char*)_image->data[1],                  \
                          (unsigned char*)_image->data[2],                  \
                          (unsigned char*)_image->data[3],                  \
                          _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax);      \
      else                                                                  \
        cdCanvasPutImageRectRGB(_canvas, _image->width, _image->height,     \
                          (unsigned char*)_image->data[0],                  \
                          (unsigned char*)_image->data[1],                  \
                          (unsigned char*)_image->data[2],                  \
                          _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax);      \
    }                                                                       \
    else                                                                    \
      cdCanvasPutImageRectMap(_canvas, _image->width, _image->height,       \
                        (unsigned char*)_image->data[0], _image->palette,   \
                        _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax);        \
  }

CD Library is the Tecgraf 2D graphics library available at http://www.tecgraf.puc-rio.br/cd.

OpenGL Compatibility

The function glDrawPixels accepts several data types and color modes. Here are the format and type mapping for OpenGL usage:

           IM             <->  OpenGL
        color_mode             format
IM_RGB|IM_ALPHA|IM_PACKED  = GL_RGBA
IM_RGB|IM_PACKED           = GL_RGB
IM_GRAY                    = GL_LUMINANCE
IM_GRAY|IM_ALPHA|IM_PACKED = GL_LUMINANCE_ALPHA
        data_type              type
IM_BYTE                    = GL_UNSIGNED_BYTE
IM_BINARY                  = GL_BITMAP
IM_USHORT                  = GL_UNSIGNED_SHORT
IM_INT                     = GL_INT
IM_FLOAT                   = GL_FLOAT

There is no mapping for non IM_PACKED images so if you use unpacked planes (ex: you use the imImage structure) then you have to convert one data into another, the function imConvertPacking does this, so you just have to keep an extra buffer for the display image and call this function only when your original image has changed. See Image Representation / Conversion. For example:

imConvertPacking(image->data[0], gl_data, image->width, image->height, image->depth, image->data_type, 0);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); /* data alignment must be 1 */

glDrawPixels(image->width, image->height, GL_RGB, GL_UNSIGNED_BYTE, gl_data);

When loading color image data you can use the function imConvertMapToRGB to convert in-place IM_MAP image data into IM_RGB after loading it from file. For example:

if (imColorSpace(color_mode) == IM_MAP)
{
  long palette[256];
  int palette_count, packed = 1; /* OpenGL uses packed RGB */
  imFileGetPalette(ifile, palette, &palette_count);
  imConvertMapToRGB(gl_data, width*height, depth, packed, palette, palette_count);
}

If you are using the imImage structure then you can instead use the function imImageGetOpenGLData.

If you just want to save your OpenGL buffer then you can use:

glPixelStorei(GL_PACK_ALIGNMENT, 1); /* data alignment must be 1 */
glReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, gl_data);

ifile = imFileNew(filename, format, &error);
error = imFileWriteImageInfo(ifile, width, height, IM_RGB|IM_PACKED, IM_BYTE);
error = imFileWriteImageData(ifile, gl_data);
imFileClose(ifile);

And when using the imImage structure then you can instead use the function imImageCreateFromOpenGLData. For instance:

glPixelStorei(GL_PACK_ALIGNMENT, 1); /* data alignment must be 1 */
glReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, gl_data);

imImage* image = imImageCreateFromOpenGLData(width, height, GL_RGB, gl_data);
error = imFileImageSave(filename, format, image);

You can also do this inside a loop to create an animation.

IM 2.x Compatibility

In version 3.0 the library was completely rewritten. And we changed the main API to allow more powerful features. But the old API is still available for backward compatibility. Version 3 is also binary compatible with version 2.

The only change that must be updated in old applications if they where recompiled is some error code definitions. If you use them in a case there will cause a compiler error because IM_ERR_READ and IM_ERR_WRITE are now defined as IM_ERR_ACCESS both.

Migrating OLD Code

The old API is very inefficient because the file is opened and close three times, for: imFileInfo, imImageInfo and imLoadRGB/imLoadMap. There is no room for attributes, so we use the callbacks. And we can not load sequences of images. For these reasons we change the API.

If you would like to migrate your code using the old API the most important thing to change is the memory allocation. For RGB images instead of allocating 3 separate pointers you should allocate only one pointer with room for all three planes. If you still want to keep the three pointers, just do green = red + width*height and blue = red + 2*width*height.

Also you should change your callbacks usage for attributes access using imFileGetAttribute and imFileSetAttribute. IM_RESOLUTION_CB is replaced by the attributes "XResolution", "YResolution", "ResolutionUnit". IM_GIF_TRANSPARENT_COLOR_CB is replaced by "TransparencyIndex" and IM_TIF_IMAGE_DESCRIPTION_CB by "Description".

Except IM_COUNTER_CB that is not an attribute, still works with a callback, but now we implement a counter system for all the library including loading, saving and processing. The user just use the imCounterSetCallback (like before) to register it counter callback, now there are a few more parameters and a user data pointer. See Utilities / Counter.

The function calls to imImageInfo and imLoadRGB/imLoadMap will be replaced by a sequence of function calls to imFileOpen/imFileNew, imFileReadImageInfo/imFileWriteImageInfo, imFileReadImageData/imFileWriteImageData and imFileClose. See Image Storage.

Names Convention

To improve the readability of the code we use a very simple naming convention:

  • Global Functions and Types - "im[Object][Action]" using first capitals (imFileOpen)
  • Local Functions and Types - "i[Object][Action]" using first capitals (iTIFFGetCompIndex)
  • Local Static Variables - same as local functions and types (iFormatCount)
  • Local Static Tables - same as local functions and types with "Table" suffix (iTIFFCompTable)
  • Variables and Members - no prefix, all lower case (width)
  • Defines and Enumerations - all capitals (IM_ERR_NONE)

C x C++ Usage

The library main API is in C. We adopt this because of the many C programmers out there. Some of the API is also available in C++ for those addicted to classes.

Internally C++ is used to implement the format driver base architecture. A virtual base class that every drivers inherits from. This made a lot of things easier to the driver development. But we keep it simple, no multiple inheritance, no exception handling, no complicated classes.

But because we need several data types C++ templates were inevitable used (since we do not like long macros everywhere). But they are used only for processing functions, not classes.


Guide

Building Lua, IM, CD and IUP in Linux

This is a guide to build all the Lua, IM, CD and IUP libraries in Linux. Notice that you may not use all the libraries, although this guide will show you how to build all of them. You may then choose to build specific libraries.

The Linux used as reference is the Ubuntu distribution.

System Configuration

To build the libraries you will have to download the development version of some packages installed on your system. Although the run time version of some of these packages are already installed, the development versions are usually not. The packages described here are for Ubuntu, but you will be able to identify them for other systems as well.

To build Lua you will need:

libreadline5-dev

To build IM you will need:

g++

To build CD you will need:

libfreetype6-dev
libx11-dev
libxpm-dev
libxmu-dev
  libxft-dev (for the XRender driver, OPTIONAL)
libgtk2.0-dev (for the GDK driver)

To build IUP you will need:

libgtk2.0-dev (for the GTK driver) [already installed for CD]
  libmotif-dev and x11proto-print-dev (for the Motif driver, OPTIONAL)
libgl1-mesa-dev and libglu1-mesa-dev (for the IupGLCanvas)

To install them you can use the Synaptic Package Manager and select the packages, or can use the command line and type:

sudo apt-get install package_name

Source Download

Download the "xxx-X.X_Sources.tar.gz" package from the "Docs and Sources" directory for the version you want to build. Here are links for the Files section in Source Forge:

Lua - http://sourceforge.net/projects/luabinaries/files/
IM - http://sourceforge.net/projects/imtoolkit/files/
CD - http://sourceforge.net/projects/canvasdraw/files/
IUP - http://sourceforge.net/projects/iup/files/

Unpacking

To extract the files use the tar command at a common directory, for example:

mkdir -p xxxx
cd xxxx

[copy the downloaded files, to the xxxx directory]

tar -xpvzf iup-3.2_Sources.tar.gz
tar -xpvzf cd-5.4_Sources.tar.gz
tar -xpvzf im-3.6.2_Sources.tar.gz
tar -xpvzf lua5_1_4_Sources.tar.gz    [optional, see note bellow]

If you are going to build all the libraries, the makefiles and projects expect the following directory tree:

/xxxx/
      cd/
      im/
      iup/
      lua5.1/    [optional, see note bellow]

If you unpack all the source packages in the same directory, that structure will be automatically created.

Lua

Although we use Lua from LuaBinaries, any Lua installation can also be used. In Ubuntu, the Lua run time package is:

lua5.1

And the Lua development package is:

liblua5.1-0-dev

To use them, instead of using the directory "/xxxx/lua5.1" described above, you will have to define some environment variables before building IM, CD and IUP:

export LUA_SUFFIX=
export LUA_INC=/usr/include/lua5.1

Building

As a general rule (excluding system dependencies): IUP depends on CD and IM, and CD depends on IM. So start by build IM, then CD, then IUP.

To start building go the the "src" directory and type "make". In IUP there are many "srcxxx" folders, so go to the up directory "iup" and type "make" that all the sub folders will be built. For example:

cd im/src
make
cd ../..

cd cd/src
make
cd ../..

cd iup
make
cd ..

TIP: Instead of building all the libraries, try building only the libraries you are going to use. The provided makefiles will build all the libraries, but take a look inside them and you will figure out how to build just one library.

Pre-compiled Binaries

Instead of building from sources you can try to use the pre-compiled binaries. Usually they were build in the latest Ubuntu versions for 32 and 64 bits. The packages are located in the "Linux Libraries" directory under the Files section in Source Forge, with "xxx-X.X_Linux26g4_lib.tar.gz" and "xxx-X.X_Linux26g4_64_lib.tar.gz" names.

Do not extract different pre-compiled binaries in the same directory, create a subdirectory for each one, for example:

mkdir iup
cd iup
tar -xpvzf ../iup-3.2_Linux26g4_lib.tar.gz
cd ..

mkdir cd
cd cd
tar -xpvzf ../cd-5.4_Linux26g4_lib.tar.gz
cd ..

mkdir im
cd im
tar -xpvzf ../im-3.6.2_Linux26g4_lib.tar.gz
cd ..

For the installation instructions bellow, remove the "lib/Linux26g4" from the following examples if you are using the pre-compiled binaries.

Installation (System Directory)

After building you can copy the libraries files to the system directory. If you are inside the main directory, to install the run time libraries you can type, for example:

sudo cp -f iup/lib/Linux26g4/*.so /usr/lib               [script version: install ]
sudo cp -f cd/lib/Linux26g4/*.so /usr/lib
sudo cp -f im/lib/Linux26g4/*.so /usr/lib

To install the development files, then do:

sudo mkdir -p /usr/include/iup                           [script version: install_dev ]
sudo cp -f iup/include/*.h /usr/include/iup
sudo cp -f iup/lib/Linux26g4/*.a /usr/lib

sudo mkdir -p /usr/include/cd
sudo cp -f cd/include/*.h /usr/include/cd
sudo cp -f cd/lib/Linux26g4/*.a /usr/lib

sudo mkdir -p /usr/include/im
sudo cp -fR im/include/*.h /usr/include/im
sudo cp -f im/lib/Linux26g4/*.a /usr/lib

Then in your makefile use -Iiup -Icd -Iim for includes. There is no need to specify the libraries directory with -L. Development files are only necessary if you are going to compile an application or library in C/C++ that uses there libraries. To just run Lua scripts they are not necessary.

Installation (Build Directory) [Alternative]

If you don't want to copy the run time libraries to your system directory, you can use them from build directory. You will need to add the run time libraries folders to the LD_LIBRARY_PATH, for example:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/xxxx/iup/lib/Linux26g4:/xxxx/cd/lib/Linux26g4:/xxxx/im/lib/Linux26g4

And in your makefile will will also need to specify those paths when linking using -L/xxxx/iup/lib/Linux26g4, and for compiling use -I/xxxx/iup/include.

Installation (Lua Modules)

Lua modules in Ubuntu are installed in the "/usr/lib/lua/5.1" directory. So to be able to use the Lua "require" with IUP, CD and IM you must create symbolic links inside that directory.

sudo mkdir -p /usr/lib/lua/5.1                          [script version: config_lua_module ]
cd /usr/lib/lua/5.1

sudo ln -fs /usr/lib/libiuplua51.so iuplua.so
sudo ln -fs /usr/lib/libiupluacontrols51.so iupluacontrols.so
...

Using those links you do not need any extra configuration.

Installation (Lua Modules) [Alternative]

If you use the alternative installation directory, and you also do NOT use the LuaBinaries installation, then you must set the LUA_CPATH environment variable:

export LUA_CPATH=./\?.so\;./lib\?.so\;./lib\?51.so\;


Samples

Complete Samples

You can also browse the examples folder.

im_info

This is a command line application that displays information obtained from a file using the IM I/O functions, basically imFile functions. It depends only on the IM main library.

Here is an output sample:

IM Info
  File Name:
    exif_test.tif
  File Size: 9.00 Mb
  Format: TIFF - Tagged Image File Format
  Compression: NONE
  Image Count: 1
  Image #0
    Width: 2048
    Height: 1536
    Color Space: RGB
      Has Alpha: No
      Is Packed: Yes
      Is Top Down: Yes
    Data Type: byte
    Data Size: 9.00 Mb
    Attributes:
      YResolution: 72.00
      XResolution: 72.00
      DateTime: 2004:01:14 11:30:11
      Make: SONY
      ResolutionUnit: DPI
      Model: CD MAVICA
      Photometric: 2

You can view the source code here: im_info.cpp

im_copy

This is a command line application that copies all the information from one file to another using the IM I/O functions. It depends only on the IM main library. It is usefull for testing the drivers.

You can view the source code here: im_copy.cpp

proc_fourier

This is another command line application that process an image in the Fourier Frequency Domain. In this domain the image is a map of the spatial frequencies of the original image. It depends on the IM main library and on the IM_FFTW library. The FFTW is a very fast Fourier transform, but is contaminated by the GPL license, so everything must be also GPL. To use it in a commercial application you must contact the MIT and pay for a commercial license.

Se also Reference / Image Processing / Domain Transform Operations.

You can view the source code here: proc_fourier.cpp

im_view

This application uses IUP and CD to create a window with a canvas and draw the image into that canvas. It is a very simple application, no zoom nor scrollbar management. The image is obtained from a file using the IM I/O functions, but using the imImage structure to make the implementation easier.

For more IUP http://www.tecgraf.puc-rio.br/iup and more CD http://www.tecgraf.puc-rio.br/cd

You can view the source code here im_view.c, or download it with some makefiles im_view.zip.

glut_capture

This application uses GLUT and OpenGL to create a window with a canvas and draw the image into that canvas. But the image is obtained from a capture device. The image can be processed before display and a sequence of captured images can be saved in an AVI file during capture.

You can view the source code here: glut_capture.c

iupglcap

This application uses IUP and OpenGL to create a window with two canvases and draw a video capture image into one canvas. A processed image can be displayed in the second canvas. It can also process frames from a video file. It is very useful for Computer Vision courses..

You can download the source code and projects for Visual C++, Borland C++ Builder X and Dev-Cpp, here: iupglcap.zip You will need to download IUP, CD and IM libraries for the compiler you use

IMLAB

If you want to see a more complex application with all the IM features explored the IMLAB is a complete example. It displays each image in an individual image with zoom and pan capabilities. All the IM processing operations are available together with some extra operations.

For more IMLAB go to http://www.tecgraf.puc-rio.br/~scuri/imlab.

Lua Samples

To retreive information from an image file:

require"imlua"
local ifile, error = im.FileOpen(file_name)
local format, compression, image_count = ifile:GetInfo()
local format_desc = im.FormatInfo(format)
for i = 1, image_count do
   local width, height, color_mode, data_type, error = ifile:ReadImageInfo(i)
end
ifile:Close()

To edit pixels in an image and save the changes:

require"imlua"

local image = im.FileImageLoad(filename)

local r = image[0]
local g = image[1]
local b = image[2]

for row = 0, image:Height() - 1, 10 do
    for column = 0, image:Width() - 1, 10 do
        r[row][column] = 0
        g[row][column] = 0
        b[row][column] = 0
    end
end

image:Save("edit.bmp", "BMP")

To render noise:

require"imlua"
require"imlua_process"
local image = im.ImageCreate(500, 500, im.RGB, im.BYTE)
im.ProcessRenderRandomNoise(image)
image:Save("noise.tif", "TIFF")

To render using the CD library:

require"imlua"
require"cdlua"
require"cdluaim"

local image = im.ImageCreate(500, 500, im.RGB, im.BYTE)
local canvas = image:cdCreateCanvas()  -- Creates a CD_IMAGERGB canvas

canvas:Activate()
canvas:Background(cd.EncodeColor(255, 255, 255))
canvas:Clear()
fgcolor = cd.EncodeColor(255, 0, 0) -- red
fgcolor = cd.EncodeAlpha(fgcolor, 50) -- semi transparent
canvas:Foreground(fgcolor)
canvas:Font("Times", cd.BOLD, 24)
canvas:Text(100, 100, "Test")
canvas:Line(0,0,100,100)
canvas:Kill()

image:Save("new.bmp", "BMP")

Check the files samples_imlua5.tar.gz or samples_imlua5.zip for several samples in Lua. For some of them you will need also the CD and the IUP libraries. You can also browse the examples folder.


Lua Binding

Overview

All the IM functions are available in Lua, with a few exceptions. We call it ImLua. To use them the general application will do require"imlua", and require"imluaxxxx" to all other secondary libraries that are needed. The functions and definitions will be available under the table "im" using the following name rules:

imXxx  -> im.Xxx    (for functions)
IM_XXX -> im.XXX    (for definitions)
imFileXXX(ifile,... -> ifile:XXX(...     (for methods)
imImageXXX(image,... -> image:XXX(...    (for methods)

New functions (without equivalents in C) were implemented to create and destroy objects that do not exist in C. For instance functions were developed to create and destroy palettes. All the metatables have the "tostring" metamethod implemented to help debuging. The imImage metatable has the "index" metamethod so you can address its data directly in Lua. Some functions were modified to receive those objects as parameters.

Also the functions which receive values by reference in C were modified. Generally, the values of parameters that would have their values modified are now returned by the function in the same order.

Notice that, as opposed to C, in which enumeration flags are combined with the bitwise operator OR, in Lua the flags are added arithmetically.

In Lua all parameters are checked and a Lua error is emitted when the check fails.

All the objects are garbage collected by the Lua garbage collector.

Initialization

Lua 5.1 "require" can be used for all the ImLua libraries. You can use require"imlua" and so on, but the LUA_CPATH must also contains the following:

"./lib?51.so;"    [in UNIX]

".\\?51.dll;"     [in Windows]

The LuaBinaries distribution already includes these modifications on the default search path.

The simplest form require"im" and so on, can not be used because there are IM dynamic libraries with names that will conflict with the names used by require during search.

Additionally you can statically link the ImLua libraries, but you must call the initialization functions manually. The imlua_open function is declared in the header file imlua.h, see the example below:

#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <imlua.h>
void main(void)
{
  lua_State *L = lua_open();

  luaopen_string(L);
  luaopen_math(L);
  luaopen_io(L);

  imlua_open(L);

  lua_dofile("myprog.lua");

  lua_close(L);
}

Integration with CDLua

In CDLua there is an additional library providing simple functions to map the imImage structure to the cdBitmap structure. And some facilities to draw an image in a CD canvas. See also the CD documentation and the IM Lua 5 Binding reference.

Color values and palettes can be created and used transparently in both libraries. Palettes and color values are 100% compatible between CD and IM.

Reference

See also the ImLua 5 Binding Reference .


Representation

Image Representation

Width and Height

In the IM library images are 2D matrices of pixels defining width and height. Stacks, Animations, Videos and Volumes are represented as a sequence of individual images.

Color Space

The pixels can have one of several color spaces:

  • IM_RGB
  • IM_MAP
  • IM_GRAY
  • IM_BINARY
  • IM_CMYK
  • IM_YCBCR
  • IM_LAB
  • IM_LUV
  • IM_XYZ .

IM_MAP is a subset of the IM_RGB color space. It can have a maximum of 256 colors. Each value is an index into a RGB palette.

IM_GRAY usually means luma (nonlinear Luminance), but it can represent any other intensity value that is not necessarily related to color.

IM_BINARY is a subset of the IM_GRAY color space, and it has only 2 colors black and white. Each value can be 0 or 1. But for practical reasons we use one byte to store it.

The other color spaces are standard CIE color spaces, except CMYK that does not have a clear definition without other parameters to complement it.

Data Type

There are several numeric representations for the color component, or several data types:

  • IM_BYTE
  • IM_USHORT
  • IM_INT
  • IM_FLOAT
  • IM_CFLOAT.

There is no bit type, binary images use 1 byte (waist space but keep processing simple).

Color Mode Flags

To avoid defining another image parameter we also use a parameter called color_mode that it is composed by the color_space plus some flags, i.e. color_mode = color_space + flags. The flags are binary combined with the color space, for example color_mode = IM_RGB | IM_XXX. And several flags can be combined in the same color_mode.

There are 3 flags:

  • IM_ALPHA
  • IM_PACKED
  • IM_TOPDOWN

When a flag is absent the opposite definition is assumed. For simplicity we define some macros that help handling the color mode:

  • imColorModeSpace
  • imColorModeHasAlpha
  • imColorModeIsPacked
  • imColorModeIsTopDown

Color Components Packaging (IM_PACKED or unpacked)

The number of components of the color space defines the depth of the image. The color components can be packed sequentially in one plane (like rgbrgbrgb...) or separated in several planes (like rrr...ggg...bbb...). Packed color components are normally used by graphics systems. We allow these two options because many users define their own image structure that can have a packed or an separated organization. The following picture illustrates the difference between the two options:

(flag not defined) IM_PACKED

Separated and Packed RGB Components

Alpha Channel (IM_ALPHA or no alpha)

An extra component, the alpha channel, may be present. The number of components is then increased by one. Its organization follows the rules of packed and unpacked components.

Orientation (IM_TOPDOWN or bottom up)

Image orientation can be bottom up to top with the origin at the bottom left corner, or top down to bottom with the origin at the top left corner.

IM_TOPDOWN (flag not defined)

Top Down and Bottom Up Orientations

Examples

IM_RGB | IM_ALPHA - rgb color space with an alpha channel, bottom up orientation and separated components
IM_GRAY | IM_TOPDOWN - gray color space with no alpha channel and top down orientation
IM_RGB | IM_ALPHA | IM_PACKED - rgb color space with an alpha channel, bottom up orientation and packed components

Raw Data Buffer

So these four parameters define our raw image data: width, height, color_mode and data_type. The raw data buffer is always byte aligned and each component is stored sequentially in the buffer following the specified packing.

For example, if a RGB image is 4x4 pixels it will have the following organization in memory:

RRRRRRRRRRRRRRRRGGGGGGGGGGGGGGGGBBBBBBBBBBBBBBBB - for non packed components
0   1   2   3   0   1   2   3   0   1   2   3
RGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGB - for packed components
0           1           2           3

In bold we visually marked some lines of data.

imImage

We could restrict the data organization by eliminating the extra flags, but several users requested these features in the library. So we keep them but restricted to raw data buffers.

For the high level image processing functions we created a structure called imImage that eliminates the extra flags and assume bottom up orientation and separated components. Alpha channel is supported as an extra component.

The imImage structure is defined using four image parameters: width, height, color_space and data_type. It is an open structure in C where you can access all the parameters. In addition to the 4 creation parameters there are many auxiliary parameters like depth, count, line_size, plane_size and size.

As the library is designed to work with such a wide range of image data organization, there are no general purpose functions for getting/setting individual pixels, as they would be too complicated and inefficient. Rather, you should use the components of the imImage structure to access image pixels in the most efficient way.

Bitmaps

An important subset of images is what we call a Bitmap image. It is an image that can be displayed in graphics devices usually using a graphics library like CD or OpenGL. For Bitmap images the color space must be IM_RGB, IM_MAP, IM_GRAY or IM_BINARY, and the data type must be IM_BYTE.


Representation Guide

Image Representation Guide

Raw Data Buffer

To create a raw image buffer you can simply use the utility function:

int width, height, color_mode, data_type;
int size = imImageDataSize(width, height, color_mode, data_type);
void* buffer = malloc(size);

So if the data type is IM_FLOAT, we could write:

float* idata = (float*)buffer;

Then to locate the pixel at line y, column x, component d simply write:

float value;
if (is_packed)
  value = idata[y*width*depth + x*depth + d]
else
  value = idata[d*width*height + y*width + x]

But notice that this code will return values at different pixel locations for top down and bottom up orientations.

imImage

To use the imImage structure you must include the <im_image.h> header.

To create an imImage structure you can do it in several ways:

int width, height, color_space, data_type, palette_count;
long *palette;
void* buffer

imImage* image;

image = imImageCreate(width, height, color_space, data_type)
image = imImageInit(width, height, color_space, data_type, buffer, palette, palette_count)
image = imImageDuplicate(image)
image = imImageClone(image)

The imImageInit function allow you to initialize an imImage structure with an user allocated buffer. This is very useful if you use your own image structure and wants to temporally use the image processing functions of the library.

To destroy the imImage structure simply call imImageDestroy(image). If you do "data[0] = NULL" before calling the destroy function then the raw data buffer will not be destroyed.

The imImage data buffer is allocated like the raw data buffer.

The separated color components are arranged one after another, but we access the data through an array of pointers each one starting at the beginning of each color component. So image->data[0] contains a pointer to all the data, and image->data[1] is a short cut to the second component and so on. With this you can use image->data[0] as a starting point for all the data, or use it as the first component.

count = width*height;
unsigned char* idata = (unsigned char*)image->data[0];
for (int i = 0; i < count; i++)
{
  idata[i] = 255;
}

or

for (int d = 0; d < image->depth; d++)
{
  unsigned char* idata = (unsigned char*)image->data[d];

  for (int y = 0; y < height; y++)
  {
    for (int x = 0; x < width; x++)
    {
      int offset = y * width + x;

      idata[offset] = 255;
    }
  }
}

The imImage structure contains all the image information obtained from a file, because it also has support for alpha, attributes and the palette. The palette can be used for IM_MAP images and for pseudo color of IM_GRAY images.

The conversion between image data types, color spaces and the conversion to bitmap are defined only for the imImage structure.


Representation Samples

Image Representation Samples

See the Representation Guide for simple image representation samples.

Information

This is a command line application that displays information obtained from a file using the IM I/O functions, basically imFile functions. It depends only on the IM main library.

Here is an output sample:

IM Info
  File Name:
    exif_test.tif
  File Size: 9.00 Mb
  Format: TIFF - Tagged Image File Format
  Compression: NONE
  Image Count: 1
  Image #0
    Width: 2048
    Height: 1536
    Color Space: RGB
      Has Alpha: No
      Is Packed: Yes
      Is Top Down: Yes
    Data Type: byte
    Data Size: 9.00 Mb
    Attributes:
      YResolution: 72.00
      XResolution: 72.00
      DateTime: 2004:01:14 11:30:11
      Make: SONY
      ResolutionUnit: DPI
      Model: CD MAVICA
      Photometric: 2

You can view the source code here: im_info.cpp

View Using IUP and CD

This application uses IUP and CD to create a window with a canvas and draw the image into that canvas. It is a very simple application, no zoom nor scrollbar management. The image is obtained from a file using the IM I/O functions, but using the imImage structure to make the implementation easier.

For more about IUP see http://www.tecgraf.puc-rio.br/iup and more about CD see http://www.tecgraf.puc-rio.br/cd.

You can view the source code here: im_view.c, or download it with some makefiles im_view.zip.


IM: Image Representation

Image Representation

Collaboration diagram for Image Representation:

Modules

Raw Data Conversion Utilities
imImage
Raw Data Utilities
Color Mode Utilities

Enumerations

enum imDataType {
IM_BYTE, IM_USHORT, IM_INT, IM_FLOAT,
IM_CFLOAT
}
enum imColorSpace {
IM_RGB, IM_MAP, IM_GRAY, IM_BINARY,
IM_CMYK, IM_YCBCR, IM_LAB, IM_LUV,
IM_XYZ
}
enum imColorModeConfig { IM_ALPHA = 0x100, IM_PACKED = 0x200, IM_TOPDOWN = 0x400 }

Detailed Description

See im.h

Enumeration Type Documentation

enum imDataType

Image data type descriptors.
See also Data Type Utilities.

Enumerator:
IM_BYTE

"unsigned char". 1 byte from 0 to 255.

IM_USHORT

"unsigned short". 2 bytes from 0 to 65,535.

IM_INT

"int". 4 bytes from -2,147,483,648 to 2,147,483,647.

IM_FLOAT

"float". 4 bytes single precision IEEE floating point.

IM_CFLOAT

complex "float". 2 float values in sequence, real and imaginary parts.

{
  IM_BYTE,   /**< "unsigned char". 1 byte from 0 to 255.                  */
  IM_USHORT, /**< "unsigned short". 2 bytes from 0 to 65,535.             */
  IM_INT,    /**< "int". 4 bytes from -2,147,483,648 to 2,147,483,647.    */
  IM_FLOAT,  /**< "float". 4 bytes single precision IEEE floating point.  */
  IM_CFLOAT  /**< complex "float". 2 float values in sequence, real and imaginary parts.   */
};

enum imColorSpace

Image color mode color space descriptors (first byte).
See also Color Mode Utilities.

Enumerator:
IM_RGB

Red, Green and Blue (nonlinear).

IM_MAP

Indexed by RGB color map (data_type=IM_BYTE).

IM_GRAY

Shades of gray, luma (nonlinear Luminance), or an intensity value that is not related to color.

IM_BINARY

Indexed by 2 colors: black (0) and white (1) (data_type=IM_BYTE).

IM_CMYK

Cian, Magenta, Yellow and Black (nonlinear).

IM_YCBCR

ITU-R 601 Y'CbCr. Y' is luma (nonlinear Luminance).

IM_LAB

CIE L*a*b*. L* is Lightness (nonlinear Luminance, nearly perceptually uniform).

IM_LUV

CIE L*u*v*. L* is Lightness (nonlinear Luminance, nearly perceptually uniform).

IM_XYZ

CIE XYZ. Linear Light Tristimulus, Y is linear Luminance.

{
  IM_RGB,    /**< Red, Green and Blue (nonlinear).              */
  IM_MAP,    /**< Indexed by RGB color map (data_type=IM_BYTE). */
  IM_GRAY,   /**< Shades of gray, luma (nonlinear Luminance), or an intensity value that is not related to color. */
  IM_BINARY, /**< Indexed by 2 colors: black (0) and white (1) (data_type=IM_BYTE).     */
  IM_CMYK,   /**< Cian, Magenta, Yellow and Black (nonlinear).                          */
  IM_YCBCR,  /**< ITU-R 601 Y'CbCr. Y' is luma (nonlinear Luminance).                   */
  IM_LAB,    /**< CIE L*a*b*. L* is Lightness (nonlinear Luminance, nearly perceptually uniform). */
  IM_LUV,    /**< CIE L*u*v*. L* is Lightness (nonlinear Luminance, nearly perceptually uniform). */
  IM_XYZ     /**< CIE XYZ. Linear Light Tristimulus, Y is linear Luminance.             */
};

enum imColorModeConfig

Image color mode configuration/extra descriptors (1 bit each in the second byte).
See also Color Mode Utilities.

Enumerator:
IM_ALPHA

adds an Alpha channel

IM_PACKED

packed components (rgbrgbrgb...)

IM_TOPDOWN

orientation from top down to bottom

{
  IM_ALPHA    = 0x100,  /**< adds an Alpha channel */
  IM_PACKED   = 0x200,  /**< packed components (rgbrgbrgb...) */
  IM_TOPDOWN  = 0x400   /**< orientation from top down to bottom */
};

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: imImage

imImage
[Image Representation]

Collaboration diagram for imImage:

Data Structures

struct | _imImage
imImage Structure Definition. More...

Modules

Image Conversion

Defines

#define | imcdCanvasPutImage(_canvas, _image, _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax)

Typedefs

typedef struct _imImage | imImage

Functions

imImage * | imImageCreate (int width, int height, int color_space, int data_type)
imImage * | imImageInit (int width, int height, int color_space, int data_type, void *data_buffer, long *palette, int palette_count)
imImage * | imImageCreateBased (const imImage *image, int width, int height, int color_space, int data_type)
void | imImageDestroy (imImage *image)
void | imImageAddAlpha (imImage *image)
void | imImageSetAlpha (imImage *image, float alpha)
void | imImageReshape (imImage *image, int width, int height)
void | imImageCopy (const imImage *src_image, imImage *dst_image)
void | imImageCopyData (const imImage *src_image, imImage *dst_image)
void | imImageCopyAttributes (const imImage *src_image, imImage *dst_image)
void | imImageCopyPlane (const imImage *src_image, int src_plane, imImage *dst_image, int dst_plane)
imImage * | imImageDuplicate (const imImage *image)
imImage * | imImageClone (const imImage *image)
void | imImageSetAttribute (const imImage *image, const char *attrib, int data_type, int count, const void *data)
const void * | imImageGetAttribute (const imImage *image, const char *attrib, int *data_type, int *count)
void | imImageGetAttributeList (const imImage *image, char **attrib, int *attrib_count)
void | imImageClear (imImage *image)
int | imImageIsBitmap (const imImage *image)
void | imImageSetPalette (imImage *image, long *palette, int palette_count)
int | imImageMatchSize (const imImage *image1, const imImage *image2)
int | imImageMatchColor (const imImage *image1, const imImage *image2)
int | imImageMatchDataType (const imImage *image1, const imImage *image2)
int | imImageMatchColorSpace (const imImage *image1, const imImage *image2)
int | imImageMatch (const imImage *image1, const imImage *image2)
void | imImageSetBinary (imImage *image)
void | imImageMakeBinary (imImage *image)
void | imImageMakeGray (imImage *image)

Detailed Description

Base definitions and functions for image representation.
Only the image processing operations depends on these definitions, Image Storage and Image Capture are completely independent.
You can also initialize a structure with your own memory buffer, see imImageInit. To release the structure without releasing the buffer, set "data[0]" to NULL before calling imImageDestroy.
See im_image.h

Define Documentation

#define imcdCanvasPutImage | ( | _canvas,
 |  | _image,
 |  | _x,
 |  | _y,
 |  | _w,
 |  | _h,
 |  | _xmin,
 |  | _xmax,
 |  | _ymin,
 |  | _ymax
 | ) |
Value:
{                                                                         \
    if (_image->color_space == IM_RGB)                                      \
    {                                                                       \
      if (_image->has_alpha)                                                \
        cdCanvasPutImageRectRGBA(_canvas, _image->width, _image->height,    \
                          (unsigned char*)_image->data[0],                  \
                          (unsigned char*)_image->data[1],                  \
                          (unsigned char*)_image->data[2],                  \
                          (unsigned char*)_image->data[3],                  \
                          _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax);      \
      else                                                                  \
        cdCanvasPutImageRectRGB(_canvas, _image->width, _image->height,     \
                          (unsigned char*)_image->data[0],                  \
                          (unsigned char*)_image->data[1],                  \
                          (unsigned char*)_image->data[2],                  \
                          _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax);      \
    }                                                                       \
    else                                                                    \
      cdCanvasPutImageRectMap(_canvas, _image->width, _image->height,       \
                        (unsigned char*)_image->data[0], _image->palette,   \
                        _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax);        \
  }

Utility macro to draw the image in a CD library canvas. Works only for data_type IM_BYTE, and color spaces: IM_RGB, IM_MAP, IMGRAY and IM_BINARY.

Typedef Documentation

typedef struct _imImage imImage

imImage Structure Definition.

An image representation than supports all the color spaces, but planes are always unpacked and the orientation is always bottom up.

Function Documentation

imImage* imImageCreate | ( | int | width,
 |  | int | height,
 |  | int | color_space,
 |  | int | data_type
 | ) |  |

Creates a new image. See also imDataType and imColorSpace. Image data is cleared as imImageClear.
In Lua the IM image metatable name is "imImage". When converted to a string will return "imImage(%p) [width=%d,height=%d,color_space=%s,data_type=%s,depth=%d]" where p is replaced by the userdata address, and other values are replaced by the respective attributes. If the image is already destroyed by im.ImageDestroy, then it will return also the suffix "-destroyed".

im.ImageCreate(width: number, height: number, color_space: number, data_type: number) -> image: imImage [in Lua 5]
imImage* imImageInit | ( | int | width,
 |  | int | height,
 |  | int | color_space,
 |  | int | data_type,
 |  | void * | data_buffer,
 |  | long * | palette,
 |  | int | palette_count
 | ) |  |

Initializes the image structure but does not allocates image data. See also imDataType and imColorSpace.

imImage* imImageCreateBased | ( | const imImage * | image,
 |  | int | width,
 |  | int | height,
 |  | int | color_space,
 |  | int | data_type
 | ) |  |

Creates a new image based on an existing one.
If the addicional parameters are -1, the given image parameters are used.
The image atributes always are copied. HasAlpha is copied. See also imDataType and imColorSpace.

im.ImageCreateBased(image: imImage, [width: number], [height: number], [color_space: number], [data_type: number]) -> image: imImage [in Lua 5]

The addicional parameters in Lua can be nil, and they can also be functions with the based image as a parameter to return the respective value.

void imImageDestroy ( imImage * image )

Destroys the image and frees the memory used. image data is destroyed only if its data[0] is not NULL.
In Lua if this function is not called, the image is destroyed by the garbage collector.

im.ImageDestroy(image: imImage) [in Lua 5]
image:Destroy() [in Lua 5]
void imImageAddAlpha ( imImage * image )

Adds an alpha channel plane and sets its value to 0 (transparent).

image:AddAlpha() [in Lua 5]
void imImageSetAlpha | ( | imImage * | image,
 |  | float | alpha
 | ) |  |

Sets the alpha channel plane to a constant.

image:SetAlpha() [in Lua 5]
void imImageReshape | ( | imImage * | image,
 |  | int | width,
 |  | int | height
 | ) |  |

Changes the buffer size. Reallocate internal buffers if the new size is larger than the original.

image:Reshape(width: number, height: number) [in Lua 5]
void imImageCopy | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Copy image data and attributes from one image to another.
Images must have the same size and type.

image:Copy(dst_image: imImage) [in Lua 5]
void imImageCopyData | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Copy image data only fom one image to another.
Images must have the same size and type.

image:CopyData(dst_image: imImage) [in Lua 5]
void imImageCopyAttributes | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Copies the image attributes from src to dst. Includes the pallete when a MAP or GRAY image.

image:CopyAttributes(dst_image: imImage) [in Lua 5]
void imImageCopyPlane | ( | const imImage * | src_image,
 |  | int | src_plane,
 |  | imImage * | dst_image,
 |  | int | dst_plane
 | ) |  |

Copy one image plane fom one image to another.
Images must have the same size and type.

image:CopyPlane(src_plane: number, dst_image: imImage, dst_plane: number) [in Lua 5]
imImage* imImageDuplicate ( const imImage * image )

Creates a copy of the image.

image:Duplicate() -> new_image: imImage [in Lua 5]
imImage* imImageClone ( const imImage * image )

Creates a clone of the image. i.e. same attributes but ignore contents.

image:Clone() -> new_image: imImage [in Lua 5]
void imImageSetAttribute | ( | const imImage * | image,
 |  | const char * | attrib,
 |  | int | data_type,
 |  | int | count,
 |  | const void * | data
 | ) |  |

Changes an extended attribute.
The data will be internally duplicated.
If data is NULL and count==0 the attribute is removed.
If count is -1 and data_type is IM_BYTE then data is zero terminated. See also imDataType.

image:SetAttribute(attrib: string, data_type: number, data: table of numbers or string) [in Lua 5]

If data_type is IM_BYTE, as_string can be used as data.

const void* imImageGetAttribute | ( | const imImage * | image,
 |  | const char * | attrib,
 |  | int * | data_type,
 |  | int * | count
 | ) |  |

Returns an extended attribute.
Returns NULL if not found. See also imDataType.

image:GetAttribute(attrib: string, [as_string: boolean]) -> data: table of numbers or string, data_type: number [in Lua 5]

If data_type is IM_BYTE, as_string can be used to return a string instead of a table.

void imImageGetAttributeList | ( | const imImage * | image,
 |  | char ** | attrib,
 |  | int * | attrib_count
 | ) |  |

Returns a list of the attribute names.
"attrib" must contain room enough for "attrib_count" names. Use "attrib=NULL" to return only the count.

image:GetAttributeList() -> data: table of strings [in Lua 5]
void imImageClear ( imImage * image )

Sets all image data to zero. But if color space is YCBCR, LAB or LUV, and data type is BYTE or USHORT, then data is initialized with 128 or 32768 accordingly. Alpha is initialized as transparent (0).

image:Clear() [in Lua 5]
int imImageIsBitmap ( const imImage * image )

Indicates that the image can be viewed in common graphic devices. Data type must be IM_BYTE. Color mode can be IM_RGB, IM_MAP, IM_GRAY or IM_BINARY.

image:IsBitmap() -> is_bitmap: boolean [in Lua 5]
void imImageSetPalette | ( | imImage * | image,
 |  | long * | palette,
 |  | int | palette_count
 | ) |  |

Changes the image palette. This will destroy the existing palette and replace it with the given palette pointer. Only the pointer is stored, so the palette should be a new palette and it can not be a static array.

image:SetPalette(palette: imPalette) [in Lua 5]
int imImageMatchSize | ( | const imImage * | image1,
 |  | const imImage * | image2
 | ) |  |

Returns 1 if the images match width and height. Returns 0 otherwise.

image:MatchSize(image2: imImage) -> match: boolean [in Lua 5]
int imImageMatchColor | ( | const imImage * | image1,
 |  | const imImage * | image2
 | ) |  |

Returns 1 if the images match color mode and data type. Returns 0 otherwise.

image:MatchColor(image2: imImage) -> match: boolean [in Lua 5]
int imImageMatchDataType | ( | const imImage * | image1,
 |  | const imImage * | image2
 | ) |  |

Returns 1 if the images match width, height and data type. Returns 0 otherwise.

image:MatchDataType(image2: imImage) -> match: boolean [in Lua 5]
int imImageMatchColorSpace | ( | const imImage * | image1,
 |  | const imImage * | image2
 | ) |  |

Returns 1 if the images match width, height and color space. Returns 0 otherwise.

image:MatchColorSpace(image2: imImage) -> match: boolean [in Lua 5]
int imImageMatch | ( | const imImage * | image1,
 |  | const imImage * | image2
 | ) |  |

Returns 1 if the images match in width, height, data type and color space. Returns 0 otherwise.

image:Match(image2: imImage) -> match: boolean [in Lua 5]
void imImageSetBinary ( imImage * image )

Changes the image color space from gray to binary by just changing color_space and the palette.

image:SetBinary() [in Lua 5]
void imImageMakeBinary ( imImage * image )

Changes a gray BYTE data (0,255) into a binary data (0,1), done in-place. Color space is not changed.

image:MakeBinary() [in Lua 5]
void imImageMakeGray ( imImage * image )

Changes a binary data (0,1) into a gray BYTE data (0,255), done in-place. Color space is not changed.

image:MakeGray() [in Lua 5]


IM: Image Conversion

Image Conversion
[imImage]

Collaboration diagram for Image Conversion:

Enumerations

enum | imComplex2Real { IM_CPX_REAL, IM_CPX_IMAG, IM_CPX_MAG, IM_CPX_PHASE }
enum imGammaFactor {
IM_GAMMA_LINEAR = 0, IM_GAMMA_LOGLITE = -10, IM_GAMMA_LOGHEAVY = -1000, IM_GAMMA_EXPLITE = 2,
IM_GAMMA_EXPHEAVY = 7
}
enum | imCastMode { IM_CAST_MINMAX, IM_CAST_FIXED, IM_CAST_DIRECT }

Functions

int | imConvertDataType (const imImage *src_image, imImage *dst_image, int cpx2real, float gamma, int abssolute, int cast_mode)
int | imConvertColorSpace (const imImage *src_image, imImage *dst_image)
int | imConvertToBitmap (const imImage *src_image, imImage *dst_image, int cpx2real, float gamma, int abssolute, int cast_mode)
void * | imImageGetOpenGLData (const imImage *image, int *glformat)
imImage * | imImageCreateFromOpenGLData (int width, int height, int glformat, const void *gldata)

Detailed Description

Converts one type of image into another. Can convert between color modes and between data types.
See im_convert.h

Enumeration Type Documentation

enum imComplex2Real

Complex to real conversions

{
  IM_CPX_REAL,
  IM_CPX_IMAG,
  IM_CPX_MAG,
  IM_CPX_PHASE
};

enum imGammaFactor

Predefined Gamma factors. Gamma can be any real number. When gamma<0 use logarithmic, when gamma>0 use exponential. gamma(x,g) = ((e^(g*x))-1)/(exp(g)-1) gamma(x,g) = (log((g*x)+1))/(log(g+1))

{
  IM_GAMMA_LINEAR   = 0,
  IM_GAMMA_LOGLITE  = -10,
  IM_GAMMA_LOGHEAVY = -1000,
  IM_GAMMA_EXPLITE  = 2,
  IM_GAMMA_EXPHEAVY = 7
};

enum imCastMode

Predefined Cast Modes

Enumerator:
IM_CAST_MINMAX

scan for min and max values

IM_CAST_FIXED

use predefied 0-max values, see Color Manipulation Color Manipulation.

IM_CAST_DIRECT

direct type cast the value. Only byte and ushort will be cropped.

{
  IM_CAST_MINMAX, /**< scan for min and max values */
  IM_CAST_FIXED,  /**< use predefied 0-max values, see \ref color Color Manipulation. */
  IM_CAST_DIRECT  /**< direct type cast the value. Only byte and ushort will be cropped. */
};

Function Documentation

int imConvertDataType | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | cpx2real,
 |  | float | gamma,
 |  | int | abssolute,
 |  | int | cast_mode
 | ) |  |

Changes the image data type, using a complex2real conversion, a gamma factor, and an abssolute mode (modulus).
When demoting the data type the function will scan for min/max values or use fixed values (cast_mode) to scale the result according to the destiny range.
Except complex to real that will use only the complex2real conversion.
Images must be of the same size and color mode.
Returns IM_ERR_NONE, IM_ERR_DATA or IM_ERR_COUNTER, see also imErrorCodes. See also imComplex2Real, imGammaFactor and imCastMode.

im.ConvertDataType(src_image: imImage, dst_image: imImage, cpx2real: number, gamma: number, abssolute: boolean, cast_mode: number) -> error: number [in Lua 5]
im.ConvertDataTypeNew(image: imImage, data_type: number, cpx2real: number, gamma: number, abssolute: boolean, cast_mode: number) -> error: number, new_image: imImage  [in Lua 5]
int imConvertColorSpace | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Converts one color space to another. Images must be of the same size and data type.
CMYK can be converted to RGB only, and it is a very simple conversion.
All colors can be converted to Binary, the non zero gray values are converted to 1.
RGB to Map uses the median cut implementation from the free IJG JPEG software, copyright Thomas G. Lane.
Alpha channel is considered and Transparency* attributes are converted to alpha channel.
All other color space conversions assume sRGB and CIE definitions.
Returns IM_ERR_NONE, IM_ERR_DATA or IM_ERR_COUNTER, see also imErrorCodes.

im.ConvertColorSpace(src_image: imImage, dst_image: imImage) -> error: number [in Lua 5]
im.ConvertColorSpaceNew(image: imImage, color_space: number, has_alpha: boolean) -> error: number, new_image: imImage [in Lua 5]
int imConvertToBitmap | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | cpx2real,
 |  | float | gamma,
 |  | int | abssolute,
 |  | int | cast_mode
 | ) |  |

Converts the image to its bitmap equivalent, uses imConvertColorSpace and imConvertDataType.
Returns IM_ERR_NONE, IM_ERR_DATA or IM_ERR_COUNTER, see also imErrorCodes. See also imComplex2Real, imGammaFactor and imCastMode.
The function im.ConvertToBitmapNew uses the default convertion result from imColorModeToBitmap if color_space is nil.

im.ConvertToBitmap(src_image: imImage, dst_image: imImage, cpx2real: number, gamma: number, abssolute: boolean, cast_mode: number) -> error: number [in Lua 5]
im.ConvertToBitmapNew(image: imImage, color_space: number, has_alpha: boolean, cpx2real: number, gamma: number, abssolute: boolean, cast_mode: number) -> error: number, new_image: imImage [in Lua 5]
void* imImageGetOpenGLData | ( | const imImage * | image,
 |  | int * | glformat
 | ) |  |

Returns an OpenGL compatible data buffer. Also returns the correspondant pixel format.
The memory allocated is stored in the attribute "GLDATA" with BYTE type. And it will exists while the image exists.
It can be cleared by setting the attribute to NULL.
MAP images are converted to RGB, and BINARY images are converted to GRAY. Alpha channel is considered and Transparency* attributes are converted to alpha channel. So calculate depth from glformat, not from image depth.

image:GetOpenGLData() -> gldata: userdata, glformat: number [in Lua 5]
imImage* imImageCreateFromOpenGLData | ( | int | width,
 |  | int | height,
 |  | int | glformat,
 |  | const void * | gldata
 | ) |  |

Creates an image from an OpenGL data.

im.ImageCreateFromOpenGLData(width, height, glformat: number, gldata: userdata) -> image: imImage [in Lua 5]


IM: Raw Data Utilities

Functions

Raw Data Utilities
[Image Representation]

Collaboration diagram for Raw Data Utilities:

Functions

int | imImageDataSize (int width, int height, int color_mode, int data_type)
int | imImageLineSize (int width, int color_mode, int data_type)
int | imImageLineCount (int width, int color_mode)
int | imImageCheckFormat (int color_mode, int data_type)

Detailed Description

See im_util.h

Function Documentation

int imImageDataSize | ( | int | width,
 |  | int | height,
 |  | int | color_mode,
 |  | int | data_type
 | ) |  |

Returns the size of the data buffer.

im.ImageDataSize(width: number, height: number, color_mode: number, data_type: number) -> datasize: number [in Lua 5]
int imImageLineSize | ( | int | width,
 |  | int | color_mode,
 |  | int | data_type
 | ) |  |

Returns the size of one line of the data buffer.
This depends if the components are packed. If packed includes all components, if not includes only one.

im.ImageLineSize(width: number, color_mode: number, data_type: number) -> linesize: number [in Lua 5]
int imImageLineCount | ( | int | width,
 |  | int | color_mode
 | ) |  |

Returns the number of elements of one line of the data buffer.
This depends if the components are packed. If packed includes all components, if not includes only one.

im.ImageLineCount(width: number, color_mode: number) -> linecount: number [in Lua 5]
int imImageCheckFormat | ( | int | color_mode,
 |  | int | data_type
 | ) |  |

Check if the combination color_mode+data_type is valid.

im.ImageCheckFormat(color_mode: number, data_type: number) -> check: boolean [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Raw Data Conversion Utilities

Functions

Raw Data Conversion Utilities
[Image Representation]

Collaboration diagram for Raw Data Conversion Utilities:

Functions

void | imConvertPacking (const void *src_data, void *dst_data, int width, int height, int src_depth, int dst_depth, int data_type, int src_is_packed)
void | imConvertMapToRGB (unsigned char *data, int count, int depth, int packed, long *palette, int palette_count)

Detailed Description

Utilities for raw data buffers.
See im_convert.h

Function Documentation

void imConvertPacking | ( | const void * | src_data,
 |  | void * | dst_data,
 |  | int | width,
 |  | int | height,
 |  | int | src_depth,
 |  | int | dst_depth,
 |  | int | data_type,
 |  | int | src_is_packed
 | ) |  |

Changes the packing of the data buffer. Both must have the same width, height and data_type.
It can be used to copy data even if depth=1.

void imConvertMapToRGB | ( | unsigned char * | data,
 |  | int | count,
 |  | int | depth,
 |  | int | packed,
 |  | long * | palette,
 |  | int | palette_count
 | ) |  |

Changes in-place a MAP data into a RGB data. The data must have room for the RGB image.
depth can be 3 or 4. count=width*height.


IM: Color Mode Utilities

Color Mode Utilities
[Image Representation]

Collaboration diagram for Color Mode Utilities:

Defines

#define | imColorModeSpace(_cm) (_cm & 0xFF)
#define | imColorModeMatch(_cm1, _cm2) (imColorModeSpace(_cm1) == imColorModeSpace(_cm2))
#define | imColorModeHasAlpha(_cm) (_cm & IM_ALPHA)
#define | imColorModeIsPacked(_cm) (_cm & IM_PACKED)
#define | imColorModeIsTopDown(_cm) (_cm & IM_TOPDOWN)

Functions

const char * | imColorModeSpaceName (int color_mode)
int | imColorModeDepth (int color_mode)
int | imColorModeToBitmap (int color_mode)
int | imColorModeIsBitmap (int color_mode, int data_type)

Detailed Description

See im_util.h

Define Documentation

#define imColorModeSpace ( _cm ) (_cm & 0xFF)

Returns the color space of the color mode.

im.ColorModeSpace(color_mode: number) -> color_space: number [in Lua 5]
#define imColorModeMatch | ( | _cm1,
 |  | _cm2 |
 | ) |  | (imColorModeSpace(_cm1) == imColorModeSpace(_cm2))

Check if the two color modes match. Only the color space is compared.

im.ColorModeMatch(color_mode1: number, color_mode2: number) -> match: boolean [in Lua 5]
#define imColorModeHasAlpha ( _cm ) (_cm & IM_ALPHA)

Check if the color mode has an alpha channel.

im.ColorModeHasAlpha(color_mode: number) -> has_alpha: boolean [in Lua 5]
#define imColorModeIsPacked ( _cm ) (_cm & IM_PACKED)

Check if the color mode components are packed in one plane.

im.ColorModeIsPacked(color_mode: number) -> is_packed: boolean [in Lua 5]
#define imColorModeIsTopDown ( _cm ) (_cm & IM_TOPDOWN)

Check if the color mode orients the image from top down to bottom.

im.ColorModeIsTopDown(color_mode: number) -> is_top_down: boolean [in Lua 5]

Function Documentation

const char* imColorModeSpaceName ( int color_mode )

Returns the color mode name.

im.ColorModeSpaceName(color_mode: number) -> name: string [in Lua 5]
int imColorModeDepth ( int color_mode )

Returns the number of components of the color space including alpha.

im.ColorModeDepth(color_mode: number) -> depth: number [in Lua 5]
int imColorModeToBitmap ( int color_mode )

Returns the color space of the equivalent display bitmap image.
Original packing and alpha are ignored. Returns IM_RGB, IM_GRAY, IM_MAP or IM_BINARY.

im.ColorModeToBitmap(color_mode: number) -> color_space: number [in Lua 5]
int imColorModeIsBitmap | ( | int | color_mode,
 |  | int | data_type
 | ) |  |

Check if the color mode and data_type defines a display bitmap image.

im.ColorModeIsBitmap(color_mode: number, data_type: number) -> is_bitmap: boolean [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


Storage

Image Storage

Essentially all the file formats save the same image data. There is no such thing like a GIF image, instead we have a color indexed image that can be saved in a file with a GIF format, or a TIFF format, etc. However the compression encoding can be lossy and degrade the original image. The point is file formats and image data are two different things.

A file format is a file organization of the image data and its attributes. The IM library model considers all the file formats under the same model, including image, video, animation, stacks and volume file formats. When there is more than one image each one is treated as an independent frame. Each frame can have its own parameters and set of attributes.

The abstract model we use has the following structure:

Format Identifier
Compression
Image Count
Image Information:
parameters, attributes, palette
Image Data
Image Information:
parameters, attributes, palette
Image Data
...

The compression is usually the same for all the images in the file, but it can be changed after loading an image. For tradicional file formats image count is always 1. Image information must always be loaded or saved before image data.

We consider only formats that starts with a signature so we can recognize the format without using its file extension. If there is more than one driver that handles the same signature the first registered driver will open the file. Since the internal drivers are automatically registered all the external drivers can be loaded first if no imFile function has been called. In this way you can also control which external driver goes first.


Storage Guide

Reading

When reading the file extension is not relevant to determine the file format, but it is used to speed up the process of finding the correct format. With few exceptions the format drivers that access multiple images can read them in any sequence you want.

During the read process the original data can be converted to some options of user data. Not all conversions are available. You can convert any data to a bitmap version of it, and you can select any of the color mode flags IM_ALPHA, IM_PACKED and IM_TOPDOWN, regardless of the file original configuration.

Remember that even if all the images in the file have the same parameters you still have to call imFileReadImageInfo before calling imFileReadImageData.

In the following example all the images in the file are loaded.

char format[10], compression[10];
int error, image_count;
int width, height, color_mode, data_type;
void* data;

imFile* ifile = imFileOpen("test.tif", &error);
if (error != IM_ERR_NONE)
  // handle the error

imFileGetInfo(ifile, format, compression, &image_count);

for (i = 0; i < image_count, i++)
{
  error = imFileReadImageInfo(ifile, i, &width, &height, &color_mode, &data_type);
  if (error != IM_ERR_NONE)
    // handle the error

  // prepare data

  error = imFileReadImageData(ifile, data, 0, -1); // no bitmap convertion, use original color mode flags
  if (error != IM_ERR_NONE)
    // handle the error

  // store data somewhere
}

imFileClose(ifile);

A more simple code loads only the first image in the file:

imFile* ifile = imFileOpen(file_name, &error);

imFileReadImageInfo(ifile, 0, &width, &height, &color_mode, &data_type);

imFileReadImageData(ifile, data, 0, -1);

imFileClose(ifile);

If you are using the imImage structure it is easier:

imFile* ifile = imFileOpen(file_name, &error);

imImage* image = imFileLoadImage(ifile, 0, &error);
// or use imFileLoadBitmap to force a bitmap conversion

imFileClose(ifile);

Or the simplest version:

imImage* image = imFileImageLoad(file_name, 0, &error);

Writing

When writing there is no color space or data type conversion. Only color mode flags can be different: IM_ALPHA, IM_PACKED and IM_TOPDOWN. You just have to describe your data and the imFileWriteImageData will handle the color mode flag differences.

Of course you still have to check the error codes because, not all color spaces and data types are supported by each format.

When saving a sequence of images you must provide each image in the order that they will be in the file. For a video or animation start from frame 0 and go on, you can not jump or change the frame order. Also when saving videos you should not forget to save the numbers of frames per second in the attribute "FPS", the default value is 15.

For all the formats it is not necessary to set the compression, each driver will choose a default compression. But you may set it using the function imFileSetInfo.

To save several images to the same file:

int error, width, height;
void *data;

imFile* ifile = imFileNew("test.tif", "TIFF", &error);
if (error != IM_ERR_NONE)
  // handle the error

for (i = 0; i < image_count, i++)
{
  error = imFileWriteImageInfo(ifile, width, height, IM_RGB, IM_BYTE);
  if (error != IM_ERR_NONE)
    // handle the error

  error = imFileWriteImageData(ifile, data);
  if (error != IM_ERR_NONE)
    // handle the error
}

imFileClose(ifile);

But remember that not all file formats supports several images. To save just one image is more simple:

imFile* ifile = imFileNew(file_name, format, &error);

error = imFileWriteImageInfo(ifile, width, height, color_mode, data_type);

error = imFileWriteImageData(ifile, data);

imFileClose(ifile);

If you are using the imImage structure it is easier:

imFile* ifile = imFileNew(file_name, format, &error);

error = imFileSaveImage(ifile, image);

imFileClose(ifile);

Or the simplest version:

error = imFileImageSave(file_name, format, image);

Error Messages

Here is a sample error message display using IUP and IM error codes:

static void imIupErrorMessage(int error, int interactive)
{
  char* lang = IupGetLanguage();
  char *msg, *title;
  if (strcmp(lang, "ENGLISH")==0)
  {
    title = "Error";
    switch (error)
    {
    case IM_ERR_OPEN:
      msg = "Error Opening File.";
      break;
    case IM_ERR_MEM:
      msg = "Insuficient memory.";
      break;
    case IM_ERR_ACCESS:
      msg = "Error Accessing File.";
      break;
    case IM_ERR_DATA:
      msg = "Image type not Suported.";
      break;
    case IM_ERR_FORMAT:
      msg = "Invalid Format.";
      break;
    case IM_ERR_COMPRESS:
      msg = "Invalid or unsupported compression.";
      break;
    default:
      msg = "Unknown Error.";
    }
  }
  else
  {
    title = "Erro";
    switch (error)
    {
    case IM_ERR_OPEN:
      msg = "Erro Abrindo Arquivo.";
      break;
    case IM_ERR_MEM:
      msg = "Memória Insuficiente.";
      break;
    case IM_ERR_ACCESS:
      msg = "Erro Acessando Arquivo.";
      break;
    case IM_ERR_DATA:
      msg = "Tipo de Imagem não Suportado.";
      break;
    case IM_ERR_FORMAT:
      msg = "Formato Inválido.";
      break;
    case IM_ERR_COMPRESS:
      msg = "Compressão Inválida ou não Suportada.";
      break;
    default:
      msg = "Erro Desconhecido.";
    }
  }

  if (interactive)
    IupMessage(title, msg);
  else
    printf("%s: %s", title, msg);
}

About File Formats

TIFF is still the most complete format available. It could be better if Adobe releases the revision 7, but it is on stand by. TIFF supports all the IM image representation concepts. In fact we were partially inspired by the TIFF specification. My suggestion is whenever possible use TIFF.

But TIFF may not be the ideal format for many situations. The W3C standards include only JPEG, GIF and PNG for Web browsers. JPEG forces the image to be RGB or Gray with a lossy compressed. GIF forces the image to be MAP with LZW compression. PNG forces the image to be RGB, MAP, Gray or Binary, with Deflate compression. So these characteristics are necessary to force small values for faster downloads.

JPEG is to be used for photographic content, PNG should be used for the remaining cases, but GIF is still the best to do simple animated images.

Except for some specific cases where a format is needed for compatibility, the other formats are less important. TGA, PCX, RAS, SGI and BMP have almost the same utility.

JP2 must be used for JPEG-2000 compression, would be nice if a new TIFF specification includes this standard.

Since PNM has a textual header it is very simple to teach for students so they can actually "see" the header. It is also a format easy to share images, but it does not do much more than that.

The TIFF and the GIF format also have support for multiple images. This does not necessarily defines an animation, pyramid nor a volume, but some times they are used in these ways.

GIF became very popular to build animations for the Web, and since the LZW patent expired Unisys realized that charging the usage isn't going to work and so they did not renew it. LZW is fully supported at IM.

IM also supports video formats like AVI and WMV as external libraries. In these cases the frames are also loaded as a sequence of individual images. Sound is not supported.

TIFF, JPEG and PNG have an extensive list of attributes, most of them are listed in the documentation, but some custom attributes may come up when reading an image from file.

New File Formats

Again the easiest way is to look at the source code of an already implemented format. The RAS, BMP, TGA and SGI formats are very simple to follow.

Basically you have to implement a class that inherits from imFormat and implement its virtual methods. You can use the imBinFile functions for I/O or use an external SDK.

For more information see File Format SDK.

Memory I/O and Others

For the majority of the formats, with the exception of the ones that use external SDKs, the I/O is done by the imBinFile module.

This module can be configured to access other types of media by implementing a driver. There are some predefined drivers see Reference / Utilities / Binary File Access.

One very useful is the Memory Buffer where you can read and write a file in memory. The activation is very simple, it needs to happen just before the imFileOpen/imFileNew functions. But the file name must be a pointer to an imBinMemoryFileName structure instead of a string. Se the example bellow:

int old_mode = imBinFileSetCurrentModule(IM_MEMFILE);

imBinMemoryFileName MemFileName; // This structure must exists
    while the file remains open.

    MemFileName.buffer = NULL; // Let the library initializes the buffer,

    // but it must be freed the the application, free(MemFileName.buffer)
    MemFileName.size = 1024; // The initial size

    MemFileName.reallocate = 1.5; // The reallocation will increase 50% the
    buffer.

    // This is used only when writing with a variable buffer.

    // Use 0 to fix the buffer size.

int error;

    imFile* ifile = imFileNew((const char*)&MemFileName, "GIF", &error);

imBinFileSetCurrentModule(old_mode); // The mode needs to be active
    only for the imFileOpen/imFileNew call.

if (error != IM_ERR_NONE) ....

Another driver interesting is the Subfile where you can read and write from a file that is already open. This is very important for formats that can have an embedded format inside. In this module the file_name is a pointer to an imBinFile structure from any other module that uses the imBinFile functions. The imBinFileSize will return the full file size, but the imBinFileSeekTo and imBinFileTell functions will compensate the position when the subfile was open.

Using imBinFileSetCurrentModule(IM_SUBFILE) just like the example above will allow you to open a subfile using the imFileOpen/imFileNew functions.


Storage Samples

More Storage Samples

See the Storage Guide for simple storage samples.

Information

This is a command line application that displays information obtained from a file using the IM I/O functions, basically imFile functions. It depends only on the IM main library.

Here is an output sample:

IM Info
  File Name:
    exif_test.tif
  File Size: 9.00 Mb
  Format: TIFF - Tagged Image File Format
  Compression: NONE
  Image Count: 1
  Image #0
    Width: 2048
    Height: 1536
    Color Space: RGB
      Has Alpha: No
      Is Packed: Yes
      Is Top Down: Yes
    Data Type: byte
    Data Size: 9.00 Mb
    Attributes:
      YResolution: 72.00
      XResolution: 72.00
      DateTime: 2004:01:14 11:30:11
      Make: SONY
      ResolutionUnit: DPI
      Model: CD MAVICA
      Photometric: 2

You can view the source code here: im_info.cpp

Copy

This is a command line application that copies all the information from one file to another using the IM I/O functions. It depends only on the IM main library. It is usefull for testing the drivers.

You can view the source code here: im_copy.cpp

Load Bitmap from Resource File

In Windows if you have a bitmap stored in a resource file, like this:

bitmap_test BITMAP bitmap_test.bmp

The you could retreive it using the following code:

#include <windows.h>
#include <im.h>
#include <im_dib.h>

HBITMAP hBmp = LoadBitmap(hInstance, "bitmap_test");
imDib* dib = imDibFromHBitmap(hBmp, NULL);
imImage* image imDibToImage(dib);
imDibDestroy(dib);


IM: File Formats

File Formats
[Image Storage]

Collaboration diagram for File Formats:

Modules

TIFF - Tagged Image File Format
JPEG - JPEG File Interchange Format
PNG - Portable Network Graphic Format
GIF - Graphics Interchange Format
BMP - Windows Device Independent Bitmap
RAS - Sun Raster File
LED - IUP image in LED
SGI - Silicon Graphics Image File Format
PCX - ZSoft Picture
TGA - Truevision Graphics Adapter File
PNM - Netpbm Portable Image Map
ICO - Windows Icon
KRN - IM Kernel File Format
AVI - Windows Audio-Video Interleaved RIFF
ECW - ECW JPEG 2000
JP2 - JPEG-2000 JP2 File Format
RAW - RAW File
WMV - Windows Media Video Format

Functions

void | imFormatRegisterInternal (void)
void | imFormatRemoveAll (void)
void | imFormatList (char **format_list, int *format_count)
int | imFormatInfo (const char *format, char *desc, char *ext, int *can_sequence)
int | imFormatCompressions (const char *format, char **comp, int *comp_count, int color_mode, int data_type)
int | imFormatCanWriteImage (const char *format, const char *compression, int color_mode, int data_type)

Detailed Description

See im.h

Internal Predefined File Formats:

  • "BMP" - Windows Device Independent Bitmap
  • "PCX" - ZSoft Picture
  • "GIF" - Graphics Interchange Format
  • "TIFF" - Tagged Image File Format
  • "RAS" - Sun Raster File
  • "SGI" - Silicon Graphics Image File Format
  • "JPEG" - JPEG File Interchange Format
  • "LED" - IUP image in LED
  • "TGA" - Truevision Targa
  • "RAW" - RAW File
  • "PNM" - Netpbm Portable Image Map
  • "ICO" - Windows Icon
  • "PNG" - Portable Network Graphic Format

Other Supported File Formats:

  • "JP2" - JPEG-2000 JP2 File Format
  • "AVI" - Windows Audio-Video Interleaved RIFF
  • "WMV" - Windows Media Video Format

Some Known Compressions:

  • "NONE" - No Compression.
  • "RLE" - Run Lenght Encoding.
  • "LZW" - Lempel, Ziff and Welsh.
  • "JPEG" - Join Photographics Experts Group.
  • "DEFLATE" - LZ77 variation (ZIP)

Function Documentation

void imFormatRegisterInternal ( void )

Registers all the internal formats.
It is automatically called internally when a format is accessed, but can be called to force the internal formats to be registered before other formats. Notice that additional formats when registered will be registered before the internal formats if imFormatRegisterInternal is not called yet.
To control the register order is usefull when two format drivers handle the same format. The first registered format will always be used first.

void imFormatRemoveAll ( void )

Remove all registered formats. Call this if you are checking memory leaks.

void imFormatList | ( | char ** | format_list,
 |  | int * | format_count
 | ) |  |

Returns a list of the registered formats.
format_list is an array of format identifiers. Each format identifier is 10 chars max, maximum of 50 formats. You can use "char* format_list[50]".

im.FormatList() -> format_list: table of strings [in Lua 5]
int imFormatInfo | ( | const char * | format,
 |  | char * | desc,
 |  | char * | ext,
 |  | int * | can_sequence
 | ) |  |

Returns the format description.
Format description is 50 chars max.
Extensions are separated like "*.tif;*.tiff;", 50 chars max.
Returns an error code. The parameters can be NULL, except format. See also File Formats.

im.FormatInfo(format: string) -> error: number, desc: string, ext: string, can_sequence: boolean [in Lua 5]
int imFormatCompressions | ( | const char * | format,
 |  | char ** | comp,
 |  | int * | comp_count,
 |  | int | color_mode,
 |  | int | data_type
 | ) |  |

Returns the format compressions.
Compressions are 20 chars max each, maximum of 50 compressions. You can use "char* comp[50]".
color_mode and data_type are optional, use -1 to ignore them.
If you use them they will select only the allowed compressions checked like in imFormatCanWriteImage.
Returns an error code. See also File Formats, imErrorCodes, imDataType, imColorSpace and imColorModeConfig.

im.FormatCompressions(format: string, [color_mode: number], [data_type: number]) -> error: number, comp: table of strings [in Lua 5]
int imFormatCanWriteImage | ( | const char * | format,
 |  | const char * | compression,
 |  | int | color_mode,
 |  | int | data_type
 | ) |  |

Checks if the format suport the given image class at the given compression.
Returns an error code. See also File Formats, imErrorCodes, imDataType, imColorSpace and imColorModeConfig.

im.FormatCanWriteImage(format: string, compression: string, color_mode: number, data_type: number) -> can_write: boolean [in Lua 5]


IM: RAW - RAW File

Functions

RAW - RAW File
[File Formats]

Collaboration diagram for RAW - RAW File:

Functions

imFile * | imFileOpenRaw (const char *file_name, int *error)
imFile * | imFileNewRaw (const char *file_name, int *error)

Detailed Description

The file must be open/created with the functions imFileOpenRaw and imFileNewRaw.

Description

Internal Implementation.
Supports RAW binary images. This is an unstructured and uncompressed binary data. It is NOT a Camera RAW file generated in many professional digital cameras.
You must know image parameters a priori and must set the IM_INT attributes "Width", "Height", "ColorMode", "DataType" before the imFileReadImageInfo/imFileWriteImageInfo functions.
The data must be in binary form, but can start in an arbitrary offset from the begining of the file, use attribute "StartOffset". The default is at 0 offset.
Integer sign and double precision can be converted using attribute "SwitchType".
The conversions will be BYTE<->CHAR, USHORT<->SHORT, INT<->UINT, FLOAT<->DOUBLE.
Byte Order can be Little Endian (Intel=1) or Big Endian (Motorola=0), use the attribute "ByteOrder", the default is the current CPU.
The lines can be aligned to a BYTE (1), WORD (2) or DWORD (4) boundaries, ue attribute "Padding" with the respective value.
If the compression is ASCII the data is stored in textual format, instead of binary. In this case SwitchType and ByteOrder are ignored, and Padding should be 0.
See im_raw.h

Features

    Data Types: <all>
    Color Spaces: all, except MAP.
    Compressions:
      NONE - no compression [default]
      ASCII (textual data)
    Can have more than one image, depends on "StartOffset" attribute.
    Can have an alpha channel.
    Components can be packed or not.
    Lines arranged from top down to bottom or bottom up to top.

    Attributes:
      Width, Height, ColorMode, DataType IM_INT (1)
      ImageCount[1], StartOffset[0], SwitchType[FALSE], ByteOrder[IM_LITTLEENDIAN], Padding[0]  IM_INT (1)

    Comments:
      In fact ASCII is an expansion, not a compression, because the file will be larger than binary data.

Function Documentation

imFile* imFileOpenRaw | ( | const char * | file_name,
 |  | int * | error
 | ) |  |

Opens a RAW image file. See also imErrorCodes.

im.FileOpenRaw(file_name: string) -> ifile: imFile, error: number [in Lua 5]
imFile* imFileNewRaw | ( | const char * | file_name,
 |  | int * | error
 | ) |  |

Creates a RAW image file. See also imErrorCodes.

im.FileNewRaw(file_name: string) -> ifile: imFile, error: number [in Lua 5]


IM: BMP - Windows Device Independent Bitmap

BMP - Windows Device Independent Bitmap
[File Formats]

Collaboration diagram for BMP - Windows Device Independent Bitmap:

Description

Windows Copyright Microsoft Corporation.
Internal Implementation.

Features

    Data Types: Byte
    Color Spaces: RGB, MAP and Binary (Gray saved as MAP)
    Compressions:
      NONE - no compression [default]
      RLE  - Run Lenght Encoding (only for MAP and Gray)
    Only one image.
    Can have an alpha channel (only for RGB)
    Internally the components are always packed.
    Lines arranged from top down to bottom or bottom up to top. But are saved always as bottom up.

    Attributes:
      ResolutionUnit (string) ["DPC", "DPI"]
      XResolution, YResolution IM_FLOAT (1)

    Comments:
      Reads OS2 1.x and Windows 3, but writes Windows 3 always.
      Version 4 and 5 BMPs are not supported.


IM: GIF - Graphics Interchange Format

GIF - Graphics Interchange Format
[File Formats]

Collaboration diagram for GIF - Graphics Interchange Format:

Description

Copyright (c) 1987,1988,1989,1990 CompuServe Incorporated.
GIF is a Service Mark property of CompuServe Incorporated.
Graphics Interchange Format Programming Reference, 1990.
LZW Copyright Unisys.
Patial Internal Implementation.
Decoding and encoding code were extracted from GIFLib 1.0.
Copyright (c) 1989 Gershon Elber.

Features

    Data Types: Byte
    Color Spaces: MAP only, (Gray and Binary saved as MAP)
    Compressions:
      LZW - Lempel-Ziv & Welch      [default]
    Can have more than one image.
    No alpha channel.
    Internally the lines are arranged from top down to bottom.

    Attributes:
      ScreenHeight, ScreenWidth IM_USHORT (1) screen size [default to the first image size]
      Interlaced IM_INT (1 | 0) default 0
      Description (string)
      TransparencyIndex IM_BYTE (1)
      XScreen, YScreen IM_USHORT (1) screen position
      UserInput IM_BYTE (1) [1, 0]
      Disposal (string) [UNDEF, LEAVE, RBACK, RPREV]
      Delay IM_USHORT (1) [time to wait betweed frames in 1/100 of a second]
      Iterations IM_USHORT (1) (NETSCAPE2.0 Application Extension) [The number of times to repeat the animation. 0 means to repeat forever. ]

    Comments:
      Attributes after the last image are ignored.
      Reads GIF87 and GIF89, but writes GIF89 always.
      Ignored attributes: Background Color Index, Pixel Aspect Ratio,
                          Plain Text Extensions, Application Extensions...


IM: ICO - Windows Icon

ICO - Windows Icon
[File Formats]

Collaboration diagram for ICO - Windows Icon:

Description

Windows Copyright Microsoft Corporation.
Internal Implementation.

Features

    Data Types: Byte
    Color Spaces: RGB, MAP and Binary (Gray saved as MAP)
    Compressions:
      NONE - no compression [default]
    Can have more than one image. But reading and writing is limited to 10 images max,
      and all images must have different sizes and bpp.
    Can have an alpha channel (only for RGB)
    Internally the components are always packed.
    Internally the lines are arranged from bottom up to top.

    Attributes:
      TransparencyIndex IM_BYTE (1)

    Comments:
      If the user specifies an alpha channel, the AND mask is loaded as alpha if
        the file color mode does not contain the IM_ALPHA flag.
      For MAP imagens, if the user does not specifies an alpha channel
        the TransparencyIndex is used to initialize the AND mask when writing,
        and if the user does specifies an alpha channel
        the most repeated index with transparency will be the transparent index.
      Although any size and common bpp can be used is recomended to use the typical configurations:
        16x16, 32x32, 48x48, 64x64 or 96x96
        2 colors, 16 colors, 256 colors, 24bpp or 32bpp


IM: JPEG - JPEG File Interchange Format

JPEG - JPEG File Interchange Format
[File Formats]

Collaboration diagram for JPEG - JPEG File Interchange Format:

Description

ISO/IEC 10918 (1994, 1995, 1997, 1999)
http://www.jpeg.org/
Access to the JPEG file format uses libJPEG version 7.
http://www.ijg.org
Copyright (C) 1994-2009, Thomas G. Lane, Guido Vollbeding
from the Independent JPEG Group.
Access to the EXIF attributes uses libEXIF version 0.6.17.
http://sourceforge.net/projects/libexif
Copyright (C) 2001-2003, Lutz Müller

Features

    Data Types: Byte
    Color Spaces: Gray, RGB, CMYK and YCbCr (Binary Saved as Gray)
    Compressions:
      JPEG - ISO JPEG  [default]
    Only one image.
    No alpha channel.
    Internally the components are always packed.
    Internally the lines are arranged from top down to bottom.
    Handle(1) returns jpeg_decompress_struct* when reading, and
                      jpeg_compress_struct* when writing (libJPEG structures).

    Attributes:
      AutoYCbCr IM_INT (1) (controls YCbCr auto conversion) default 1
      JPEGQuality IM_INT (1) [0-100, default 75] (write only)
      ResolutionUnit (string) ["DPC", "DPI"]
      XResolution, YResolution IM_FLOAT (1)
      Interlaced (same as Progressive) IM_INT (1 | 0) default 0
      Description (string)
      (lots of Exif tags)

    Changes to libJPEG:
      jdatadst.c - fflush and ferror replaced by macros JFFLUSH and JFERROR.
      jinclude.h - standard JFFLUSH and JFERROR definitions, and new macro HAVE_JFIO.
      jdhuf.c - added support for OJPEG_SUPPORT in libTIFF.
      new file created: jconfig.h

    Changes to libEXIF:
      new files config.h and _stdint.h
      changed "exif-tag.c" to add new function
      changed "exif-entry.c" to improve exif_entry_initialize

    Comments:
      Other APPx markers are ignored.
      No thumbnail support.
      RGB images are automatically converted to YCbCr when saved.
      Also YcbCr are converted to RGB when loaded. Use AutoYCbCr=0 to disable this behavior.


IM: KRN - IM Kernel File Format

KRN - IM Kernel File Format
[File Formats]

Collaboration diagram for KRN - IM Kernel File Format:

Description

Textual format to provied a simple way to create kernel convolution images.
Internal Implementation.

Features

    Data Types: Byte, Int
    Color Spaces: Gray
    Compressions:
      NONE - no compression [default]
    Only one image.
    No alpha channel.
    Internally the lines are arranged from top down to bottom.

    Attributes:
      Description (string)

    Comments:
      The format is very simple, inspired by PNM.
      It was developed because PNM does not have support for INT and FLOAT.
      Remeber that usually convolution operations use kernel size an odd number.

    Format Model:
      IMKERNEL
      Description up to 512 characters
      width height
      type (0 - IM_INT, 1 - IM_FLOAT)
      data...

    Example:
      IMKERNEL
      Gradian
      3 3
      0
      0 -1 0
      0  1 0
      0  0 0


IM: LED - IUP image in LED

LED - IUP image in LED
[File Formats]

Collaboration diagram for LED - IUP image in LED:

Description

Copyright Tecgraf/PUC-Rio and PETROBRAS/CENPES.
Internal Implementation.

Features

    Data Types: Byte
    Color Spaces: MAP only (Gray and Binary saved as MAP)
    Compressions:
      NONE - no compression  [default]
    Only one image.
    No alpha channel.
    Internally the lines are arranged from top down to bottom.

    Attributes:
      none

    Comments:
      LED file must start with "LEDImage = IMAGE[".


IM: PCX - ZSoft Picture

PCX - ZSoft Picture
[File Formats]

Collaboration diagram for PCX - ZSoft Picture:

Description

Copyright ZSoft Corporation.
ZSoft (1988) PCX Technical Reference Manual.
Internal Implementation.

Features

    Data Types: Byte
    Color Spaces: RGB, MAP and Binary (Gray saved as MAP)
    Compressions:
      NONE - no compression
      RLE  - Run Lenght Encoding [default - since uncompressed PCX is not well supported]
    Only one image.
    No alpha channel.
    Internally the components are always packed.
    Internally the lines are arranged from top down to bottom.

    Attributes:
      ResolutionUnit (string) ["DPC", "DPI"]
      XResolution, YResolution IM_FLOAT (1)
      XScreen, YScreen IM_USHORT (1) screen position

    Comments:
      Reads Versions 0-5, but writes Version 5 always.


IM: PNG - Portable Network Graphic Format

PNG - Portable Network Graphic Format
[File Formats]

Collaboration diagram for PNG - Portable Network Graphic Format:

Description

Access to the PNG file format uses libPNG version 1.2.39.
http://www.libpng.org
Copyright (C) 1998-2009 Glenn Randers-Pehrson

Features

    Data Types: Byte and UShort
    Color Spaces: Gray, RGB, MAP and Binary
    Compressions:
      DEFLATE - LZ77 variation (ZIP) [default]
    Only one image.
    Can have an alpha channel.
    Internally the components are always packed.
    Internally the lines are arranged from top down to bottom.
    Handle(1) returns png_structp libPNG structure.

    Attributes:
      ZIPQuality IM_INT (1) [1-9, default 6] (write only)
      ResolutionUnit (string) ["DPC", "DPI"]
      XResolution, YResolution IM_FLOAT (1)
      Interlaced (same as Progressive) IM_INT (1 | 0) default 0
      Gamma IM_FLOAT (1)
      WhitePoint IMFLOAT (2)
      PrimaryChromaticities  IMFLOAT (6)
      XPosition, YPosition IM_FLOAT (1)
      sRGBIntent IM_INT (1) [0: Perceptual, 1: Relative colorimetric, 2: Saturation, 3: Absolute colorimetric]
      TransparencyMap IM_BYTE (N) (for MAP images is the alpha value of the corresponding palette index)
      TransparencyIndex IM_BYTE (1) (for MAP images is the first index that has minimum alpha in TransparencyMap, for GRAY images is the index that it is fully transparent)
      TransparencyColor IM_BYTE (3) (for RGB images is the color that is full transparent)
      CalibrationName, CalibrationUnits (string)
      CalibrationLimits IM_INT (2)
      CalibrationEquation IM_BYTE (1) [0-Linear,1-Exponential,2-Arbitrary,3-HyperbolicSine)]
      CalibrationParam (string) [params separated by '\\n']
      Title, Author, Description, Copyright, DateTime (string)
      Software, Disclaimer, Warning, Source, Comment, ...       (string)
      DateTimeModified (string) [when writing uses the current system time]
      ICCProfile IM_BYTE (N)
      ScaleUnit (string) ["meters", "radians"]
      XScale, YScale IM_FLOAT (1)

    Comments:
      When saving PNG image with TransparencyIndex or TransparencyMap, TransparencyMap has precedence, so set it to NULL if you changed TransparencyIndex.
      Attributes after the image are ignored.
      Define PNG_NO_CONSOLE_IO to avoid printfs. We also define PNG_TIME_RFC1123_SUPPORTED.
      Added the following files to the makefile to optimize the library:
      pngvcrd.c  - PNG_USE_PNGVCRD
                   For Intel x86 CPU and Microsoft Visual C++ compiler
      pnggccrd.c - PNG_USE_PNGGCCRD
                   For Intel x86 CPU (Pentium-MMX or later) and GNU C compiler.


IM: PNM - Netpbm Portable Image Map

PNM - Netpbm Portable Image Map
[File Formats]

Collaboration diagram for PNM - Netpbm Portable Image Map:

Description

PNM formats Copyright Jef Poskanzer
Internal Implementation.

Features

    Data Types: Byte and UShort
    Color Spaces: Gray, RGB and Binary
    Compressions:
      NONE - no compression [default]
      ASCII (textual data)
    Can have more than one image, but sequencial access only.
    No alpha channel.
    Internally the components are always packed.
    Internally the lines are arranged from top down to bottom.

    Attributes:
      Description (string)

    Comments:
      In fact ASCII is an expansion, not a compression, because the file will be larger than binary data.


IM: RAS - Sun Raster File

RAS - Sun Raster File
[File Formats]

Collaboration diagram for RAS - Sun Raster File:

Description

Copyright Sun Corporation.
Internal Implementation.

Features

    Data Types: Byte
    Color Spaces: Gray, RGB, MAP and Binary
    Compressions:
      NONE - no compression   [default]
      RLE  - Run Lenght Encoding
    Only one image.
    Can have an alpha channel (only for IM_RGB)
    Internally the components are always packed.
    Internally the lines are arranged from top down to bottom.

    Attributes:
      none


IM: SGI - Silicon Graphics Image File Format

SGI - Silicon Graphics Image File Format
[File Formats]

Collaboration diagram for SGI - Silicon Graphics Image File Format:

Description

SGI is a trademark of Silicon Graphics, Inc.
Internal Implementation.

Features

    Data Types: Byte and UShort
    Color Spaces: Gray and RGB (Binary saved as Gray, MAP with fixed palette when reading only)
    Compressions:
      NONE - no compression  [default]
      RLE  - Run Lenght Encoding
    Only one image.
    Can have an alpha channel (only for IM_RGB)
    Internally the components are always packed.
    Internally the lines are arranged from bottom up to top.

    Attributes:
      Description (string)


IM: TGA - Truevision Graphics Adapter File

TGA - Truevision Graphics Adapter File
[File Formats]

Collaboration diagram for TGA - Truevision Graphics Adapter File:

Description

Truevision TGA File Format Specification Version 2.0
Technical Manual Version 2.2 January, 1991
Copyright 1989, 1990, 1991 Truevision, Inc.
Internal Implementation.

Features

    Supports 8 bits per component only. Data type is always Byte.
    Color Spaces: Gray, RGB and MAP (Binary saved as Gray)
    Compressions:
      NONE - no compression [default]
      RLE  - Run Lenght Encoding
    Only one image.
    Can have an alpha channel (only for RGB)
    Internally the components are always packed.
    Internally the lines are arranged from bottom up to top or from top down to bottom.

    Attributes:
      XScreen, YScreen IM_USHORT (1) screen position
      Title, Author, Description, JobName, Software (string)
      SoftwareVersion (read only) (string)
      DateTimeModified (string) [when writing uses the current system time]
      Gamma IM_FLOAT (1)


IM: TIFF - Tagged Image File Format

TIFF - Tagged Image File Format
[File Formats]

Collaboration diagram for TIFF - Tagged Image File Format:

Description

Copyright (c) 1986-1988, 1992 by Adobe Systems Incorporated.
Originally created by a group of companies, the Aldus Corporation keeped the copyright until Aldus was aquired by Adobe.
TIFF Revision 6.0 Final — June 3, 1992
http://www.adobe.com/Support/TechNotes.html
Access to the TIFF file format uses libTIFF version 3.9.2
http://www.remotesensing.org/libtiff/
Copyright (c) 1988-1997 Sam Leffler
Copyright (c) 1991-1997 Silicon Graphics, Inc.

Features

    Data Types: <all>
    Color Spaces: Gray, RGB, CMYK, YCbCr, Lab, XYZ, Map and Binary.
    Compressions:
      NONE - no compression  [default for IEEE Floating Point Data]
      CCITTRLE - CCITT modified Huffman RLE (binary only) [default for Binary]
      CCITTFAX3 - CCITT Group 3 fax         (binary only)
      CCITTFAX4 - CCITT Group 4 fax         (binary only)
      LZW - Lempel-Ziv & Welch  [default]
      JPEG - ISO JPEG    [default for YCBCR]
      NEXT - NeXT 2-bit RLE (2 bpp only)
      CCITTRLEW - CCITT modified Huffman RLE with word alignment (binary only)
      RLE - Packbits (Macintosh RLE) [default for MAP]
      THUNDERSCAN - ThunderScan 4-bit RLE (only for 2 or 4 bpp)
      PIXARLOG - Pixar companded 11-bit ZIP (only byte, ushort and float)
      DEFLATE - LZ77 variation (ZIP)
      ADOBE_DEFLATE - Adobe LZ77 variation
      SGILOG - SGI Log Luminance RLE for L and Luv (only byte, ushort and float) [default for XYZ]
      SGILOG24 - SGI Log 24-bit packed for Luv (only byte, ushort and float)
    Can have more than one image.
    Can have an alpha channel.
    Components can be packed or not.
    Lines arranged from top down to bottom or bottom up to top.
    Handle(1) returns a TIFF* libTIFF structure.

    Attributes:
      Photometric IM_USHORT (1) (when writing this will complement the color_mode information, for Mask, MinIsWhite, ITULab and ICCLab)
      ExtraSampleInfo IM_USHORT (1) (description of alpha channel: 0- uknown, 1- pre-multiplied, 2-normal)
      JPEGQuality IM_INT (1) [0-100, default 75] (write only)
      ZIPQuality IM_INT (1) [1-9, default 6] (write only)
      ResolutionUnit (string) ["DPC", "DPI"]
      XResolution, YResolution IM_FLOAT (1)
      Description, Author, Copyright, DateTime, DocumentName,
      PageName, TargetPrinter, Make, Model, Software, HostComputer (string)
      InkNames (strings separated by '0's)
      InkSet IM_USHORT (1)
      NumberOfInks IM_USHORT (1)
      DotRange IM_USHORT (2)
      TransferFunction0, TransferFunction1, TransferFunction3 IM_USHORT [gray=0, rgb=012]
      ReferenceBlackWhite IMFLOAT (6)
      WhitePoint IMFLOAT (2)
      PrimaryChromaticities  IMFLOAT (6)
      YCbCrCoefficients IM_FLOAT (3)
      YCbCrSubSampling IM_USHORT (2)
      YCbCrPositioning IM_USHORT (1)
      PageNumber IM_USHORT (2)
      StoNits IM_FLOAT (1)
      XPosition, YPosition IM_FLOAT (1)
      SMinSampleValue, SMaxSampleValue IM_FLOAT (1)
      HalftoneHints IM_USHORT (2)
      SubfileType IM_INT (1)
      ICCProfile IM_BYTE (N)
      MultiBandCount IM_USHORT (1)    [Number of bands in a multiband gray image.]
      MultiBandSelect IM_USHORT (1)   [Band number to read one band of a multiband gray image. Must be set before reading image info.]
      and other TIFF tags as they are described in the TIFF documentation.
      GeoTIFF tags:
        GeoTiePoints, GeoTransMatrix, IntergraphMatrix, GeoPixelScale, GeoDoubleParams IM_FLOAT (N)
        GeoASCIIParams (string)
      Read-only support for EXIF tags as they are described in the EXIF 2.2 documentation. See http://www.exif.org/
      DNG tags as they are described in the DNG documentation. See http://www.adobe.com/br/products/dng/
        Tags BlackLevel, DefaultCropOrigin and DefaultCropSize are incorrectly interpreted by libTIFF so they are ignored.
        Raw image is loaded in place of the thumbnail image in the main IFD.
        SubIFDCount IM_USHORT (1)    [Number of subifds of the current image.]
        SubIFDSelect IM_USHORT (1)   [Subifd number to be read. Must be set before reading image info.]
      (other attributes can be obtained by using libTIFF directly using the Handle(1) function)

    Comments:
      LogLuv is in fact Y'+CIE(u,v), so we choose to always convert it to XYZ.
      SubIFD is handled only for DNG.
      Since LZW patent expired, LZW compression is enabled. LZW Copyright Unisys.
      libGeoTIFF can be used without XTIFF initialization. Use Handle(1) to obtain a TIFF*.

    Changes:
      "tiff_jpeg.c" - commented "downsampled_output = TRUE" in 2 places.
      A few fixes in some files, search for "IMLIB" to see the changes.
      New file "tif_config.h" to match our needs.
      New file "tiff_binfile.c" that implement I/O rotines using imBinFile.


IM: AVI - Windows Audio-Video Interleaved RIFF

Functions

AVI - Windows Audio-Video Interleaved RIFF
[File Formats]

Collaboration diagram for AVI - Windows Audio-Video Interleaved RIFF:

Functions

void imFormatRegisterAVI (void)

Detailed Description

Description

Windows Copyright Microsoft Corporation.
Access to the AVI format uses Windows AVIFile library. Available in Windows Only.
When writing a new file you must use an ".avi" extension, or the Windows API will fail.
You must link the application with "im_avi.lib" and you must call the function imFormatRegisterAVI once to register the format into the IM core library. In Lua call require"imlua_avi".
Depends also on the VFW library (vfw32.lib). When using the "im_avi.dll" this extra library is not necessary.
If using Cygwin or MingW must link with "-lvfw32". Old versions of Cygwin and MingW use the "-lvfw_ms32" and "-lvfw_avi32".
See im_format_avi.h

Features

    Data Types: Byte
    Color Spaces: RGB, MAP and Binary (Gray saved as MAP)
    Compressions (installed in Windows XP by default):
      NONE     - no compression [default]
      RLE      - Microsoft RLE (8bpp only)
      CINEPACK - Cinepak Codec by Radius
      MSVC     - Microsoft Video 1 (old)
      M261     - Microsoft H.261 Video Codec
      M263     - Microsoft H.263 Video Codec
      I420     - Intel 4:2:0 Video Codec (same as M263)
      IV32     - Intel Indeo Video Codec 3.2 (old)
      IV41     - Intel Indeo Video Codec 4.5 (old)
      IV50     - Intel Indeo Video 5.1
      IYUV     - Intel IYUV Codec
      MPG4     - Microsoft MPEG-4 Video Codec V1 (not MPEG-4 compliant) (old)
      MP42     - Microsoft MPEG-4 Video Codec V2 (not MPEG-4 compliant)
      CUSTOM   - (show compression dialog)
      DIVX     - DivX 5.0.4 Codec (DivX must be installed)
      (others, must be the 4 charaters of the fourfcc code)
    Can have more than one image.
    Can have an alpha channel (only for RGB)
    Internally the components are always packed.
    Lines arranged from top down to bottom or bottom up to top. But are saved always as bottom up.
    Handle(0) returns NULL. imBinFile is not supported.
    Handle(1) returns PAVIFILE.
    Handle(2) returns PAVISTREAM.

    Attributes:
      FPS IM_FLOAT (1) (should set when writing, default 15)
      AVIQuality IM_INT (1) [1-10000, default -1] (write only) [unsed if compression=CUSTOM]
      KeyFrameRate IM_INT (1) (write only) [key frame frequency, if 0 not using key frames, default 15, unsed if compression=CUSTOM]
      DataRate IM_INT (1) (write only) [kilobits/second, default 2400, unsed if compression=CUSTOM]

    Comments:
      Reads only the first video stream. Other streams are ignored.
      All the images have the same size, you must call imFileReadImageInfo/imFileWriteImageInfo
        at least once.
      For codecs comparsion and download go to:
        http://graphics.lcs.mit.edu/~tbuehler/video/codecs/
        http://www.fourcc.org

Function Documentation

void imFormatRegisterAVI ( void )

Register the AVI Format.
In Lua, when using require"imlua_avi" this function will be automatically called.


IM: JP2 - JPEG-2000 JP2 File Format

Functions

JP2 - JPEG-2000 JP2 File Format
[File Formats]

Collaboration diagram for JP2 - JPEG-2000 JP2 File Format:

Functions

void imFormatRegisterJP2 (void)

Detailed Description

Description

ISO/IEC 15444 (2000, 2003)
http://www.jpeg.org/
You must link the application with "im_jp2.lib" and you must call the function imFormatRegisterJP2 once to register the format into the IM core library. In Lua call require"imlua_jp2".
Access to the JPEG2000 file format uses libJasper version 1.900.1
http://www.ece.uvic.ca/~mdadams/jasper
Copyright (c) 2001-2006 Michael David Adams.
and GeoJasPer 1.4.0
Copyright (c) 2003-2007 Dmitry V. Fedorov.
http://www.dimin.net/software/geojasper/
See im_format_jp2.h

Features

    Data Types: Byte and UShort
    Color Spaces: Binary, Gray, RGB, YCbCr, Lab and XYZ
    Compressions:
      JPEG-2000 - ISO JPEG 2000  [default]
    Only one image.
    Can have an alpha channel.
    Internally the components are always unpacked.
    Internally the lines are arranged from top down to bottom.
    Handle(1) returns jas_image_t*
    Handle(2) returns jas_stream_t*

    Attributes:
      CompressionRatio IM_FLOAT (1) [write only, example: Ratio=7 just like 7:1]
      GeoTIFFBox IM_BYTE (n)
      XMLPacket IM_BYTE (n)

    Comments:
      We read code stream syntax and JP2, but we write always as JP2.
      Used definitions EXCLUDE_JPG_SUPPORT,EXCLUDE_MIF_SUPPORT,
                       EXCLUDE_PNM_SUPPORT,EXCLUDE_RAS_SUPPORT,
                       EXCLUDE_BMP_SUPPORT,EXCLUDE_PGX_SUPPORT
      Changed jas_config.h to match our needs.
      New file jas_binfile.c
      Changed base/jas_stream.c to export jas_stream_create and jas_stream_initbuf.
      Changed jp2/jp2_dec.c and jpc/jpc_cs.c to remove "uint" and "ulong" usage.
      The counter is restarted many times, because it has many phases.

Function Documentation

void imFormatRegisterJP2 ( void )

Register the JP2 Format.
In Lua, when using require"imlua_jp2" this function will be automatically called.


IM: WMV - Windows Media Video Format

Functions

WMV - Windows Media Video Format
[File Formats]

Collaboration diagram for WMV - Windows Media Video Format:

Functions

void imFormatRegisterWMV (void)

Detailed Description

Description

Advanced Systems Format (ASF)
Windows Copyright Microsoft Corporation.
Access to the WMV format uses Windows Media SDK. Available in Windows Only.
You must link the application with "im_wmv.lib" and you must call the function imFormatRegisterWMV once to register the format into the IM core library. In Lua call require"imlua_wmv".
Depends also on the WMF SDK (wmvcore.lib). When using the "im_wmv.dll" this extra library is not necessary.
The application users should have the WMV codec 9 installed: http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx
You must agree with the WMF SDK EULA to use the SDK.
http://wmlicense.smdisp.net/v9sdk/
For more information:
http://www.microsoft.com/windows/windowsmedia/9series/sdk.aspx
http://msdn.microsoft.com/library/en-us/wmform/htm/introducingwindowsmediaformat.asp
See im_format_wmv.h

Features

    Data Types: Byte
    Color Spaces: RGB and MAP (Gray and Binary saved as MAP)
    Compressions (installed in Windows XP by default):
      NONE       - no compression
      MPEG-4v3   - Windows Media MPEG-4 Video V3
      MPEG-4v1   - ISO MPEG-4 Video V1
      WMV7       - Windows Media Video  V7
      WMV7Screen - Windows Media Screen V7
      WMV8       - Windows Media Video  V8
      WMV9Screen - Windows Media Video 9 Screen
      WMV9       - Windows Media Video 9 [default]
      Unknown    - Others
    Can have more than one image.
    Can have an alpha channel (only for RGB) ?
    Internally the components are always packed.
    Lines arranged from top down to bottom or bottom up to top.
    Handle(0) return NULL. imBinFile is not supported.
    Handle(1) returns IWMSyncReader* when reading, IWMWriter* when writing.

    Attributes:
      FPS IM_FLOAT (1) (should set when writing, default 15)
      WMFQuality IM_INT (1) [0-100, default 50] (write only)
      MaxKeyFrameTime IM_INT (1) (write only) [maximum key frame interval in miliseconds, default 5 seconds]
      DataRate IM_INT (1) (write only) [kilobits/second, default 2400]
      VBR IM_INT (1) [0, 1] (write only) [0 - Constant Bit Rate (default), 1 - Variable Bit Rate (Quality-Based)]
      (and several others from the file-level attributes) For ex:
        Title, Author, Copyright, Description (string)
        Duration IM_INT [100-nanosecond units]
        Seekable, HasAudio, HasVideo, Is_Protected, Is_Trusted, IsVBR IM_INT (1) [0, 1]
        NumberOfFrames IM_INT (1)

    Comments:
      IMPORTANT - The "image_count" and the "FPS" attribute may not be available from the file,
        we try to estimate from the duration and from the average time between frames, or using the default value.
      We do not handle DRM protected files (Digital Rights Management).
      Reads only the first video stream. Other streams are ignored.
      All the images have the same size, you must call imFileReadImageInfo/imFileWriteImageInfo
        at least once.
      For optimal random reading, the file should be indexed previously.
      If not indexed by frame, random positioning may not be precise.
      Sequencial reading will always be precise.
      When writing we use a custom profile and time indexing only.
      We do not support multipass encoding.
      Since the driver uses COM, CoInitialize(NULL) and CoUninitialize() are called every Open/Close.

Function Documentation

void imFormatRegisterWMV ( void )

Register the WMF Format.
In Lua, when using require"imlua_wmv" this function will be automatically called.


IM: ECW - ECW JPEG 2000

Functions

ECW - ECW JPEG 2000
[File Formats]

Collaboration diagram for ECW - ECW JPEG 2000:

Functions

void imFormatRegisterECW (void)

Detailed Description

Description

ECW JPEG 2000 Copyright 1998 Earth Resource Mapping Ltd. Two formats are supported with this module. The ECW (Enhanced Compression Wavelet) format and the ISO JPEG 2000 format.
Access to the ECW format uses the ECW JPEG 2000 SDK version 3.3. Available in Windows, Linux and Solaris Only. But source code is also available.
You must link the application with "im_ecw.lib" and you must call the function imFormatRegisterECW once to register the format into the IM core library.
Depends also on the ECW JPEG 2000 SDK libraries (NCSEcw.lib).
When using other JPEG 2000 libraries the first registered library will be used to guess the file format. Use the extension *.ecw to shortcut to this implementation of the JPEG 2000 format.
See im_format_ecw.h
http://www.ermapper.com/ecw/
The three types of licenses available for the ECW JPEG 2000 SDK are as follows:
   - ECW JPEG 2000 SDK Free Use License Agreement - This license governs the free use of
     the ECW JPEG 2000 SDK with Unlimited Decompression and Limited Compression (Less
     than 500MB).
   - ECW JPEG 2000 SDK Public Use License Agreement - This license governs the use of the
     ECW SDK with Unlimited Decompression and Unlimited Compression for applications
     licensed under a GNU General Public style license.
   - ECW JPEG 2000 SDK Commercial Use License Agreement - This license governs the use
     of the ECW JPEG 2000 SDK with Unlimited Decompression and Unlimited Compression
     for commercial applications.

Features

    Data Types: Byte, UShort, Float
    Color Spaces: BINARY, GRAY, RGB, YCBCR
    Compressions:
      ECW - Enhanced Compression Wavelet
      JPEG-2000 - ISO JPEG 2000
    Only one image.
    Can have an alpha channel
    Internally the components are always packed.
    Lines arranged from top down to bottom.
    Handle() returns NCSFileView* when reading, NCSEcwCompressClient* when writing.

    Attributes:
      CompressionRatio   IM_FLOAT (1) [example: Ratio=7 just like 7:1]
      OriginX, OriginY   IM_FLOAT (1)
      Rotation           IM_FLOAT (1)
      CellIncrementX, CellIncrementY    IM_FLOAT (1)
      CellUnits (string)
      Datum (string)
      Projection (string)
      ViewWidth, ViewHeight                    IM_INT (1)    [view zoom]
      ViewXmin, ViewYmin, ViewXmax, ViewYmax   IM_INT (1)    [view limits]
      MultiBandCount IM_USHORT (1)    [Number of bands in a multiband gray image.]
      MultiBandSelect IM_USHORT (1)   [Band number to read one band of a multiband gray image. Must be set before reading image info.]

    Comments:
      Only read support is implemented.
      To read a region of the image you must set the View* attributes before reading the image data.
      After reading a partial image the width and height returned in ReadImageInfo is the view size.
      The view limits define the region to be read.
      The view size is the actual size of the image, so the result can be zoomed.

Function Documentation

void imFormatRegisterECW ( void )

Register the ECW Format

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: Image Storage

Image Storage

Collaboration diagram for Image Storage:

Data Structures

class | imImageFile
C++ Wrapper for the Image File Structure. More...

Modules

File Format SDK
imImage Storage
File Formats

Enumerations

enum imErrorCodes {
IM_ERR_NONE, IM_ERR_OPEN, IM_ERR_ACCESS, IM_ERR_FORMAT,
IM_ERR_DATA, IM_ERR_COMPRESS, IM_ERR_MEM, IM_ERR_COUNTER
}

Functions

imFile * | imFileOpen (const char *file_name, int *error)
imFile * | imFileOpenAs (const char *file_name, const char *format, int *error)
imFile * | imFileNew (const char *file_name, const char *format, int *error)
void | imFileClose (imFile *ifile)
void * | imFileHandle (imFile *ifile, int index)
void | imFileGetInfo (imFile *ifile, char *format, char *compression, int *image_count)
void | imFileSetInfo (imFile *ifile, const char *compression)
void | imFileSetAttribute (imFile *ifile, const char *attrib, int data_type, int count, const void *data)
const void * | imFileGetAttribute (imFile *ifile, const char *attrib, int *data_type, int *count)
void | imFileGetAttributeList (imFile *ifile, char **attrib, int *attrib_count)
void | imFileGetPalette (imFile *ifile, long *palette, int *palette_count)
void | imFileSetPalette (imFile *ifile, long *palette, int palette_count)
int | imFileReadImageInfo (imFile *ifile, int index, int *width, int *height, int *file_color_mode, int *file_data_type)
int | imFileWriteImageInfo (imFile *ifile, int width, int height, int user_color_mode, int user_data_type)
int | imFileReadImageData (imFile *ifile, void *data, int convert2bitmap, int color_mode_flags)
int | imFileWriteImageData (imFile *ifile, void *data)

Detailed Description

See im.h

Enumeration Type Documentation

enum imErrorCodes

File Access Error Codes

Enumerator:
IM_ERR_NONE

No error.

IM_ERR_OPEN

Error while opening the file (read or write).

IM_ERR_ACCESS

Error while accessing the file (read or write).

IM_ERR_FORMAT

Invalid or unrecognized file format.

IM_ERR_DATA

Invalid or unsupported data.

IM_ERR_COMPRESS

Invalid or unsupported compression.

IM_ERR_MEM

Insuficient memory

IM_ERR_COUNTER

Interrupted by the counter

{
  IM_ERR_NONE,     /**< No error. */
  IM_ERR_OPEN,     /**< Error while opening the file (read or write). */
  IM_ERR_ACCESS,   /**< Error while accessing the file (read or write). */
  IM_ERR_FORMAT,   /**< Invalid or unrecognized file format. */
  IM_ERR_DATA,     /**< Invalid or unsupported data. */
  IM_ERR_COMPRESS, /**< Invalid or unsupported compression. */
  IM_ERR_MEM,      /**< Insuficient memory */
  IM_ERR_COUNTER   /**< Interrupted by the counter */
};

Function Documentation

imFile* imFileOpen | ( | const char * | file_name,
 |  | int * | error
 | ) |  |

Opens the file for reading. It must exists. Also reads file header. It will try to identify the file format. See also imErrorCodes.
In Lua the IM file metatable name is "imFile". When converted to a string will return "imFile(%p)" where p is replaced by the userdata address. If the file is already closed by im.FileClose, then it will return also the suffix "-closed".

im.FileOpen(file_name: string) -> ifile: imFile, error: number [in Lua 5]
imFile* imFileOpenAs | ( | const char * | file_name,
 |  | const char * | format,
 |  | int * | error
 | ) |  |

Opens the file for reading using a specific format. It must exists. Also reads file header. See also imErrorCodes and File Formats.

im.FileOpenAs(file_name, format: string) -> ifile: imFile, error: number [in Lua 5]
imFile* imFileNew | ( | const char * | file_name,
 |  | const char * | format,
 |  | int * | error
 | ) |  |

Creates a new file for writing using a specific format. If the file exists will be replaced.
It will only initialize the format driver and create the file, no data is actually written. See also imErrorCodes and File Formats.

im.FileNew(file_name: string, format: string) -> ifile: imFile, error: number [in Lua 5]
void imFileClose ( imFile * ifile )

Closes the file.
In Lua if this function is not called, the file is closed by the garbage collector.

im.FileClose(ifile: imFile) [in Lua 5]
ifile:Close() [in Lua 5]
void* imFileHandle | ( | imFile * | ifile,
 |  | int | index
 | ) |  |

Returns an internal handle. index=0 returns always an imBinFile* handle, but for some formats returns NULL because they do not use imBinFile (like AVI and WMV). index=1 return an internal structure used by the format, usually is a handle to a third party library structure. This is file format dependent.

ifile:Handle() -> handle: userdata [in Lua 5]
void imFileGetInfo | ( | imFile * | ifile,
 |  | char * | format,
 |  | char * | compression,
 |  | int * | image_count
 | ) |  |

Returns file information. image_count is the number of images in a stack or the number of frames in a video/animation or the depth of a volume data.
compression and image_count can be NULL.
These informations are also available as attributes:

FileFormat (string)
FileCompression (string)
FileImageCount IM_INT (1)

See also File Formats.

ifile:GetInfo() -> format: string, compression: string, image_count: number [in Lua 5]
void imFileSetInfo | ( | imFile * | ifile,
 |  | const char * | compression
 | ) |  |

Changes the write compression method.
If the compression is not supported will return an error code when writting.
Use NULL to set the default compression. You can use the imFileGetInfo to retrieve the actual compression but only after imFileWriteImageInfo. Only a few formats allow you to change the compression between frames.

ifile:SetInfo(compression: string) [in Lua 5]
void imFileSetAttribute | ( | imFile * | ifile,
 |  | const char * | attrib,
 |  | int | data_type,
 |  | int | count,
 |  | const void * | data
 | ) |  |

Changes an extended attribute.
The data will be internally duplicated.
If data is NULL the attribute is removed. If data_type is BYTE then count can be -1 to indicate a NULL terminated string. See also imDataType.

ifile:SetAttribute(attrib: string, data_type: number, data: table of numbers or string) [in Lua 5]

If data_type is IM_BYTE, as_string can be used as data.

const void* imFileGetAttribute | ( | imFile * | ifile,
 |  | const char * | attrib,
 |  | int * | data_type,
 |  | int * | count
 | ) |  |

Returns an extended attribute.
Returns NULL if not found. data_type and count can be NULL. See also imDataType.

ifile:GetAttribute(attrib: string, [as_string: boolean]) -> data: table of numbers or string, data_type: number [in Lua 5]

If data_type is IM_BYTE, as_string can be used to return a string instead of a table.

void imFileGetAttributeList | ( | imFile * | ifile,
 |  | char ** | attrib,
 |  | int * | attrib_count
 | ) |  |

Returns a list of the attribute names.
"attrib" must contain room enough for "attrib_count" names. Use "attrib=NULL" to return only the count.

ifile:GetAttributeList() -> data: table of strings [in Lua 5]
void imFileGetPalette | ( | imFile * | ifile,
 |  | long * | palette,
 |  | int * | palette_count
 | ) |  |

Returns the pallete if any.
"palette" must be a 256 colors alocated array.
Returns zero in "palette_count" if there is no palette. "palette_count" is >0 and <=256.

ifile:GetPalette() -> palette: imPalette [in Lua 5]
void imFileSetPalette | ( | imFile * | ifile,
 |  | long * | palette,
 |  | int | palette_count
 | ) |  |

Changes the pallete.
"palette_count" is >0 and <=256.

ifile:SetPalette(palette: imPalette) [in Lua 5]
int imFileReadImageInfo | ( | imFile * | ifile,
 |  | int | index,
 |  | int * | width,
 |  | int * | height,
 |  | int * | file_color_mode,
 |  | int * | file_data_type
 | ) |  |

Reads the image header if any and returns image information.
Reads also the extended image attributes, so other image attributes will be available only after calling this function.
Returns an error code. index specifies the image number between 0 and image_count-1.
Some drivers reads only in sequence, so "index" can be ignored by the format driver.
Any parameters can be NULL. This function must be called at least once, check each format documentation. See also imErrorCodes, imDataType, imColorSpace and imColorModeConfig.

ifile:ReadImageInfo([index: number]) -> error: number, width: number, height: number, file_color_mode: number, file_data_type: number [in Lua 5]

Default index is 0.

int imFileWriteImageInfo | ( | imFile * | ifile,
 |  | int | width,
 |  | int | height,
 |  | int | user_color_mode,
 |  | int | user_data_type
 | ) |  |

Writes the image header. Writes the file header at the first time it is called. Writes also the extended image attributes.
Must call imFileSetPalette and set other attributes before calling this function.
In some formats the color space will be converted to match file format specification.
Returns an error code. This function must be called at least once, check each format documentation. See also imErrorCodes, imDataType, imColorSpace and imColorModeConfig.

ifile:WriteImageInfo(width: number, height: number, user_color_mode: number, user_data_type: number) -> error: number [in Lua 5]
int imFileReadImageData | ( | imFile * | ifile,
 |  | void * | data,
 |  | int | convert2bitmap,
 |  | int | color_mode_flags
 | ) |  |

Reads the image data with or without conversion.
The data can be converted to bitmap when reading. Data type conversion to byte will always scan for min-max then scale to 0-255, except integer values that min-max are already between 0-255. Complex to real conversions will use the magnitude.
Color mode flags contains packed, alpha and top-botttom information. If flag is 0 means unpacked, no alpha and bottom up. If flag is -1 the file original flags are used.
Returns an error code. See also imErrorCodes, imDataType, imColorSpace and imColorModeConfig.

ifile:ReadImageData(data: userdata, convert2bitmap: boolean, color_mode_flags: number) -> error: number [in Lua 5]
int imFileWriteImageData | ( | imFile * | ifile,
 |  | void * | data
 | ) |  |

Writes the image data.
Returns an error code.

ifile:WriteImageData(data: userdata) -> error: number [in Lua 5]


IM: imImage Storage

Functions

imImage Storage
[Image Storage]

Collaboration diagram for imImage Storage:

Functions

imImage * | imFileLoadImage (imFile *ifile, int index, int *error)
void | imFileLoadImageFrame (imFile *ifile, int index, imImage *image, int *error)
imImage * | imFileLoadBitmap (imFile *ifile, int index, int *error)
imImage * | imFileLoadImageRegion (imFile *ifile, int index, int bitmap, int *error, int xmin, int xmax, int ymin, int ymax, int width, int height)
void | imFileLoadBitmapFrame (imFile *ifile, int index, imImage *image, int *error)
int | imFileSaveImage (imFile *ifile, const imImage *image)
imImage * | imFileImageLoad (const char *file_name, int index, int *error)
imImage * | imFileImageLoadBitmap (const char *file_name, int index, int *error)
imImage * | imFileImageLoadRegion (const char *file_name, int index, int bitmap, int *error, int xmin, int xmax, int ymin, int ymax, int width, int height)
int | imFileImageSave (const char *file_name, const char *format, const imImage *image)

Detailed Description

Functions to simplify the process of reading and writting imImage structures. Will also load and save the alpha planes when possible.
See im_image.h

Function Documentation

imImage* imFileLoadImage | ( | imFile * | ifile,
 |  | int | index,
 |  | int * | error
 | ) |  |

Loads an image from an already open file. Returns NULL if failed.
This will call imFileReadImageInfo and imFileReadImageData.
index specifies the image number between 0 and image_count-1.
The returned image will be of the same color_space and data_type of the image in the file.
Attributes from the file will be stored at the image. See also imErrorCodes.

ifile:LoadImage([index: number]) -> image: imImage, error: number [in Lua 5]

Default index is 0.

void imFileLoadImageFrame | ( | imFile * | ifile,
 |  | int | index,
 |  | imImage * | image,
 |  | int * | error
 | ) |  |

Loads an image from an already open file. Returns NULL if failed.
This function assumes that the image in the file has the same parameters as the given image.
This will call imFileReadImageInfo and imFileReadImageData.
index specifies the image number between 0 and image_count-1.
The returned image will be of the same color_space and data_type of the image in the file.
Attributes from the file will be stored at the image. See also imErrorCodes.

ifile:LoadImageFrame(index: number, image: imImage) -> error: number [in Lua 5]

Default index is 0.

imImage* imFileLoadBitmap | ( | imFile * | ifile,
 |  | int | index,
 |  | int * | error
 | ) |  |

Loads an image from an already open file, but forces the image to be a bitmap.
The returned imagem will be always a Bitmap image, with color_space RGB, MAP, GRAY or BINARY, and data_type IM_BYTE.
index specifies the image number between 0 and image_count-1.
Returns NULL if failed. Attributes from the file will be stored at the image. See also imErrorCodes.

ifile:LoadBitmap([index: number]) -> image: imImage, error: number [in Lua 5]

Default index is 0.

imImage* imFileLoadImageRegion | ( | imFile * | ifile,
 |  | int | index,
 |  | int | bitmap,
 |  | int * | error,
 |  | int | xmin,
 |  | int | xmax,
 |  | int | ymin,
 |  | int | ymax,
 |  | int | width,
 |  | int | height
 | ) |  |

Loads an image region from an already open file. Returns NULL if failed.
This will call imFileReadImageInfo and imFileReadImageData.
index specifies the image number between 0 and image_count-1.
The returned image will be of the same color_space and data_type of the image in the file, or will be a Bitmap image.
Attributes from the file will be stored at the image. See also imErrorCodes.
For now, it works only for the ECW file format.

ifile:LoadRegion(index, bitmap, xmin, xmax, ymin, ymax, width, height: number) -> image: imImage, error: number [in Lua 5]

Default index is 0.

void imFileLoadBitmapFrame | ( | imFile * | ifile,
 |  | int | index,
 |  | imImage * | image,
 |  | int * | error
 | ) |  |

Loads an image from an already open file, but forces the image to be a bitmap.
This function assumes that the image in the file has the same parameters as the given image.
The imagem must be a Bitmap image, with color_space RGB, MAP, GRAY or BINARY, and data_type IM_BYTE.
index specifies the image number between 0 and image_count-1.
Returns NULL if failed. Attributes from the file will be stored at the image. See also imErrorCodes.

ifile:LoadBitmapFrame(index: number, image: imImage) -> error: number [in Lua 5]

Default index is 0.

int imFileSaveImage | ( | imFile * | ifile,
 |  | const imImage * | image
 | ) |  |

Saves the image to an already open file.
This will call imFileWriteImageInfo and imFileWriteImageData.
Attributes from the image will be stored at the file. Returns error code.

ifile:SaveImage(image: imImage) -> error: number [in Lua 5]
imImage* imFileImageLoad | ( | const char * | file_name,
 |  | int | index,
 |  | int * | error
 | ) |  |

Loads an image from file. Open, loads and closes the file.
index specifies the image number between 0 and image_count-1.
Returns NULL if failed. Attributes from the file will be stored at the image. See also imErrorCodes.

im.FileImageLoad(file_name: string, [index: number]) -> image: imImage, error: number [in Lua 5]

Default index is 0.

imImage* imFileImageLoadBitmap | ( | const char * | file_name,
 |  | int | index,
 |  | int * | error
 | ) |  |

Loads an image from file, but forces the image to be a bitmap. Open, loads and closes the file.
index specifies the image number between 0 and image_count-1.
Returns NULL if failed. Attributes from the file will be stored at the image. See also imErrorCodes.

im.FileImageLoadBitmap(file_name: string, [index: number]) -> image: imImage, error: number [in Lua 5]

Default index is 0.

imImage* imFileImageLoadRegion | ( | const char * | file_name,
 |  | int | index,
 |  | int | bitmap,
 |  | int * | error,
 |  | int | xmin,
 |  | int | xmax,
 |  | int | ymin,
 |  | int | ymax,
 |  | int | width,
 |  | int | height
 | ) |  |

Loads an image region from file. Open, loads and closes the file.
index specifies the image number between 0 and image_count-1.
Returns NULL if failed. Attributes from the file will be stored at the image. See also imErrorCodes.
For now, it works only for the ECW file format.

im.FileImageLoadRegion(file_name: string, index, bitmap, xmin, xmax, ymin, ymax, width, height: number, ) -> image: imImage, error: number [in Lua 5]

Default index is 0.

int imFileImageSave | ( | const char * | file_name,
 |  | const char * | format,
 |  | const imImage * | image
 | ) |  |

Saves the image to file. Open, saves and closes the file.
Returns error code.
Attributes from the image will be stored at the file.

im.FileImageSave(file_name: string, format: string, image: imImage) -> error: number [in Lua 5]
image:Save(file_name: string, format: string) -> error: number [in Lua 5]


IM: File Format SDK

File Format SDK
[Image Storage]

Collaboration diagram for File Format SDK:

Data Structures

struct | _imFile
Image File Format Base Class (SDK Use Only). More...
class | imFileFormatBase
Image File Format Virtual Class (SDK Use Only). More...
class | imFormat
Image File Format Descriptor (SDK Use Only). More...

Functions

int | imFileLineBufferCount (imFile *ifile)
void | imFileLineBufferInc (imFile *ifile, int *row, int *plane)
void | imFileLineBufferRead (imFile *ifile, void *data, int line, int plane)
void | imFileLineBufferWrite (imFile *ifile, const void *data, int line, int plane)
int | imFileLineSizeAligned (int width, int bpp, int align)
void | imFileSetBaseAttributes (imFile *ifile)
void | imFormatRegister (imFormat *iformat)

Detailed Description

All the file formats are based on theses structures. Use them to create new file formats.
The LineBuffer functions will help transfer image from format buffer to application buffer and vice-versa.
See im_file.h

Function Documentation

int imFileLineBufferCount ( imFile * ifile )

Number of lines to be accessed.

void imFileLineBufferInc | ( | imFile * | ifile,
 |  | int * | row,
 |  | int * | plane
 | ) |  |

Increments the row and plane counters.

void imFileLineBufferRead | ( | imFile * | ifile,
 |  | void * | data,
 |  | int | line,
 |  | int | plane
 | ) |  |

Converts from FILE color mode to USER color mode.

void imFileLineBufferWrite | ( | imFile * | ifile,
 |  | const void * | data,
 |  | int | line,
 |  | int | plane
 | ) |  |

Converts from USER color mode to FILE color mode.

int imFileLineSizeAligned | ( | int | width,
 |  | int | bpp,
 |  | int | align
 | ) |  |

Utility to calculate the line size in byte with a specified alignment.
"align" can be 1, 2 or 4.

void imFileSetBaseAttributes ( imFile * ifile )

Set the attributes FileFormat, FileCompression and FileImageCount.
Used in imFileOpen and imFileOpenAs, and after the attribute list cleared with RemoveAll.

void imFormatRegister ( imFormat * iformat )

Register a format driver.


Capture

Image Capture

The capture support is designed for live video, it is not for passive digital cameras that only transfer the already taken pictures. Are valid: USB cameras (like most Webcams), Firewire (IEEE 1394) cameras, and analog video capture boards, including TV Tuners. These are called devices.

The capture functions allows you to:

  • list the available devices
  • connect to a device
  • configure the device
  • retrieve an image

You can list the installed devices and once you connect to a specific device you can control its parameters. Each connected device captures data frames continuously when in Live state otherwise it stays in standby. You can connect to more than one device at the same time.

Once connected the user can retrieve frames from the device any time. This can be done with one function call, or inside a closed loop for several frames, or inside an idle function to periodically update the screen. The user is not notified when a new frame is available, but every time the user retrieve a frame, if successful, it is a new frame, old frames are discarded when a new frame arrives.

Currently it is implemented only in Microsoft Windows.


Capture Guide

Using

You can list the installed capture devices using:

int imVideoCaptureDeviceCount(void)
const char* imVideoCaptureDeviceDesc(int device)

If a device was removed or added in run time, you must update the list calling:

int imVideoCaptureReloadDevices(void)

To handle devices you must create a imVideoCapture structure using the function imVideoCaptureCreate. With this handle you can manage any of the available devices, but only one device. The handle must be destroyed with imVideoCaptureDestroy.

If you want to access two or more devices at the same time you must create two different structures, but be aware that this usually work for high quality devices like Firewire and USB 2.0. Webcams that use USB1.x can be used if connected to different USB 2.0 controllers.

The next thing is to connect to a specific device, because all the other remaining functions depends on this connection. Just call imVideoCaptureConnect with one of the available capture device numbers.

You control when a device start processing frames using imVideoCaptureLive. Once live the frames can be captured using imVideoCaptureFrame. Or you can use imVideoCaptureOneFrame, it will start capturing, returns the captured frame and stop capturing.

But before capturing a frame you may want to configure the device. You can do it using Attributes, or at least in Windows you can do it using the configuration dialogs with a call to imVideoCaptureShowDialog.

A very simple sequence of operations to capture just one frame from the first device available:

imVideoCapture* vc = imVideoCaptureCreate();
if (!imVideoCaptureConnect(vc, 0))
  return;

int width, height;
imVideoCaptureGetImageSize(vc, &width, &height);

// initializes the data pointer
void* data = malloc(width*height*3);

imVideoCaptureOneFrame(vc, data, IM_RGB);
imVideoCaptureDestroy(vc);

The capture library is completely independent from the other libraries. It just uses the same description of the data buffer used in imFileReadImageData.

Building

You should include the <im_capture.h> header and link with the "im_capture.lib" library. This library is independent of all IM libraries. In Lua call require"imlua_capture".

To link with the capture library in Windows using Visual C you will need the file "strmiids.lib". To link it using Dev-C++ or Mingw 3 you will need the "im_capture.dll".

To compile the capture source code you will need the Direct X 9 SDK. Notice that since Direct X uses COM, CoInitialize(NULL) is called when the devices are enumerated.

For more information on Direct X capture, i.e. Direct Show see:

http://msdn.microsoft.com/library/en-us/directx9_c/directX/htm/directshow.asp


Capture Samples

Capture and GLUT

This application uses GLUT and OpenGL to create a window with a canvas and draw the image into that canvas. But the image is obtained from a capture device. The image can be processed before display and a sequence of captured images can be saved in an AVI file during capture.

You can view the source code here: glut_capture.c

Capture and IUP

This application uses IUP and OpenGL to create a window with two canvases and draw a video capture image into one canvas. A processed image can be displayed in the second canvas. It can also process frames from a video file.

You can download the source code and some compiler projects here: iupglcap.zip


IM: Image Capture

Image Capture

Collaboration diagram for Image Capture:

Modules

Windows Attributes Names

Functions

int IM_DECL | imVideoCaptureDeviceCount (void)
const char *IM_DECL | imVideoCaptureDeviceDesc (int device)
const char *IM_DECL | imVideoCaptureDeviceExDesc (int device)
const char *IM_DECL | imVideoCaptureDevicePath (int device)
const char *IM_DECL | imVideoCaptureDeviceVendorInfo (int device)
int IM_DECL | imVideoCaptureReloadDevices (void)
void IM_DECL | imVideoCaptureReleaseDevices (void)
imVideoCapture *IM_DECL | imVideoCaptureCreate (void)
void IM_DECL | imVideoCaptureDestroy (imVideoCapture *vc)
int IM_DECL | imVideoCaptureConnect (imVideoCapture *vc, int device)
void IM_DECL | imVideoCaptureDisconnect (imVideoCapture *vc)
int IM_DECL | imVideoCaptureDialogCount (imVideoCapture *vc)
int IM_DECL | imVideoCaptureShowDialog (imVideoCapture *vc, int dialog, void *parent)
int IM_DECL | imVideoCaptureSetInOut (imVideoCapture *vc, int input, int output, int cross)
const char *IM_DECL | imVideoCaptureDialogDesc (imVideoCapture *vc, int dialog)
int IM_DECL | imVideoCaptureFormatCount (imVideoCapture *vc)
int IM_DECL | imVideoCaptureGetFormat (imVideoCapture *vc, int format, int *width, int *height, char *desc)
int IM_DECL | imVideoCaptureSetFormat (imVideoCapture *vc, int format)
void IM_DECL | imVideoCaptureGetImageSize (imVideoCapture *vc, int *width, int *height)
int IM_DECL | imVideoCaptureSetImageSize (imVideoCapture *vc, int width, int height)
int IM_DECL | imVideoCaptureFrame (imVideoCapture *vc, unsigned char *data, int color_mode, int timeout)
int IM_DECL | imVideoCaptureOneFrame (imVideoCapture *vc, unsigned char *data, int color_mode)
int IM_DECL | imVideoCaptureLive (imVideoCapture *vc, int live)
int IM_DECL | imVideoCaptureResetAttribute (imVideoCapture *vc, const char *attrib, int fauto)
int IM_DECL | imVideoCaptureGetAttribute (imVideoCapture *vc, const char *attrib, float *percent)
int IM_DECL | imVideoCaptureSetAttribute (imVideoCapture *vc, const char *attrib, float percent)
const char **IM_DECL | imVideoCaptureGetAttributeList (imVideoCapture *vc, int *num_attrib)

Detailed Description

Functions to capture images from live video devices.
See im_capture.h

Function Documentation

int IM_DECL imVideoCaptureDeviceCount ( void )

Returns the number of available devices.

im.VideoCaptureDeviceCount() -> count: number [in Lua 5]
const char* IM_DECL imVideoCaptureDeviceDesc ( int device )

Returns the device description. Returns NULL only if it is an invalid device.

im.VideoCaptureDeviceDesc(device: number) -> desc: string [in Lua 5]
const char* IM_DECL imVideoCaptureDeviceExDesc ( int device )

Returns the extendend device description. May return NULL.

im.VideoCaptureDeviceExDesc(device: number) -> desc: string [in Lua 5]
const char* IM_DECL imVideoCaptureDevicePath ( int device )

Returns the device path configuration. This is a unique string.

im.VideoCaptureDevicePath(device: number) -> desc: string [in Lua 5]
const char* IM_DECL imVideoCaptureDeviceVendorInfo ( int device )

Returns the vendor information. May return NULL.

im.VideoCaptureDeviceVendorInfo(device: number) -> desc: string [in Lua 5]
int IM_DECL imVideoCaptureReloadDevices ( void )

Reload the device list. The devices can be dynamically removed or added to the system. Returns the number of available devices.

im.imVideoCaptureReloadDevices() -> count: number [in Lua 5]
void IM_DECL imVideoCaptureReleaseDevices ( void )

Release the device list. Usefull is you need to track leak erros in your application.

im.imVideoCaptureReleaseDevices() [in Lua 5]
imVideoCapture* IM_DECL imVideoCaptureCreate ( void )

Creates a new imVideoCapture object.
Returns NULL if there is no capture device available.
In Windows returns NULL if DirectX version is older than 8.
In Lua the IM videocapture metatable name is "imVideoCapture". When converted to a string will return "imVideoCapture(%p)" where p is replaced by the userdata address. If the videocapture is already destroyed by im.VideoCaptureDestroy, then it will return also the suffix "-destroyed".

im.VideoCaptureCreate() -> vc: imVideoCapture [in Lua 5]
void IM_DECL imVideoCaptureDestroy ( imVideoCapture * vc )

Destroys a imVideoCapture object.
In Lua if this function is not called, the videocapture is destroyed by the garbage collector.

im.VideoCaptureDestroy(vc: imVideoCapture) [in Lua 5]
vc:Destroy() [in Lua 5]
int IM_DECL imVideoCaptureConnect | ( | imVideoCapture * | vc,
 |  | int | device
 | ) |  |

Connects to a capture device. More than one imVideoCapture object can be created but they must be connected to different devices.
If the object is conected it will disconnect first.
Use -1 to return the current connected device, in this case returns -1 if not connected.
Returns zero if failed.

vc:Connect([device: number]) -> ret: number [in Lua 5]
void IM_DECL imVideoCaptureDisconnect ( imVideoCapture * vc )

Disconnect from a capture device.

vc:Disconnect() [in Lua 5]
int IM_DECL imVideoCaptureDialogCount ( imVideoCapture * vc )

Returns the number of available configuration dialogs.

vc:DialogCount() -> count: number [in Lua 5]
int IM_DECL imVideoCaptureShowDialog | ( | imVideoCapture * | vc,
 |  | int | dialog,
 |  | void * | parent
 | ) |  |

Displays a configuration modal dialog of the connected device.
In Windows, the capturing will be stopped in some cases.
In Windows parent is a HWND of a parent window, it can be NULL.
dialog can be from 0 to imVideoCaptureDialogCount.
Returns zero if failed.

vc:ShowDialog(dialog: number, parent: userdata) -> error: boolean [in Lua 5]
int IM_DECL imVideoCaptureSetInOut | ( | imVideoCapture * | vc,
 |  | int | input,
 |  | int | output,
 |  | int | cross
 | ) |  |

Allows to control the input and output of devices that have multiple input and outputs. The cross index controls in which stage the input/output will be set. Usually use 1, but some capture boards has a second stage. In Direct X it controls the crossbars.

vc:SetInOut(input, output, cross: number) -> error: boolean [in Lua 5]
const char* IM_DECL imVideoCaptureDialogDesc | ( | imVideoCapture * | vc,
 |  | int | dialog
 | ) |  |

Returns the description of a configuration dialog. dialog can be from 0 to imVideoCaptureDialogCount.

vc:DialogDesc(dialog: number) -> desc: string [in Lua 5]
int IM_DECL imVideoCaptureFormatCount ( imVideoCapture * vc )

Returns the number of available video formats.
Returns zero if failed.

vc:FormatCount() -> count: number [in Lua 5]
int IM_DECL imVideoCaptureGetFormat | ( | imVideoCapture * | vc,
 |  | int | format,
 |  | int * | width,
 |  | int * | height,
 |  | char * | desc
 | ) |  |

Returns information about the video format.
format can be from 0 to imVideoCaptureFormatCount.
desc should be of size 10.
The image size is usually the maximum size for that format. Other sizes can be available using imVideoCaptureSetImageSize.
Returns zero if failed.

vc:GetFormat(format: number) -> error: boolean, width: number, height: number, desc: string [in Lua 5]
int IM_DECL imVideoCaptureSetFormat | ( | imVideoCapture * | vc,
 |  | int | format
 | ) |  |

Changes the video format of the connected device.
Should NOT work for DV devices. Use imVideoCaptureSetImageSize only.
Use -1 to return the current format, in this case returns -1 if failed.
When the format is changed in the dialog, for some formats the returned format is the preferred format, not the current format.
This will not affect color_mode of the capture image.
Returns zero if failed.

vc:SetFormat([format: number]) -> error: boolean | format: number [in Lua 5]
void IM_DECL imVideoCaptureGetImageSize | ( | imVideoCapture * | vc,
 |  | int * | width,
 |  | int * | height
 | ) |  |

Returns the current image size of the connected device.
width and height returns 0 if not connected.

vc:GetImageSize() -> width: number, height: number [in Lua 5]
int IM_DECL imVideoCaptureSetImageSize | ( | imVideoCapture * | vc,
 |  | int | width,
 |  | int | height
 | ) |  |

Changes the image size of the connected device.
Similar to imVideoCaptureSetFormat, but changes only the size.
Valid sizes can be obtained with imVideoCaptureGetFormat.
Returns zero if failed.

vc:SetImageSize(width: number, height: number) -> error: boolean [in Lua 5]
int IM_DECL imVideoCaptureFrame | ( | imVideoCapture * | vc,
 |  | unsigned char * | data,
 |  | int | color_mode,
 |  | int | timeout
 | ) |  |

Returns a new captured frame. Use -1 for infinite timeout.
Color space can be IM_RGB or IM_GRAY, and mode can be packed (IM_PACKED) or not.
Data type is always IM_BYTE.
It can not have an alpha channel and orientation is always bottom up.
Returns zero if failed or timeout expired, the buffer is not changed.

vc:Frame(image: imImage, timeout: number) -> error: boolean [in Lua 5]
int IM_DECL imVideoCaptureOneFrame | ( | imVideoCapture * | vc,
 |  | unsigned char * | data,
 |  | int | color_mode
 | ) |  |

Start capturing, returns the new captured frame and stop capturing.
This is more usefull if you are switching between devices.
Data format is the same as imVideoCaptureFrame.
Returns zero if failed.

vc:OneFrame(image: imImage) -> error: boolean [in Lua 5]
int IM_DECL imVideoCaptureLive | ( | imVideoCapture * | vc,
 |  | int | live
 | ) |  |

Start capturing.
Use -1 to return the current state.
Returns zero if failed.

vc:Live([live: number]) -> error: boolean | live: number [in Lua 5]
int IM_DECL imVideoCaptureResetAttribute | ( | imVideoCapture * | vc,
 |  | const char * | attrib,
 |  | int | fauto
 | ) |  |

Resets a camera or video attribute to the default value or to the automatic setting.
Not all attributes support automatic modes.
Returns zero if failed.

vc:ResetAttribute(attrib: string, fauto: boolean) -> error: boolean [in Lua 5]
int IM_DECL imVideoCaptureGetAttribute | ( | imVideoCapture * | vc,
 |  | const char * | attrib,
 |  | float * | percent
 | ) |  |

Returns a camera or video attribute in percentage of the valid range value.
Returns zero if failed or attribute not supported.

vc:GetAttribute(attrib: string) -> error: boolean, percent: number [in Lua 5]
int IM_DECL imVideoCaptureSetAttribute | ( | imVideoCapture * | vc,
 |  | const char * | attrib,
 |  | float | percent
 | ) |  |

Changes a camera or video attribute in percentage of the valid range value.
Returns zero if failed or attribute not supported.

vc:SetAttribute(attrib: string, percent: number) -> error: boolean [in Lua 5]
const char** IM_DECL imVideoCaptureGetAttributeList | ( | imVideoCapture * | vc,
 |  | int * | num_attrib
 | ) |  |

Returns a list of the description of the valid attributes for the device class.
But each device may still not support some of the returned attributes.
Use the return value of imVideoCaptureGetAttribute to check if the attribute is supported.

vc:GetAttributeList() -> attrib_list: table of strings [in Lua 5]


IM: Windows Attributes Names

Windows Attributes Names
[Image Capture]

Collaboration diagram for Windows Attributes Names:

Not all attributes are supported by each device. Use the return value of imVideoCaptureGetAttribute to check if the attribute is supported.

  VideoBrightness - Specifies the brightness, also called the black level.
  VideoContrast - Specifies the contrast, expressed as gain factor.
  VideoHue - Specifies the hue angle.
  VideoSaturation - Specifies the saturation.
  VideoSharpness - Specifies the sharpness.
  VideoGamma - Specifies the gamma.
  VideoColorEnable - Specifies the color enable setting. (0/100)
  VideoWhiteBalance - Specifies the white balance, as a color temperature in degrees Kelvin.
  VideoBacklightCompensation - Specifies the backlight compensation setting. (0/100)
  VideoGain - Specifies the gain adjustment.
  CameraPanAngle - Specifies the camera's pan angle. To 100 rotate right, To 0 rotate left (view from above).
  CameraTiltAngle - Specifies the camera's tilt angle.  To 100 rotate up, To 0 rotate down.
  CameraRollAngle - Specifies the camera's roll angle. To 100 rotate right, To 0 rotate left.
  CameraLensZoom - Specifies the camera's zoom setting.
  CameraExposure - Specifies the exposure setting.
  CameraIris - Specifies the camera's iris setting.
  CameraFocus - Specifies the camera's focus setting, as the distance to the optimally focused target.
  FlipHorizontal - Specifies the video will be flipped in the horizontal direction.
  FlipVertical - Specifies the video will be flipped in the vertical direction.
  AnalogFormat - Specifies the video format standard NTSC, PAL, etc. Valid values:
      NTSC_M     = 0
      NTSC_M_J   = 1
      NTSC_433   = 2
      PAL_B      = 3
      PAL_D      = 4
      PAL_H      = 5
      PAL_I      = 6
      PAL_M      = 7
      PAL_N      = 8
      PAL_60     = 9
      SECAM_B    = 10
      SECAM_D    = 11
      SECAM_G    = 12
      SECAM_H    = 13
      SECAM_K    = 14
      SECAM_K1   = 15
      SECAM_L    = 16
      SECAM_L1   = 17
      PAL_N_COMBO = 18
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


Processing

Image Processing

We use the simpliest model possible, a function with input data, output data and control parameters.

The operations have usually one or more input images, and one or more output images. We avoid implementing in-place operations, but many operations can use the same data for input and output. The data type, color mode and size of the images depends on the operation. Sometimes the operations can change the data type to increase the precision of the results, but normally only a few operations will change the size (resize and geometric) and color mode (color conversion). All of these details are described in each function documentation, check before using them.

There is no ROI (Region Of Interest) management, but you can imProcessCrop, imProcess*, then imProcessInsert the result in the original image.

The image data of the output image is assumed to be zero before any operation. This is always true after creating a new image, but if you are reusing an image for several operation use imImageClear to zero the image data between operations.


Processing Guide

Image Processing Guide

Using

You should include one or more headers: <im_process_ana.h>, <im_process_glo.h>, <im_process_loc.h> and <im_process_pon.h>. And you must link with the "im_process.a/im_process.lib" library. In Lua call require"imlua_process".

The processing operations are very simple to use. Usually you just have to call the respective function. But you will have to ensure yourself that the image parameters for the input and output data are correct. Here is an example:

void imProcessFlip(const imImage* src_image, imImage* dst_image);

The processing operations are exclusive for the imImage structure. This makes the implementation cleaner and much easier to process color images since the planes are separated. But remmber that you can always use the imImageInit function to initializes an imImage structure with your own buffer.

The image data of the output image is assumed to be zero before any operation. This is always true after creating a new image, but if you are reusing an image for several operation use imImageClear to zero the image data between operations.

New Operations

An operation complexity is directly affected by the number of data types it will operate.

If it is only one, than it is as simple as:

void DoProc(imbyte* data, int width, int height)
{
  for (int y = 0; y < height; y++)
  {
    for (int x = 0; x < width; x++)
    {
      // Do something
      int offset = y * width + x;

      data[offset] = 0;
    }
  }
}

void SampleProc(imImage* image)
{
  // a loop for all the color planes
  for (int d = 0; d < image->depth; d++)
  {
    // Notice that the same operation may be used to process each color component
    DoProc((imbyte*)image->data[d], image->width, image->height);
  }
}

Or if you want to use templates to allow a more number of types:

template <class T>
void DoProc2(const T* src_data, T* dst_data, int count)
{
  for (int i = 0; i < count; i++)
  {
    src_data[i] = dst_data[i];

    // or a more low level approach

    *src_data++ = *dst_data++;
  }
}

// This is a sample that do not depends on the spatial distribution of the data.
// It uses data[0], the pointer where all depths depends on.

void SampleProc2(const imImage* src_image, imImage* dst_image)
{
  int total_count = src_image->count * src_image->depth;
  switch(src_image->data_type)
  {
  case IM_BYTE:
    DoProc((imbyte*)src_image->data[0], (imbyte*)dst_image->data[0], total_count);
    break;
  case IM_USHORT:
    DoProc((imushort*)src_image->data[0], (imushort*)dst_image->data[0], total_count);
    break;
  case IM_INT:
    DoProc((int*)src_image->data[0], (int*)dst_image->data[0], total_count);
    break;
  case IM_FLOAT:
    DoProc((float*)src_image->data[0], (float*)dst_image->data[0], total_count);
    break;
  case IM_CFLOAT:
    DoProc((imcfloat*)src_image->data[0], (imcfloat*)dst_image->data[0], total_count);
    break;
  }
}

The first sample can be implemented in C, but the second sample can not, it must be in C++. Check the manual and the source code for many operations already available.

Counters

To add support for the counter callback to a new operation is very simple. The following code shows how:

int counter = imCounterBegin("Process Test 1");
imCounterTotal(counter, count_steps, "Processing");

for (int i = 0; i < count_steps; i++)
{
  // Do something

  if (!imCounterInc(counter))
    return IM_ERR_COUNTER;
}

imCounterEnd(counter);

Every time you call imCounterTotal between a imCounterBegin/imCounterEnd for the same counter means that you are starting a count at that counter. So one operation can be composed by many sub-operations and still have a counter to display progress. For example, each call to the imFileReadImageData starts a new count for the same counter.

A nice thing to do when counting is not to display too small progress. To accomplish that in the implementation of the counter callback consider a minimum delay from one display to another.

See Utilities / Counter.


Processing Samples

Image Processing Samples

Fourier Transform

This is another command line application that process an image in the Fourier Frequency Domain. In this domain the image is a map of the spatial frequencies of the original image. It depends on the IM main library and on the IM_FFTW library. The FFTW is a very fast Fourier transform, but is contaminated by the GPL license, so everything must be also GPL. To use it in a commercial application you must contact the MIT and pay for a commercial license.

Se also Reference / Image Processing / Domain Transform Operations.

You can view the source code here: proc_fourier.cpp

Hough Lines

The Hough transform can be used to detect lines in an image. But it results are highly dependent on other operations done before and after the transform. Here you can see a small pseudo code that ilustrates a possible sequence of operations to detect lines using the hough transform.

First the canny operator will isolate the borders, the threshold will mark the candidate pixels. After the transform the local maximum are isolated to detect the line parameters of the lines that have many pixels from the cadidate ones. The last operation will just draw the detected lines over the original gray scale image.

imProcessCanny(in,out,stddev)
imProcessHysteresisThreshold(in,out,low,high)

imProcessHoughLines(in,out)
imProcessLocalMaxThreshold(in,out,size,min)

imProcessHoughLinesDraw(in1,in2,out)

Or a more complete sequence using another approach:

gray = imImageCreate(width, height, IM_GRAY, IM_BYTE);
binary = imImageCreate(width, height, IM_BINARY, IM_BYTE);
binary2 = imImageClone(binary);

rhomax = sqrt(width*width +height*height)/2;
hough_height=2*rhomax+1;
hough = imImageCreate(180, hough_height, IM_GRAY, IM_INT);
hough_binary = imImageCreate(180, hough_height, IM_BINARY, IM_BYTE);

imConvertColorSpace(rgb, gray);

// very important step, the quality of the detected lines are highly dependent on
// the quality of the binary image
// Using a simple threshold like in here maybe not a good solution for your image
imProcessPercentThreshold(gray, binary, percent=50);

// eliminates unwanted objects, depending on the quality of the threshold
// this step can be skiped
imProcessBinMorphClose(binary, binary2, 3, 1);
imProcessPrune(binary2, binary, 4, size=100, 0);

// Is there any holes in the objects?
// Holes also have borders...
imProcessFillHoles(binary, binary2, 4);

// leave only the object borders
imProcessPerimeterLine(binary2, binary);

// here you should have near only the lines you want to detect.
// if there are more or less lines that you want redo the previous steps

imProcessHoughLines(binary, hough);
imProcessLocalMaxThreshold(hough, hough_binary, 7, 100);

// this is optional, it will draw the results
imProcessHoughLinesDraw(gray,hough_binary,draw_hough);

In the result of imProcessLocalMaxThreshold there will be several white pixels. They represent the detected lines. Defining:

Y = a * X + b
cos(theta) * X + sin(theta) * Y = rho

where:
  X = x - width/2
  Y = y - height/2

because the origin of the transform is in the center of the image

Each coordinate in the transform has values in the intervals:

theta = 0 .. 179  (horizontal coordinate of the hough space)
rho = -rhomax .. rhomax    (vertical coordinate of the hough space,
                            vertically centered in the image)

where:
    rhomax = sqrt(width*width + height*height) /2            (width and height of the original image)

For each (xi, yi) point found in the result image:

theta = xi;
rho = yi - rhomax;

then:

a = -cos(theta)/sin(theta);
b = (rho + (width/2)*cos(theta) + (height/2)*sin(theta))/sin(theta);

The complex formula for "b" came from the fact that we have to shift the result to the image origin at (0,0).

Image Analysis

The following pseudo code ilustrates the sequence of operations to measure regions. This is also called Blob Analysis.

First the regions are isolated from background using a threshold. Then regions too small or too large are eliminated and the holes are filled in this example. After the regions are found we can start measuring properties of the regions like area and perimeter.

imProcessSliceThreshold(in, out, level1, level2)
imProcessPrune(in, out, connect, size1, size2)
imProcessFillHoles(in, out, connect)
imAnalyzeFindRegions(in, out, connect)
imAnalyzeMeasureArea(in, area)
imAnalyzeMeasurePerimeter(in, perim)


IM: Image Processing

Modules

Image Processing

Collaboration diagram for Image Processing:

Modules

Image Statistics Calculations
Image Analysis
Other Domain Transform Operations
Fourier Transform Operations
Image Resize
Geometric Operations
Morphology Operations for Gray Images
Morphology Operations for Binary Images
Rank Convolution Operations
Convolution Operations
Arithmetic Operations
Additional Image Quantization Operations
Histogram Based Operations
Color Processing Operations
Logical Arithmetic Operations
Synthetic Image Render
Tone Gamut Operations
Threshold Operations
Special Effects

Detailed Description

Several image processing functions based on the imImage structure.
You must link the application with "im_process.lib/.a/.so". In Lua call require"imlua_process".
Some complex operations use the Counter.
There is no check on the input/output image properties, check each function documentation before using it.


IM: Synthetic Image Render

Synthetic Image Render
[Image Processing]

Collaboration diagram for Synthetic Image Render:

Typedefs

typedef float(* | imRenderFunc )(int x, int y, int d, float *param)
typedef float(* | imRenderCondFunc )(int x, int y, int d, int *cond, float *param)

Functions

int | imProcessRenderOp (imImage *image, imRenderFunc render_func, char *render_name, float *param, int plus)
int | imProcessRenderCondOp (imImage *image, imRenderCondFunc render_cond_func, char *render_name, float *param)
int | imProcessRenderAddSpeckleNoise (const imImage *src_image, imImage *dst_image, float percent)
int | imProcessRenderAddGaussianNoise (const imImage *src_image, imImage *dst_image, float mean, float stddev)
int | imProcessRenderAddUniformNoise (const imImage *src_image, imImage *dst_image, float mean, float stddev)
int | imProcessRenderRandomNoise (imImage *image)
int | imProcessRenderConstant (imImage *image, float *value)
int | imProcessRenderWheel (imImage *image, int internal_radius, int external_radius)
int | imProcessRenderCone (imImage *image, int radius)
int | imProcessRenderTent (imImage *image, int tent_width, int tent_height)
int | imProcessRenderRamp (imImage *image, int start, int end, int vert_dir)
int | imProcessRenderBox (imImage *image, int box_width, int box_height)
int | imProcessRenderSinc (imImage *image, float x_period, float y_period)
int | imProcessRenderGaussian (imImage *image, float stddev)
int | imProcessRenderLapOfGaussian (imImage *image, float stddev)
int | imProcessRenderCosine (imImage *image, float x_period, float y_period)
int | imProcessRenderGrid (imImage *image, int x_space, int y_space)
int | imProcessRenderChessboard (imImage *image, int x_space, int y_space)

Detailed Description

Renders some 2D mathematical functions as images. All the functions operates in place and supports all data types except IM_CFLOAT.
See im_process_pon.h

Typedef Documentation

typedef float(* imRenderFunc)(int x, int y, int d, float *param)

Render Funtion.

render_func(x: number, y: number, d: number, param: table of number) -> value: number [in Lua 5]
typedef float(* imRenderCondFunc)(int x, int y, int d, int *cond, float *param)

Render Conditional Funtion.

render_cond_func(x: number, y: number, d: number, param: table of number) -> value: number, cond: boolean [in Lua 5]

Function Documentation

int imProcessRenderOp | ( | imImage * | image,
 |  | imRenderFunc | render_func,
 |  | char * | render_name,
 |  | float * | param,
 |  | int | plus
 | ) |  |

Render a synthetic image using a render function.
plus will make the render be added to the current image data, or else all data will be replaced. All the render functions use this or the conditional function.
Returns zero if the counter aborted.

im.ProcessRenderOp(image: imImage, render_func: function, render_name: string, param: table of number, plus: boolean) -> counter: boolean [in Lua 5]
int imProcessRenderCondOp | ( | imImage * | image,
 |  | imRenderCondFunc | render_cond_func,
 |  | char * | render_name,
 |  | float * | param
 | ) |  |

Render a synthetic image using a conditional render function.
Data will be rendered only if the condional param is true.
Returns zero if the counter aborted.

im.ProcessRenderCondOp(image: imImage, render_cond_func: function, render_name: string, param: table of number) -> counter: boolean [in Lua 5]
int imProcessRenderAddSpeckleNoise | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | percent
 | ) |  |

Render speckle noise on existing data. Can be done in place.

im.ProcessRenderAddSpeckleNoise(src_image: imImage, dst_image: imImage, percent: number) -> counter: boolean [in Lua 5]
im.ProcessRenderAddSpeckleNoiseNew(src_image: imImage, percent: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessRenderAddGaussianNoise | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | mean,
 |  | float | stddev
 | ) |  |

Render gaussian noise on existing data. Can be done in place.

im.ProcessRenderAddGaussianNoise(src_image: imImage, dst_image: imImage, mean: number, stddev: number) -> counter: boolean [in Lua 5]
im.ProcessRenderAddGaussianNoiseNew(src_image: imImage, mean: number, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessRenderAddUniformNoise | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | mean,
 |  | float | stddev
 | ) |  |

Render uniform noise on existing data. Can be done in place.

im.ProcessRenderAddUniformNoise(src_image: imImage, dst_image: imImage, mean: number, stddev: number) -> counter: boolean [in Lua 5]
im.ProcessRenderAddUniformNoiseNew(src_image: imImage, mean: number, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessRenderRandomNoise ( imImage * image )

Render random noise.

im.ProcessRenderRandomNoise(image: imImage) -> counter: boolean [in Lua 5]
int imProcessRenderConstant | ( | imImage * | image,
 |  | float * | value
 | ) |  |

Render a constant. The number of values must match the depth of the image.

im.ProcessRenderConstant(image: imImage, value: table of number) -> counter: boolean [in Lua 5]
int imProcessRenderWheel | ( | imImage * | image,
 |  | int | internal_radius,
 |  | int | external_radius
 | ) |  |

Render a centered wheel.

im.ProcessRenderWheel(image: imImage, internal_radius: number, external_radius: number) -> counter: boolean [in Lua 5]
int imProcessRenderCone | ( | imImage * | image,
 |  | int | radius
 | ) |  |

Render a centered cone.

im.ProcessRenderCone(image: imImage, radius: number) -> counter: boolean [in Lua 5]
int imProcessRenderTent | ( | imImage * | image,
 |  | int | tent_width,
 |  | int | tent_height
 | ) |  |

Render a centered tent.

im.ProcessRenderTent(image: imImage, tent_width: number, tent_height: number) -> counter: boolean [in Lua 5]
int imProcessRenderRamp | ( | imImage * | image,
 |  | int | start,
 |  | int | end,
 |  | int | vert_dir
 | ) |  |

Render a ramp. Direction can be vertical (1) or horizontal (0).

im.ProcessRenderRamp(image: imImage, start: number, end: number, vert_dir: boolean) -> counter: boolean [in Lua 5]
int imProcessRenderBox | ( | imImage * | image,
 |  | int | box_width,
 |  | int | box_height
 | ) |  |

Render a centered box.

im.ProcessRenderBox(image: imImage, box_width: number, box_height: number) -> counter: boolean [in Lua 5]
int imProcessRenderSinc | ( | imImage * | image,
 |  | float | x_period,
 |  | float | y_period
 | ) |  |

Render a centered sinc.

im.ProcessRenderSinc(image: imImage, x_period: number, y_period: number) -> counter: boolean [in Lua 5]
int imProcessRenderGaussian | ( | imImage * | image,
 |  | float | stddev
 | ) |  |

Render a centered gaussian.

im.ProcessRenderGaussian(image: imImage, stddev: number) -> counter: boolean [in Lua 5]
int imProcessRenderLapOfGaussian | ( | imImage * | image,
 |  | float | stddev
 | ) |  |

Render the laplacian of a centered gaussian.

im.ProcessRenderLapOfGaussian(image: imImage, stddev: number) -> counter: boolean [in Lua 5]
int imProcessRenderCosine | ( | imImage * | image,
 |  | float | x_period,
 |  | float | y_period
 | ) |  |

Render a centered cosine.

im.ProcessRenderCosine(image: imImage, x_period: number, y_period: number) -> counter: boolean [in Lua 5]
int imProcessRenderGrid | ( | imImage * | image,
 |  | int | x_space,
 |  | int | y_space
 | ) |  |

Render a centered grid.

im.ProcessRenderGrid(image: imImage, x_space: number, y_space: number) -> counter: boolean [in Lua 5]
int imProcessRenderChessboard | ( | imImage * | image,
 |  | int | x_space,
 |  | int | y_space
 | ) |  |

Render a centered chessboard.

im.ProcessRenderChessboard(image: imImage, x_space: number, y_space: number) -> counter: boolean [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Image Resize

Functions

Image Resize
[Image Processing]

Collaboration diagram for Image Resize:

Functions

int | imProcessReduce (const imImage *src_image, imImage *dst_image, int order)
int | imProcessResize (const imImage *src_image, imImage *dst_image, int order)
void | imProcessReduceBy4 (const imImage *src_image, imImage *dst_image)
void | imProcessCrop (const imImage *src_image, imImage *dst_image, int xmin, int ymin)
void | imProcessInsert (const imImage *src_image, const imImage *region_image, imImage *dst_image, int xmin, int ymin)
void | imProcessAddMargins (const imImage *src_image, imImage *dst_image, int xmin, int ymin)

Detailed Description

Operations to change the image size.
All size operations include the alpha channel if any.
See im_process_loc.h

Function Documentation

int imProcessReduce | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | order
 | ) |  |

Only reduze the image size using the given decimation order.
Supported decimation orders:

  • 0 - zero order (mean)
  • 1 - first order (bilinear decimation) Images must be of the same type. If image type is IM_MAP or IM_BINARY, must use order=0.
    Returns zero if the counter aborted.
im.ProcessReduce(src_image: imImage, dst_image: imImage, order: number) -> counter: boolean [in Lua 5]
im.ProcessReduceNew(image: imImage, order: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessResize | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | order
 | ) |  |

Change the image size using the given interpolation order.
Supported interpolation orders:

  • 0 - zero order (near neighborhood)
  • 1 - first order (bilinear interpolation)
  • 3 - third order (bicubic interpolation) Images must be of the same type. If image type is IM_MAP or IM_BINARY, must use order=0.
    Returns zero if the counter aborted.
im.ProcessResize(src_image: imImage, dst_image: imImage, order: number) -> counter: boolean [in Lua 5]
im.ProcessResizeNew(image: imImage, order: number) -> counter: boolean, new_image: imImage [in Lua 5]
void imProcessReduceBy4 | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Reduze the image area by 4 (w/2,h/2).
Images must be of the same type. Destiny image size must be source image width/2, height/2. Can not operate on IM_MAP nor IM_BINARY images.

im.ProcessReduceBy4(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessReduceBy4New(image: imImage) -> new_image: imImage [in Lua 5]
void imProcessCrop | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | xmin,
 |  | int | ymin
 | ) |  |

Extract a rectangular region from an image.
Images must be of the same type. Destiny image size must be smaller than source image width-xmin, height-ymin.
ymin and xmin must be >0 and <size.

im.ProcessCrop(src_image: imImage, dst_image: imImage, xmin: number, ymin: number) [in Lua 5]
im.ProcessCropNew(image: imImage, xmin: number, xmax: number, ymin: number, ymax: number) -> new_image: imImage [in Lua 5]
void imProcessInsert | ( | const imImage * | src_image,
 |  | const imImage * | region_image,
 |  | imImage * | dst_image,
 |  | int | xmin,
 |  | int | ymin
 | ) |  |

Insert a rectangular region in an image.
Images must be of the same type. Region image size can be larger than source image.
ymin and xmin must be >0 and <size.
Source and destiny must be of the same size. Can be done in place.

im.ProcessInsert(src_image: imImage, region_image: imImage, dst_image: imImage, xmin: number, ymin: number) [in Lua 5]
im.ProcessInsertNew(image: imImage, region_image: imImage, xmin: number, ymin: number) -> new_image: imImage [in Lua 5]
void imProcessAddMargins | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | xmin,
 |  | int | ymin
 | ) |  |

Increase the image size by adding pixels with zero value.
Images must be of the same type. Destiny image size must be greatter than source image width+xmin, height+ymin.

im.ProcessAddMargins(src_image: imImage, dst_image: imImage, xmin: number, ymin: number) [in Lua 5]
im.ProcessAddMarginsNew(image: imImage, xmin: number, xmax: number, ymin: number, ymax: number) -> new_image: imImage [in Lua 5]


IM: Geometric Operations

Functions

Geometric Operations
[Image Processing]

Collaboration diagram for Geometric Operations:

Functions

void | imProcessCalcRotateSize (int width, int height, int *new_width, int *new_height, double cos0, double sin0)
int | imProcessRotate (const imImage *src_image, imImage *dst_image, double cos0, double sin0, int order)
int | imProcessRotateRef (const imImage *src_image, imImage *dst_image, double cos0, double sin0, int x, int y, int to_origin, int order)
void | imProcessRotate90 (const imImage *src_image, imImage *dst_image, int dir_clockwise)
void | imProcessRotate180 (const imImage *src_image, imImage *dst_image)
void | imProcessMirror (const imImage *src_image, imImage *dst_image)
void | imProcessFlip (const imImage *src_image, imImage *dst_image)
int | imProcessRadial (const imImage *src_image, imImage *dst_image, float k1, int order)
int | imProcessSwirl (const imImage *src_image, imImage *dst_image, float k1, int order)
void | imProcessInterlaceSplit (const imImage *src_image, imImage *dst_image1, imImage *dst_image2)

Detailed Description

Operations to change the shape of the image.
All geometric operations include the alpha channel if any.
See im_process_loc.h

Function Documentation

void imProcessCalcRotateSize | ( | int | width,
 |  | int | height,
 |  | int * | new_width,
 |  | int * | new_height,
 |  | double | cos0,
 |  | double | sin0
 | ) |  |

Calculates the size of the new image after rotation.

im.ProcessCalcRotateSize(width: number, height: number, cos0: number, sin0: number) [in Lua 5]
int imProcessRotate | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | double | cos0,
 |  | double | sin0,
 |  | int | order
 | ) |  |

Rotates the image using the given interpolation order (see imProcessResize).
Images must be of the same type. The destiny size can be calculated using imProcessCalcRotateSize to fit the new image size, or can be any size, including the original size. The rotation is relative to the center of the image.
Returns zero if the counter aborted.

im.ProcessRotate(src_image: imImage, dst_image: imImage, cos0: number, sin0: number, order: number) -> counter: boolean [in Lua 5]
im.ProcessRotateNew(image: imImage, cos0: number, sin0: number, order: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessRotateRef | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | double | cos0,
 |  | double | sin0,
 |  | int | x,
 |  | int | y,
 |  | int | to_origin,
 |  | int | order
 | ) |  |

Rotates the image using the given interpolation order (see imProcessResize).
Images must be of the same type. Destiny can have any size, including the original size.
The rotation is relative to the reference point. But the result can be shifted to the origin.
Returns zero if the counter aborted.

im.ProcessRotateRef(src_image: imImage, dst_image: imImage, cos0: number, sin0: number, x: number, y: number, to_origin: boolean, order: number) -> counter: boolean [in Lua 5]
im.ProcessRotateRefNew(image: imImage, cos0: number, sin0: number, x: number, y: number, to_origin: boolean, order: number) -> counter: boolean, new_image: imImage [in Lua 5]
void imProcessRotate90 | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | dir_clockwise
 | ) |  |

Rotates the image in 90 degrees counterclockwise or clockwise. Swap columns by lines.
Images must be of the same type. Destiny width and height must be source height and width.
Direction can be clockwise (1) or counter clockwise (-1).

im.ProcessRotate90(src_image: imImage, dst_image: imImage, dir_clockwise: boolean) [in Lua 5]
im.ProcessRotate90New(image: imImage, dir_clockwise: boolean) -> new_image: imImage [in Lua 5]
void imProcessRotate180 | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Rotates the image in 180 degrees. Swap columns and swap lines.
Images must be of the same type and size.

im.ProcessRotate180(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessRotate180New(image: imImage) -> new_image: imImage [in Lua 5]
void imProcessMirror | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Mirror the image in a horizontal flip. Swap columns.
Images must be of the same type and size. Can be done in-place.

im.ProcessMirror(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessMirrorNew(image: imImage) -> new_image: imImage [in Lua 5]
void imProcessFlip | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Apply a vertical flip. Swap lines.
Images must be of the same type and size. Can be done in-place.

im.ProcessFlip(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessFlipNew(image: imImage) -> new_image: imImage [in Lua 5]
int imProcessRadial | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | k1,
 |  | int | order
 | ) |  |

Apply a radial distortion using the given interpolation order (see imProcessResize).
Images must be of the same type and size. Returns zero if the counter aborted.

im.ProcessRadial(src_image: imImage, dst_image: imImage, k1: number, order: number) -> counter: boolean [in Lua 5]
im.ProcessRadialNew(image: imImage, k1: number, order: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessSwirl | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | k1,
 |  | int | order
 | ) |  |

Apply a swirl distortion using the given interpolation order (see imProcessResize).
Images must be of the same type and size. Returns zero if the counter aborted.

im.ProcessSwirl(src_image: imImage, dst_image: imImage, k: number, order: number) -> counter: boolean [in Lua 5]
im.ProcessSwirlNew(image: imImage, k: number, order: number) -> counter: boolean, new_image: imImage [in Lua 5]
void imProcessInterlaceSplit | ( | const imImage * | src_image,
 |  | imImage * | dst_image1,
 |  | imImage * | dst_image2
 | ) |  |

Split the image in two images, one containing the odd lines and other containing the even lines.
Images must be of the same type. Height of the output images must be half the height of the input image. If the height of the input image is odd then the first image must have height equals to half+1.

im.ProcessInterlaceSplit(src_image: imImage, dst_image1: imImage, dst_image2: imImage) [in Lua 5]
im.ProcessInterlaceSplitNew(image: imImage) -> new_image1: imImage, new_image2: imImage [in Lua 5]


IM: Additional Image Quantization Operations

Functions

Additional Image Quantization Operations
[Image Processing]

Collaboration diagram for Additional Image Quantization Operations:

Functions

void | imProcessQuantizeRGBUniform (const imImage *src_image, imImage *dst_image, int do_dither)
void | imProcessQuantizeGrayUniform (const imImage *src_image, imImage *dst_image, int grays)

Detailed Description

Additionally operations to the imConvertColorSpace function.
See im_process_pon.h

Function Documentation

void imProcessQuantizeRGBUniform | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | do_dither
 | ) |  |

Converts a RGB image to a MAP image using uniform quantization with an optional 8x8 ordered dither. The RGB image must have data type IM_BYTE.

im.ProcessQuantizeRGBUniform(src_image: imImage, dst_image: imImage, do_dither: boolean) [in Lua 5]
im.ProcessQuantizeRGBUniformNew(src_image: imImage, do_dither: boolean) -> new_image: imImage [in Lua 5]
void imProcessQuantizeGrayUniform | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | grays
 | ) |  |

Quantizes a gray scale image in less that 256 grays using uniform quantization.
Both images must be IM_BYTE/IM_GRAY. Can be done in place.

im.ProcessQuantizeGrayUniform(src_image: imImage, dst_image: imImage, grays: number) [in Lua 5]
im.ProcessQuantizeGrayUniformNew(src_image: imImage, grays: number) -> new_image: imImage [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Color Processing Operations

Functions

Color Processing Operations
[Image Processing]

Collaboration diagram for Color Processing Operations:

Functions

void | imProcessSplitYChroma (const imImage *src_image, imImage *y_image, imImage *chroma_image)
void | imProcessSplitHSI (const imImage *src_image, imImage *h_image, imImage *s_image, imImage *i_image)
void | imProcessMergeHSI (const imImage *h_image, const imImage *s_image, const imImage *i_image, imImage *dst_image)
void | imProcessSplitComponents (const imImage *src_image, imImage **dst_image_list)
void | imProcessMergeComponents (const imImage **src_image_list, imImage *dst_image)
void | imProcessNormalizeComponents (const imImage *src_image, imImage *dst_image)
void | imProcessReplaceColor (const imImage *src_image, imImage *dst_image, float *src_color, float *dst_color)

Detailed Description

Operations to change the color components configuration.
See im_process_pon.h

Function Documentation

void imProcessSplitYChroma | ( | const imImage * | src_image,
 |  | imImage * | y_image,
 |  | imImage * | chroma_image
 | ) |  |

Split a RGB image into luma and chroma.
Chroma is calculated as R-Y,G-Y,B-Y. Source image must be IM_RGB/IM_BYTE.
luma image is IM_GRAY/IM_BYTE and chroma is IM_RGB/IM_BYTE.
Source and destiny must have the same size.

im.ProcessSplitYChroma(src_image: imImage, y_image: imImage, chroma_image: imImage) [in Lua 5]
im.ProcessSplitYChromaNew(src_image: imImage) -> y_image: imImage, chroma_image: imImage [in Lua 5]
void imProcessSplitHSI | ( | const imImage * | src_image,
 |  | imImage * | h_image,
 |  | imImage * | s_image,
 |  | imImage * | i_image
 | ) |  |

Split a RGB image into HSI planes.
Source image must be IM_RGB/IM_BYTE,IM_FLOAT. Destiny images are all IM_GRAY/IM_FLOAT.
Source images must normalized to 0-1 if type is IM_FLOAT (imProcessToneGamut can be used). See HSI Color Coordinate System Conversions for a definition of the color conversion.
Source and destiny must have the same size.

im.ProcessSplitHSI(src_image: imImage, h_image: imImage, s_image: imImage, i_image: imImage) [in Lua 5]
im.ProcessSplitHSINew(src_image: imImage) -> h_image: imImage, s_image: imImage, i_image: imImage [in Lua 5]
void imProcessMergeHSI | ( | const imImage * | h_image,
 |  | const imImage * | s_image,
 |  | const imImage * | i_image,
 |  | imImage * | dst_image
 | ) |  |

Merge HSI planes into a RGB image.
Source images must be IM_GRAY/IM_FLOAT. Destiny image can be IM_RGB/IM_BYTE,IM_FLOAT.
Source and destiny must have the same size. See HSI Color Coordinate System Conversions for a definition of the color conversion.

im.ProcessMergeHSI(h_image: imImage, s_image: imImage, i_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessMergeHSINew(h_image: imImage, s_image: imImage, i_image: imImage) -> dst_image: imImage [in Lua 5]
void imProcessSplitComponents | ( | const imImage * | src_image,
 |  | imImage ** | dst_image_list
 | ) |  |

Split a multicomponent image into separate components, including alpha.
Destiny images must be IM_GRAY. Size and data types must be all the same.
The number of destiny images must match the depth of the source image, including alpha.

im.ProcessSplitComponents(src_image: imImage, dst_image_list: table of imImage) [in Lua 5]
im.ProcessSplitComponentsNew(src_image: imImage) -> dst_image_list: table of imImage [in Lua 5]
void imProcessMergeComponents | ( | const imImage ** | src_image_list,
 |  | imImage * | dst_image
 | ) |  |

Merges separate components into a multicomponent image, including alpha.
Source images must be IM_GRAY. Size and data types must be all the same.
The number of source images must match the depth of the destiny image, including alpha.

im.ProcessMergeComponents(src_image_list: table of imImage, dst_image: imImage) [in Lua 5]
im.ProcessMergeComponentsNew(src_image_list: table of imImage) -> dst_image: imImage [in Lua 5]
void imProcessNormalizeComponents | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Normalize the color components by their sum. Example: c1 = c1/(c1+c2+c3).
Destiny image must be IM_FLOAT.

im.ProcessNormalizeComponents(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessNormalizeComponentsNew(src_image: imImage) -> new_image: imImage [in Lua 5]
void imProcessReplaceColor | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float * | src_color,
 |  | float * | dst_color
 | ) |  |

Replaces the source color by the destiny color.
The color will be type casted to the image data type.
The colors must have the same number of components of the images.
Supports all color spaces and all data types except IM_CFLOAT.

im.ProcessReplaceColor(src_image: imImage, dst_image: imImage, src_color: table of numbers, dst_color: table of numbers) [in Lua 5]
im.ProcessReplaceColorNew(src_image: imImage, src_color: table of numbers, dst_color: table of numbers) -> new_image: imImage [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Histogram Based Operations

Functions

Histogram Based Operations
[Image Processing]

Collaboration diagram for Histogram Based Operations:

Functions

void | imProcessExpandHistogram (const imImage *src_image, imImage *dst_image, float percent)
void | imProcessEqualizeHistogram (const imImage *src_image, imImage *dst_image)

Detailed Description

See im_process_pon.h

Function Documentation

void imProcessExpandHistogram | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | percent
 | ) |  |

Performs an histogram expansion based on a percentage of the number of pixels.
Percentage defines an amount of pixels to include at the lowest level and at the highest level. If its is zero only empty counts of the histogram will be considered.
Images must be IM_BYTE/(IM_RGB or IM_GRAY). Can be done in place.
To expand the gammut without using the histogram, by just specifing the lowest and highest levels use the IM_GAMUT_EXPAND tone gammut operation (imProcessToneGamut).

im.ProcessExpandHistogram(src_image: imImage, dst_image: imImage, percent: number) [in Lua 5]
im.ProcessExpandHistogramNew(src_image: imImage, percent: number) -> new_image: imImage [in Lua 5]
void imProcessEqualizeHistogram | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Performs an histogram equalization.
Images must be IM_BYTE/(IM_RGB or IM_GRAY). Can be done in place.

im.ProcessEqualizeHistogram(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessEqualizeHistogramNew(src_image: imImage) -> new_image: imImage [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Threshold Operations

Functions

Threshold Operations
[Image Processing]

Collaboration diagram for Threshold Operations:

Functions

int | imProcessRangeContrastThreshold (const imImage *src_image, imImage *dst_image, int kernel_size, int min_range)
int | imProcessLocalMaxThreshold (const imImage *src_image, imImage *dst_image, int kernel_size, int min_level)
void | imProcessThreshold (const imImage *src_image, imImage *dst_image, int level, int value)
void | imProcessThresholdByDiff (const imImage *src_image1, const imImage *src_image2, imImage *dst_image)
void | imProcessHysteresisThreshold (const imImage *src_image, imImage *dst_image, int low_thres, int high_thres)
void | imProcessHysteresisThresEstimate (const imImage *image, int *low_level, int *high_level)
int | imProcessUniformErrThreshold (const imImage *src_image, imImage *dst_image)
void | imProcessDifusionErrThreshold (const imImage *src_image, imImage *dst_image, int level)
int | imProcessPercentThreshold (const imImage *src_image, imImage *dst_image, float percent)
int | imProcessOtsuThreshold (const imImage *src_image, imImage *dst_image)
int | imProcessMinMaxThreshold (const imImage *src_image, imImage *dst_image)
void | imProcessLocalMaxThresEstimate (const imImage *image, int *level)
void | imProcessSliceThreshold (const imImage *src_image, imImage *dst_image, int start_level, int end_level)

Detailed Description

Operations that converts a usually IM_GRAY/IM_BYTE image into a IM_BINARY image using several threshold techniques.
See im_process_pon.h

Function Documentation

int imProcessRangeContrastThreshold | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size,
 |  | int | min_range
 | ) |  |

Threshold using a rank convolution with a range contrast function.
Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.
Local variable threshold by the method of Bernsen.
Extracted from XITE, Copyright 1991, Blab, UiO
http://www.ifi.uio.no/~blab/Software/Xite/

  Reference:
    Bernsen, J: "Dynamic thresholding of grey-level images"
        Proc. of the 8th ICPR, Paris, Oct 1986, 1251-1255.
  Author:     Oivind Due Trier

Returns zero if the counter aborted.

im.ProcessRangeContrastThreshold(src_image: imImage, dst_image: imImage, kernel_size: number, min_range: number) -> counter: boolean [in Lua 5]
im.ProcessRangeContrastThresholdNew(image: imImage, kernel_size: number, min_range: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessLocalMaxThreshold | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size,
 |  | int | min_level
 | ) |  |

Threshold using a rank convolution with a local max function.
Returns zero if the counter aborted.
Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.

im.ProcessLocalMaxThreshold(src_image: imImage, dst_image: imImage, kernel_size: number, min_level: number) -> counter: boolean [in Lua 5]
im.ProcessLocalMaxThresholdNew(image: imImage, kernel_size: number, min_level: number) -> counter: boolean, new_image: imImage [in Lua 5]
void imProcessThreshold | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | level,
 |  | int | value
 | ) |  |

Apply a manual threshold.
threshold = a <= level ? 0: value
Normal value is 1 but another common value is 255. Can be done in place for IM_BYTE source.
Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.

im.ProcessThreshold(src_image: imImage, dst_image: imImage, level: number, value: number) [in Lua 5]
im.ProcessThresholdNew(src_image: imImage, level: number, value: number) -> new_image: imImage [in Lua 5]
void imProcessThresholdByDiff | ( | const imImage * | src_image1,
 |  | const imImage * | src_image2,
 |  | imImage * | dst_image
 | ) |  |

Apply a threshold by the difference of two images.
threshold = a1 <= a2 ? 0: 1
Can be done in place.

im.ProcessThresholdByDiff(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5]
im.ProcessThresholdByDiffNew(src_image1: imImage, src_image2: imImage) -> new_image: imImage [in Lua 5]
void imProcessHysteresisThreshold | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | low_thres,
 |  | int | high_thres
 | ) |  |

Apply a threshold by the Hysteresis method.
Hysteresis thersholding of edge pixels. Starting at pixels with a value greater than the HIGH threshold, trace a connected sequence of pixels that have a value greater than the LOW threhsold.
Supports only IM_BYTE images. Note: could not find the original source code author name.

im.ProcessHysteresisThreshold(src_image: imImage, dst_image: imImage, low_thres: number, high_thres: number) [in Lua 5]
im.ProcessHysteresisThresholdNew(src_image: imImage, low_thres: number, high_thres: number) -> new_image: imImage [in Lua 5]
void imProcessHysteresisThresEstimate | ( | const imImage * | image,
 |  | int * | low_level,
 |  | int * | high_level
 | ) |  |

Estimates hysteresis low and high threshold levels.
Supports only IM_BYTE images. Usefull for imProcessHysteresisThreshold.

im.ProcessHysteresisThresEstimate(image: imImage) -> low_level: number, high_level: number [in Lua 5]
int imProcessUniformErrThreshold | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Calculates the threshold level for manual threshold using an uniform error approach.
Supports only IM_BYTE images. Extracted from XITE, Copyright 1991, Blab, UiO
http://www.ifi.uio.no/~blab/Software/Xite/

  Reference:
    S. M. Dunn & D. Harwood & L. S. Davis:
    "Local Estimation of the Uniform Error Threshold"
    IEEE Trans. on PAMI, Vol PAMI-6, No 6, Nov 1984.
  Comments: It only works well on images whith large objects.
  Author: Olav Borgli, BLAB, ifi, UiO
  Image processing lab, Department of Informatics, University of Oslo

Returns the used level.

im.ProcessUniformErrThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5]
im.ProcessUniformErrThresholdNew(src_image: imImage)  -> level: number, new_image: imImage [in Lua 5]
void imProcessDifusionErrThreshold | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | level
 | ) |  |

Apply a dithering on each image channel by using a difusion error method.
It can be applied on any IM_BYTE images. It will "threshold" each channel indivudually, so source and destiny must be of the same depth.

im.ProcessDifusionErrThreshold(src_image: imImage, dst_image: imImage, level: number) [in Lua 5]
im.ProcessDifusionErrThresholdNew(src_image: imImage, level: number) -> new_image: imImage [in Lua 5]
int imProcessPercentThreshold | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | percent
 | ) |  |

Calculates the threshold level for manual threshold using a percentage of pixels that should stay bellow the threshold.
Supports only IM_BYTE images. Returns the used level.

im.ProcessPercentThreshold(src_image: imImage, dst_image: imImage, percent: number) -> level: number [in Lua 5]
im.ProcessPercentThresholdNew(src_image: imImage, percent: number) -> level: number, new_image: imImage [in Lua 5]
int imProcessOtsuThreshold | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Calculates the threshold level for manual threshold using the Otsu approach.
Returns the used level.
Supports only IM_BYTE images. Original implementation by Flavio Szenberg.

im.ProcessOtsuThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5]
im.ProcessOtsuThresholdNew(src_image: imImage) -> level: number, new_image: imImage [in Lua 5]
int imProcessMinMaxThreshold | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Calculates the threshold level for manual threshold using (max-min)/2.
Returns the used level.
Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.

im.ProcessMinMaxThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5]
im.ProcessMinMaxThresholdNew(src_image: imImage) -> level: number, new_image: imImage [in Lua 5]
void imProcessLocalMaxThresEstimate | ( | const imImage * | image,
 |  | int * | level
 | ) |  |

Estimates Local Max threshold level for IM_BYTE images.

im.ProcessLocalMaxThresEstimate(image: imImage) -> level: number [in Lua 5]
void imProcessSliceThreshold | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | start_level,
 |  | int | end_level
 | ) |  |

Apply a manual threshold using an interval.
threshold = start_level <= a <= end_level ? 1: 0
Normal value is 1 but another common value is 255. Can be done in place for IM_BYTE source.
Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.

im.ProcessSliceThreshold(src_image: imImage, dst_image: imImage, start_level: number, end_level: number) [in Lua 5]
im.ProcessSliceThresholdNew(src_image: imImage, start_level: number, end_level: number) -> new_image: imImage [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Arithmetic Operations

Arithmetic Operations
[Image Processing]

Collaboration diagram for Arithmetic Operations:

Enumerations

enum imUnaryOp {
IM_UN_EQL, IM_UN_ABS, IM_UN_LESS, IM_UN_INV,
IM_UN_SQR, IM_UN_SQRT, IM_UN_LOG, IM_UN_EXP,
IM_UN_SIN, IM_UN_COS, IM_UN_CONJ, IM_UN_CPXNORM
}
enum imBinaryOp {
IM_BIN_ADD, IM_BIN_SUB, IM_BIN_MUL, IM_BIN_DIV,
IM_BIN_DIFF, IM_BIN_POW, IM_BIN_MIN, IM_BIN_MAX
}

Functions

void | imProcessUnArithmeticOp (const imImage *src_image, imImage *dst_image, int op)
void | imProcessArithmeticOp (const imImage *src_image1, const imImage *src_image2, imImage *dst_image, int op)
void | imProcessArithmeticConstOp (const imImage *src_image, float src_const, imImage *dst_image, int op)
void | imProcessBlendConst (const imImage *src_image1, const imImage *src_image2, imImage *dst_image, float alpha)
void | imProcessBlend (const imImage *src_image1, const imImage *src_image2, const imImage *alpha_image, imImage *dst_image)
void | imProcessCompose (const imImage *src_image1, const imImage *src_image2, imImage *dst_image)
void | imProcessSplitComplex (const imImage *src_image, imImage *dst_image1, imImage *dst_image2, int polar)
void | imProcessMergeComplex (const imImage *src_image1, const imImage *src_image2, imImage *dst_image, int polar)
void | imProcessMultipleMean (const imImage **src_image_list, int src_image_count, imImage *dst_image)
void | imProcessMultipleStdDev (const imImage **src_image_list, int src_image_count, const imImage *mean_image, imImage *dst_image)
int | imProcessAutoCovariance (const imImage *src_image, const imImage *mean_image, imImage *dst_image)
void | imProcessMultiplyConj (const imImage *src_image1, const imImage *src_image2, imImage *dst_image)

Detailed Description

Simple math operations for images.
See im_process_pon.h

Enumeration Type Documentation

enum imUnaryOp

Unary Arithmetic Operations.
Inverse and log may lead to math exceptions.

Enumerator:
IM_UN_EQL

equal = a

IM_UN_ABS

abssolute = |a|

IM_UN_LESS

less = -a

IM_UN_INV

invert = 1/a (#)

IM_UN_SQR

square = a*a

IM_UN_SQRT

square root = a^(1/2)

IM_UN_LOG

natural logarithm = ln(a) (#)

IM_UN_EXP

exponential = exp(a)

IM_UN_SIN

sine = sin(a)

IM_UN_COS

cosine = cos(a)

IM_UN_CONJ

complex conjugate = ar - ai*i

IM_UN_CPXNORM

complex normalization by magnitude = a / cpxmag(a)

               {
  IM_UN_EQL,    /**< equal             =     a        */
  IM_UN_ABS,    /**< abssolute         =    |a|       */
  IM_UN_LESS,   /**< less              =    -a        */
  IM_UN_INV,    /**< invert            =   1/a       (#) */
  IM_UN_SQR,    /**< square            =     a*a      */
  IM_UN_SQRT,   /**< square root       =     a^(1/2)  */
  IM_UN_LOG,    /**< natural logarithm =  ln(a)      (#) */
  IM_UN_EXP,    /**< exponential       = exp(a)       */
  IM_UN_SIN,    /**< sine              = sin(a)       */
  IM_UN_COS,    /**< cosine            = cos(a)       */
  IM_UN_CONJ,   /**< complex conjugate =     ar - ai*i                   */
  IM_UN_CPXNORM /**< complex normalization by magnitude = a / cpxmag(a)  */
};

enum imBinaryOp

Binary Arithmetic Operations.
Divide may lead to math exceptions.

Enumerator:
IM_BIN_ADD

add = a+b

IM_BIN_SUB

subtract = a-b

IM_BIN_MUL

multiply = a*b

IM_BIN_DIV

divide = a/b (#)

IM_BIN_DIFF

difference = |a-b|

IM_BIN_POW

power = a^b

IM_BIN_MIN

minimum = (a < b)? a: b

IM_BIN_MAX

maximum = (a > b)? a: b

                {
  IM_BIN_ADD,    /**< add         =    a+b            */
  IM_BIN_SUB,    /**< subtract    =    a-b            */
  IM_BIN_MUL,    /**< multiply    =    a*b            */
  IM_BIN_DIV,    /**< divide      =    a/b            (#) */
  IM_BIN_DIFF,   /**< difference  =    |a-b|          */
  IM_BIN_POW,    /**< power       =    a^b            */
  IM_BIN_MIN,    /**< minimum     =    (a < b)? a: b  */
  IM_BIN_MAX     /**< maximum     =    (a > b)? a: b  */
};

Function Documentation

void imProcessUnArithmeticOp | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | op
 | ) |  |

Apply an arithmetic unary operation.
Can be done in place, images must match size.
Destiny image can be several types depending on source:

  • byte -> byte, ushort, int, float
  • ushort -> byte, ushort, int, float
  • int -> byte, ushort, int, float
  • float -> float
  • complex -> complex If destiny is byte, then the result is cropped to 0-255.
im.ProcessUnArithmeticOp(src_image: imImage, dst_image: imImage, op: number) [in Lua 5]
im.ProcessUnArithmeticOpNew(image: imImage, op: number) -> new_image: imImage [in Lua 5]
void imProcessArithmeticOp | ( | const imImage * | src_image1,
 |  | const imImage * | src_image2,
 |  | imImage * | dst_image,
 |  | int | op
 | ) |  |

Apply a binary arithmetic operation.
Can be done in place, images must match size.
Source images must match type, destiny image can be several types depending on source:

  • byte -> byte, ushort, int, float
  • ushort -> ushort, int, float
  • int -> int, float
  • float -> float
  • complex -> complex One exception is that you can combine complex with float resulting complex. If destiny is byte, then the result is cropped to 0-255.
im.ProcessArithmeticOp(src_image1: imImage, src_image2: imImage, dst_image: imImage, op: number) [in Lua 5]
im.ProcessArithmeticOpNew(image1: imImage, image2: imImage, op: number) -> new_image: imImage [in Lua 5]

The New function will create a new image of the same type of the source images.

void imProcessArithmeticConstOp | ( | const imImage * | src_image,
 |  | float | src_const,
 |  | imImage * | dst_image,
 |  | int | op
 | ) |  |

Apply a binary arithmetic operation with a constant value.
Can be done in place, images must match size.
Destiny image can be several types depending on source:

  • byte -> byte, ushort, int, float
  • ushort -> byte, ushort, int, float
  • int -> byte, ushort, int, float
  • float -> float
  • complex -> complex The constant value is type casted to an apropriate type before the operation. If destiny is byte, then the result is cropped to 0-255.
im.ProcessArithmeticConstOp(src_image: imImage, src_const: number, dst_image: imImage, op: number) [in Lua 5]
im.ProcessArithmeticConstOpNew(image: imImage, src_const: number, op: number) -> new_image: imImage [in Lua 5]
void imProcessBlendConst | ( | const imImage * | src_image1,
 |  | const imImage * | src_image2,
 |  | imImage * | dst_image,
 |  | float | alpha
 | ) |  |

Blend two images using an alpha value = [a * alpha + b * (1 - alpha)].
Can be done in place, images must match size and type.
alpha value must be in the interval [0.0 - 1.0].

im.ProcessBlendConst(src_image1: imImage, src_image2: imImage, dst_image: imImage, alpha: number) [in Lua 5]
im.ProcessBlendConstNew(image1: imImage, image2: imImage, alpha: number) -> new_image: imImage [in Lua 5]
void imProcessBlend | ( | const imImage * | src_image1,
 |  | const imImage * | src_image2,
 |  | const imImage * | alpha_image,
 |  | imImage * | dst_image
 | ) |  |

Blend two images using an alpha channel = [a * alpha + b * (1 - alpha)].
Can be done in place, images must match size and type.
alpha_image must have the same data type except for complex images that must be float, and color_space must be IM_GRAY. integer alpha values must be:

0 - 255        IM_BYTE
0 - 65535      IM_USHORT
0 - 2147483647 IM_INT

that will be normalized to 0 - 1.

im.ProcessBlend(src_image1: imImage, src_image2: imImage, alpha_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessBlendNew(image1: imImage, image2: imImage, alpha_image: imImage) -> new_image: imImage [in Lua 5]
void imProcessCompose | ( | const imImage * | src_image1,
 |  | const imImage * | src_image2,
 |  | imImage * | dst_image
 | ) |  |

Compose two images that have an alpha channel using the OVER operator.
Can be done in place, images must match size and type.
Integer alpha values must be:

0 - 255        IM_BYTE
0 - 65535      IM_USHORT
0 - 2147483647 IM_INT

that will be normalized to 0 - 1.

im.ProcessCompose(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5]
im.ProcessComposeNew(image1: imImage, image2: imImage) -> new_image: imImage [in Lua 5]
void imProcessSplitComplex | ( | const imImage * | src_image,
 |  | imImage * | dst_image1,
 |  | imImage * | dst_image2,
 |  | int | polar
 | ) |  |

Split a complex image into two images with real and imaginary parts
or magnitude and phase parts (polar).
Source image must be IM_CFLOAT, destiny images must be IM_FLOAT.

im.ProcessSplitComplex(src_image: imImage, dst_image1: imImage, dst_image2: imImage, polar: boolean) [in Lua 5]
im.ProcessSplitComplexNew(image: imImage, polar: boolean) -> dst_image1: imImage, dst_image2: imImage [in Lua 5]
void imProcessMergeComplex | ( | const imImage * | src_image1,
 |  | const imImage * | src_image2,
 |  | imImage * | dst_image,
 |  | int | polar
 | ) |  |

Merges two images as the real and imaginary parts of a complex image,
or as magnitude and phase parts (polar = 1).
Source images must be IM_FLOAT, destiny image must be IM_CFLOAT.

im.ProcessMergeComplex(src_image1: imImage, src_image2: imImage, dst_image: imImage, polar: boolean) [in Lua 5]
im.ProcessMergeComplexNew(image1: imImage, image2: imImage, polar: boolean) -> new_image: imImage [in Lua 5]
void imProcessMultipleMean | ( | const imImage ** | src_image_list,
 |  | int | src_image_count,
 |  | imImage * | dst_image
 | ) |  |

Calculates the mean of multiple images.
Images must match size and type.

im.ProcessMultipleMean(src_image_list: table of imImage, dst_image: imImage) [in Lua 5]
im.ProcessMultipleMeanNew(src_image_list: table of imImage) -> new_image: imImage [in Lua 5]
void imProcessMultipleStdDev | ( | const imImage ** | src_image_list,
 |  | int | src_image_count,
 |  | const imImage * | mean_image,
 |  | imImage * | dst_image
 | ) |  |

Calculates the standard deviation of multiple images.
Images must match size and type. Use imProcessMultipleMean to calculate the mean_image.

im.ProcessMultipleStdDev(src_image_list: table of imImage, mean_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessMultipleStdDevNew(src_image_list: table of imImage, mean_image: imImage) -> new_image: imImage [in Lua 5]
int imProcessAutoCovariance | ( | const imImage * | src_image,
 |  | const imImage * | mean_image,
 |  | imImage * | dst_image
 | ) |  |

Calculates the auto-covariance of an image with the mean of a set of images.
Images must match size and type. Returns zero if the counter aborted.
Destiny is IM_FLOAT.

im.ProcessAutoCovariance(src_image: imImage, mean_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5]
im.ProcessAutoCovarianceNew(src_image: imImage, mean_image: imImage) -> counter: boolean, new_image: imImage [in Lua 5]
void imProcessMultiplyConj | ( | const imImage * | src_image1,
 |  | const imImage * | src_image2,
 |  | imImage * | dst_image
 | ) |  |

Multiplies the conjugate of one complex image with another complex image.
Images must match size. Conj(img1) * img2
Can be done in-place.

im.ProcessMultiplyConj(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5]
im.ProcessMultiplyConjNew(src_image1: imImage, src_image2: imImage) -> new_image: imImage [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Logical Arithmetic Operations

Logical Arithmetic Operations
[Image Processing]

Collaboration diagram for Logical Arithmetic Operations:

Enumerations

enum | imLogicOp { IM_BIT_AND, IM_BIT_OR, IM_BIT_XOR }

Functions

void | imProcessBitwiseOp (const imImage *src_image1, const imImage *src_image2, imImage *dst_image, int op)
void | imProcessBitwiseNot (const imImage *src_image, imImage *dst_image)
void | imProcessBitMask (const imImage *src_image, imImage *dst_image, unsigned char mask, int op)
void | imProcessBitPlane (const imImage *src_image, imImage *dst_image, int plane, int do_reset)

Detailed Description

Logical binary math operations for images.
See im_process_pon.h

Enumeration Type Documentation

enum imLogicOp

Logical Operations.

Enumerator:
IM_BIT_AND

and = a & b

IM_BIT_OR

or = a | b

IM_BIT_XOR

xor = ~(a | b)

               {
  IM_BIT_AND,   /**< and  =   a & b   */
  IM_BIT_OR,    /**< or   =   a | b   */
  IM_BIT_XOR    /**< xor  = ~(a | b)  */
};

Function Documentation

void imProcessBitwiseOp | ( | const imImage * | src_image1,
 |  | const imImage * | src_image2,
 |  | imImage * | dst_image,
 |  | int | op
 | ) |  |

Apply a logical operation.
Images must have data type IM_BYTE, IM_USHORT or IM_INT. Can be done in place.

im.ProcessBitwiseOp(src_image1: imImage, src_image2: imImage, dst_image: imImage, op: number) [in Lua 5]
im.ProcessBitwiseOpNew(src_image1: imImage, src_image2: imImage, op: number) -> new_image: imImage [in Lua 5]
void imProcessBitwiseNot | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Apply a logical NOT operation.
Images must have data type IM_BYTE, IM_USHORT or IM_INT. Can be done in place.

im.ProcessBitwiseNot(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessBitwiseNotNew(src_image: imImage) -> new_image: imImage [in Lua 5]
void imProcessBitMask | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | unsigned char | mask,
 |  | int | op
 | ) |  |

Apply a bit mask.
The same as imProcessBitwiseOp but the second image is replaced by a fixed mask.
Images must have data type IM_BYTE. It is valid only for AND, OR and XOR. Can be done in place.

im.ProcessBitMask(src_image: imImage, dst_image: imImage, mask: string, op: number) [in Lua 5]
im.ProcessBitMaskNew(src_image: imImage, mask: string, op: number) -> new_image: imImage [in Lua 5]

In Lua, mask is a string with 0s and 1s, for example: "11001111".

void imProcessBitPlane | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | plane,
 |  | int | do_reset
 | ) |  |

Extract or Reset a bit plane. For ex: 000X0000 or XXX0XXXX (plane=3).
Images must have data type IM_BYTE. Can be done in place.

im.ProcessBitPlane(src_image: imImage, dst_image: imImage, plane: number, do_reset: boolean) [in Lua 5]
im.ProcessBitPlaneNew(src_image: imImage, plane: number, do_reset: boolean) -> new_image: imImage [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Tone Gamut Operations

Tone Gamut Operations
[Image Processing]

Collaboration diagram for Tone Gamut Operations:

Enumerations

enum imToneGamut {
IM_GAMUT_NORMALIZE, IM_GAMUT_POW, IM_GAMUT_LOG, IM_GAMUT_EXP,
IM_GAMUT_INVERT, IM_GAMUT_ZEROSTART, IM_GAMUT_SOLARIZE, IM_GAMUT_SLICE,
IM_GAMUT_EXPAND, IM_GAMUT_CROP, IM_GAMUT_BRIGHTCONT
}

Functions

void | imProcessToneGamut (const imImage *src_image, imImage *dst_image, int op, float *param)
void | imProcessUnNormalize (const imImage *src_image, imImage *dst_image)
void | imProcessDirectConv (const imImage *src_image, imImage *dst_image)
void | imProcessNegative (const imImage *src_image, imImage *dst_image)

Detailed Description

Operations that try to preserve the min-max interval in the output (the dynamic range).
See im_process_pon.h

Enumeration Type Documentation

enum imToneGamut

Tone Gamut Operations.

Enumerator:
IM_GAMUT_NORMALIZE

normalize = (a-min) / (max-min) (destiny image must be IM_FLOAT)

IM_GAMUT_POW

pow = ((a-min) / (max-min))^gamma * (max-min) + min
param[0]=gamma

IM_GAMUT_LOG

log = log(K * (a-min) / (max-min) + 1))*(max-min)/log(K+1) + min
param[0]=K (K>0)

IM_GAMUT_EXP

exp = (exp(K * (a-min) / (max-min)) - 1))*(max-min)/(exp(K)-1) + min
param[0]=K

IM_GAMUT_INVERT

invert = max - (a-min)

IM_GAMUT_ZEROSTART

zerostart = a - min

IM_GAMUT_SOLARIZE

solarize = a < level ? a: (level * (max-min) - a * (level-min)) / (max-level)
param[0]=level percentage (0-100) relative to min-max
photography solarization effect.

IM_GAMUT_SLICE

slice = start < a || a > end ? min: binarize? max: a
param[0]=start, param[1]=end, param[2]=binarize

IM_GAMUT_EXPAND

expand = a < start ? min: a > end ? max : (a-start)*(max-min)/(end-start) + min
param[0]=start, param[1]=end

IM_GAMUT_CROP

crop = a < start ? start: a > end ? end : a
param[0]=start, param[1]=end

IM_GAMUT_BRIGHTCONT

brightcont = a < min ? min: a > max ? max: a * tan(c_a) + b_s + (max-min)*(1 - tan(c_a))/2
param[0]=bright_shift (-100%..+100%), param[1]=contrast_factor (-100%..+100%)
change brightness and contrast simultaneously.

                 {
  IM_GAMUT_NORMALIZE, /**< normalize = (a-min) / (max-min)     (destiny image must be IM_FLOAT)   */
  IM_GAMUT_POW,       /**< pow       = ((a-min) / (max-min))^gamma * (max-min) + min                  \n
                                       param[0]=gamma                                             */
  IM_GAMUT_LOG,       /**< log       = log(K * (a-min) / (max-min) + 1))*(max-min)/log(K+1) + min     \n
                                       param[0]=K     (K>0)                                       */
  IM_GAMUT_EXP,       /**< exp       = (exp(K * (a-min) / (max-min)) - 1))*(max-min)/(exp(K)-1) + min \n
                                       param[0]=K                                                 */
  IM_GAMUT_INVERT,    /**< invert    = max - (a-min)                                              */
  IM_GAMUT_ZEROSTART, /**< zerostart = a - min                                                    */
  IM_GAMUT_SOLARIZE,  /**< solarize  = a < level ?  a:  (level * (max-min) - a * (level-min)) / (max-level) \n
                                       param[0]=level percentage (0-100) relative to min-max      \n
                                       photography solarization effect. */
  IM_GAMUT_SLICE,     /**< slice     = start < a || a > end ?  min:  binarize?  max: a                     \n
                                       param[0]=start,  param[1]=end,  param[2]=binarize          */
  IM_GAMUT_EXPAND,    /**< expand    = a < start ?  min: a > end ? max :  (a-start)*(max-min)/(end-start) + min  \n
                                       param[0]=start,  param[1]=end                              */
  IM_GAMUT_CROP,      /**< crop      = a < start ?  start: a > end ? end : a                                        \n
                                       param[0]=start,  param[1]=end                              */
  IM_GAMUT_BRIGHTCONT /**< brightcont = a < min ?  min:  a > max ?  max:  a * tan(c_a) + b_s + (max-min)*(1 - tan(c_a))/2  \n
                                        param[0]=bright_shift (-100%..+100%),  param[1]=contrast_factor (-100%..+100%)     \n
                                        change brightness and contrast simultaneously. */
};

Function Documentation

void imProcessToneGamut | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | op,
 |  | float * | param
 | ) |  |

Apply a gamut operation with arguments.
Supports all data types except IM_CFLOAT.
The linear operation do a special convertion when min > 0 and max < 1, it forces min=0 and max=1.
IM_BYTE images have min=0 and max=255 always.
Can be done in place. When there is no extra params, can use NULL.

im.ProcessToneGamut(src_image: imImage, dst_image: imImage, op: number, param: table of number) [in Lua 5]
im.ProcessToneGamutNew(src_image: imImage, op: number, param: table of number) -> new_image: imImage [in Lua 5]
void imProcessUnNormalize | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Converts from (0-1) to (0-255), crop out of bounds values.
Source image must be IM_FLOAT, and destiny image must be IM_BYTE.

im.ProcessUnNormalize(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessUnNormalizeNew(src_image: imImage) -> new_image: imImage [in Lua 5]
void imProcessDirectConv | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Directly converts IM_USHORT, IM_INT and IM_FLOAT into IM_BYTE images.
This can also be done using imConvertDataType with IM_CAST_DIRECT.

im.ProcessDirectConv(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessDirectConvNew(src_image: imImage) -> new_image: imImage [in Lua 5]
void imProcessNegative | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

A negative effect. Uses imProcessToneGamut with IM_GAMUT_INVERT for non MAP images.
Supports all color spaces and all data types except IM_CFLOAT.
Can be done in place.

im.ProcessNegative(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessNegativeNew(src_image: imImage) -> new_image: imImage [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Convolution Operations

Convolution Operations
[Image Processing]

Collaboration diagram for Convolution Operations:

Modules

Kernel Generators

Functions

int | imProcessConvolve (const imImage *src_image, imImage *dst_image, const imImage *kernel)
int | imProcessConvolveSep (const imImage *src_image, imImage *dst_image, const imImage *kernel)
int | imProcessConvolveDual (const imImage *src_image, imImage *dst_image, const imImage *kernel1, const imImage *kernel2)
int | imProcessConvolveRep (const imImage *src_image, imImage *dst_image, const imImage *kernel, int count)
int | imProcessCompassConvolve (const imImage *src_image, imImage *dst_image, imImage *kernel)
void | imProcessRotateKernel (imImage *kernel)
int | imProcessDiffOfGaussianConvolve (const imImage *src_image, imImage *dst_image, float stddev1, float stddev2)
int | imProcessLapOfGaussianConvolve (const imImage *src_image, imImage *dst_image, float stddev)
int | imProcessMeanConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGaussianConvolve (const imImage *src_image, imImage *dst_image, float stddev)
int | imProcessBarlettConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessSobelConvolve (const imImage *src_image, imImage *dst_image)
int | imProcessPrewittConvolve (const imImage *src_image, imImage *dst_image)
int | imProcessSplineEdgeConvolve (const imImage *src_image, imImage *dst_image)
void | imProcessZeroCrossing (const imImage *src_image, imImage *dst_image)
void | imProcessCanny (const imImage *src_image, imImage *dst_image, float stddev)
int | imGaussianStdDev2KernelSize (float stddev)
float | imGaussianKernelSize2StdDev (int kernel_size)
int | imProcessUnsharp (const imImage *src_image, imImage *dst_image, float stddev, float amount, float threshold)
int | imProcessSharp (const imImage *src_image, imImage *dst_image, float amount, float threshold)
int | imProcessSharpKernel (const imImage *src_image, const imImage *kernel, imImage *dst_image, float amount, float threshold)

Detailed Description

See im_process_loc.h

Function Documentation

int imProcessConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | const imImage * | kernel
 | ) |  |

Base Convolution with a kernel.
Kernel can be IM_INT or IM_FLOAT, but always IM_GRAY. Use kernel size odd for better results.
Supports all data types. The border is mirrored.
Returns zero if the counter aborted. Most of the convolutions use this function.
If the kernel image attribute "Description" exists it is used by the counter.

im.ProcessConvolve(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5]
im.ProcessConvolveNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessConvolveSep | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | const imImage * | kernel
 | ) |  |

Base convolution when the kernel is separable. Only the first line and the first column will be used.
Returns zero if the counter aborted.
If the kernel image attribute "Description" exists it is used by the counter.

im.ProcessConvolveSep(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5]
im.ProcessConvolveSepNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessConvolveDual | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | const imImage * | kernel1,
 |  | const imImage * | kernel2
 | ) |  |

Base Convolution with two kernels. The result is the magnitude of the result of each convolution.
Kernel can be IM_INT or IM_FLOAT, but always IM_GRAY. Use kernel size odd for better results.
Supports all data types. The border is mirrored.
Returns zero if the counter aborted. Most of the convolutions use this function.
If the kernel image attribute "Description" exists it is used by the counter.

im.ProcessConvolveDual(src_image: imImage, dst_image: imImage, kernel1, kernel2: imImage) -> counter: boolean [in Lua 5]
im.ProcessConvolveDualNew(image: imImage, kernel1, kernel2: imImage) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessConvolveRep | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | const imImage * | kernel,
 |  | int | count
 | ) |  |

Repeats the convolution a number of times.
Returns zero if the counter aborted.
If the kernel image attribute "Description" exists it is used by the counter.

im.ProcessConvolveRep(src_image: imImage, dst_image: imImage, kernel: imImage, count: number) -> counter: boolean [in Lua 5]
im.ProcessConvolveRepNew(image: imImage, kernel: imImage, count: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessCompassConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | imImage * | kernel
 | ) |  |

Convolve with a kernel rotating it 8 times and getting the absolute maximum value.
Kernel must be square.
The rotation is implemented only for kernel sizes 3x3, 5x5 and 7x7.
Supports all data types except IM_CFLOAT. Returns zero if the counter aborted.
If the kernel image attribute "Description" exists it is used by the counter.

im.ProcessCompassConvolve(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5]
im.ProcessCompassConvolveNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5]
void imProcessRotateKernel ( imImage * kernel )

Utility function to rotate a kernel one time.

im.ProcessRotateKernel(kernel: imImage) [in Lua 5]
int imProcessDiffOfGaussianConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | stddev1,
 |  | float | stddev2
 | ) |  |

Difference(Gaussian1, Gaussian2).
Supports all data types, but if source is IM_BYTE or IM_USHORT destiny image must be of type IM_INT.

im.ProcessDiffOfGaussianConvolve(src_image: imImage, dst_image: imImage, stddev1: number, stddev2: number) -> counter: boolean [in Lua 5]
im.ProcessDiffOfGaussianConvolveNew(image: imImage, stddev1: number, stddev2: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessLapOfGaussianConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | stddev
 | ) |  |

Convolution with a laplacian of a gaussian kernel.
Supports all data types, but if source is IM_BYTE or IM_USHORT destiny image must be of type IM_INT.

im.ProcessLapOfGaussianConvolve(src_image: imImage, dst_image: imImage, stddev: number) -> counter: boolean [in Lua 5]
im.ProcessLapOfGaussianConvolveNew(image: imImage, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessMeanConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Convolution with a kernel full of "1"s inside a circle.
Supports all data types.

im.ProcessMeanConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessMeanConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessGaussianConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | stddev
 | ) |  |

Convolution with a float gaussian kernel.
If sdtdev is negative its magnitude will be used as the kernel size.
Supports all data types.

im.ProcessGaussianConvolve(src_image: imImage, dst_image: imImage, stddev: number) -> counter: boolean [in Lua 5]
im.ProcessGaussianConvolveNew(image: imImage, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessBarlettConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Convolution with a barlett kernel.
Supports all data types.

im.ProcessBarlettConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessBarlettConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessSobelConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Magnitude of the sobel convolution.
Supports all data types.

im.ProcessSobelConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5]
im.ProcessSobelConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessPrewittConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Magnitude of the prewitt convolution.
Supports all data types.

im.ProcessPrewittConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5]
im.ProcessPrewittConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessSplineEdgeConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Spline edge dectection.
Supports all data types.

im.ProcessSplineEdgeConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5]
im.ProcessSplineEdgeConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5]
void imProcessZeroCrossing | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Finds the zero crossings of IM_INT and IM_FLOAT images. Crossings are marked with non zero values indicating the intensity of the edge. It is usually used after a second derivative, laplace.
Extracted from XITE, Copyright 1991, Blab, UiO
http://www.ifi.uio.no/~blab/Software/Xite/

im.ProcessZeroCrossing(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessZeroCrossingNew(image: imImage) -> new_image: imImage [in Lua 5]
void imProcessCanny | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | stddev
 | ) |  |

First part of the Canny edge detector. Includes the gaussian filtering and the nonmax suppression.
After using this you could apply a Hysteresis Threshold, see imProcessHysteresisThreshold.
Image must be IM_BYTE/IM_GRAY.
Implementation from the book:

    J. R. Parker
    "Algoritms for Image Processing and Computer Vision"
    WILEY

im.ProcessCanny(src_image: imImage, dst_image: imImage, stddev: number) [in Lua 5]
im.ProcessCannyNew(image: imImage, stddev: number) -> new_image: imImage [in Lua 5]
int imGaussianStdDev2KernelSize ( float stddev )

Calculates the kernel size given the standard deviation.
If sdtdev is negative its magnitude will be used as the kernel size.

im.GaussianStdDev2KernelSize(stddev: number) -> kernel_size: number [in Lua 5]
float imGaussianKernelSize2StdDev ( int kernel_size )

Calculates the standard deviation given the kernel size.

im.GaussianKernelSize2StdDev(kernel_size: number) -> stddev: number [in Lua 5]
int imProcessUnsharp | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | stddev,
 |  | float | amount,
 |  | float | threshold
 | ) |  |

Edge enhancement using Unsharp mask. stddev control the gaussian filter, amount controls how much the edges will enhance the image (0<amount<1), and threshold controls which edges will be considered, it compares to twice of the absolute size of the edge. Although very similar to imProcessSharp, produces better results.

im.ProcessUnsharp(src_image: imImage, dst_image: imImage, stddev: number, amount: number, threshold: number) [in Lua 5]
im.ProcessUnsharpNew(image: imImage, stddev: number, amount: number, threshold: number) -> new_image: imImage [in Lua 5]
int imProcessSharp | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | float | amount,
 |  | float | threshold
 | ) |  |

Edge enhancement using Laplacian8 mask. amount controls how much the edges will enhance the image (0<amount<1), and threshold controls which edges will be considered, it compares to twice of the absolute size of the edge.

im.ProcessSharp(src_image: imImage, dst_image: imImage, amount: number, threshold: number) [in Lua 5]
im.ProcessSharpNew(image: imImage, amount: number, threshold: number) -> new_image: imImage [in Lua 5]
int imProcessSharpKernel | ( | const imImage * | src_image,
 |  | const imImage * | kernel,
 |  | imImage * | dst_image,
 |  | float | amount,
 |  | float | threshold
 | ) |  |

Edge enhancement using a given kernel. If kernel has all positive values, then the unsharp technique is used, else sharp is used. amount controls how much the edges will enhance the image (0<amount<1), and threshold controls which edges will be considered, it compares to twice of the absolute size of the edge.

im.ProcessSharp(src_image: imImage, dst_image: imImage, amount: number, threshold: number) [in Lua 5]
im.ProcessSharpNew(image: imImage, amount: number, threshold: number) -> new_image: imImage [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Kernel Generators

Functions

Kernel Generators
[Convolution Operations]

Collaboration diagram for Kernel Generators:

Functions

imImage * | imKernelSobel (void)
imImage * | imKernelPrewitt (void)
imImage * | imKernelKirsh (void)
imImage * | imKernelLaplacian4 (void)
imImage * | imKernelLaplacian8 (void)
imImage * | imKernelLaplacian5x5 (void)
imImage * | imKernelLaplacian7x7 (void)
imImage * | imKernelGradian3x3 (void)
imImage * | imKernelGradian7x7 (void)
imImage * | imKernelSculpt (void)
imImage * | imKernelMean3x3 (void)
imImage * | imKernelMean5x5 (void)
imImage * | imKernelCircularMean5x5 (void)
imImage * | imKernelMean7x7 (void)
imImage * | imKernelCircularMean7x7 (void)
imImage * | imKernelGaussian3x3 (void)
imImage * | imKernelGaussian5x5 (void)
imImage * | imKernelBarlett5x5 (void)
imImage * | imKernelTopHat5x5 (void)
imImage * | imKernelTopHat7x7 (void)
imImage * | imKernelEnhance (void)

Detailed Description

Creates several known kernels
See im_kernel.h

Function Documentation

imImage* imKernelSobel ( void )

Creates a kernel with the following values:

   1  2  1
   0  0  0
  -1 -2 -1

im.KernelSobel() -> kernel: imImage [in Lua 5]
imImage* imKernelPrewitt ( void )

Creates a kernel with the following values:

   1  1  1
   0  0  0
  -1 -1 -1

im.KernelPrewitt() -> kernel: imImage [in Lua 5]
imImage* imKernelKirsh ( void )

Creates a kernel with the following values:

   5  5  5
  -3  0 -3
  -3 -3 -3

im.KernelKirsh() -> kernel: imImage [in Lua 5]
imImage* imKernelLaplacian4 ( void )

Creates a kernel with the following values:

   0 -1  0
  -1  4 -1
   0 -1  0

im.KernelLaplacian4() -> kernel: imImage [in Lua 5]
imImage* imKernelLaplacian8 ( void )

Creates a kernel with the following values:

  -1 -1 -1
  -1  8 -1
  -1 -1 -1

im.KernelLaplacian8() -> kernel: imImage [in Lua 5]
imImage* imKernelLaplacian5x5 ( void )

Creates a kernel with the following values:

   0 -1 -1 -1  0
  -1  0  1  0 -1
  -1  1  8  1 -1
  -1  0  1  0 -1
   0 -1 -1 -1  0

im.KernelLaplacian5x5() -> kernel: imImage [in Lua 5]
imImage* imKernelLaplacian7x7 ( void )

Creates a kernel with the following values:

  -1 -1 -1 -1 -1 -1 -1
  -1 -1 -1 -1 -1 -1 -1
  -1 -1 -1 -1 -1 -1 -1
  -1 -1 -1 48 -1 -1 -1
  -1 -1 -1 -1 -1 -1 -1
  -1 -1 -1 -1 -1 -1 -1
  -1 -1 -1 -1 -1 -1 -1

im.KernelLaplacian7x7() -> kernel: imImage [in Lua 5]
imImage* imKernelGradian3x3 ( void )

Creates a kernel with the following values:

  0 -1 0
  0  1 0
  0  0 0

im.KernelGradian3x3() -> kernel: imImage [in Lua 5]
imImage* imKernelGradian7x7 ( void )

Creates a kernel with the following values:

   0 -1 -1  0  1  1  0
  -1 -2 -2  0  2  2  1
  -1 -2 -3  0  3  2  1
  -1 -2 -3  0  3  2  1
  -1 -2 -3  0  3  2  1
  -1 -2 -2  0  2  2  1
   0 -1 -1  0  1  1  0

im.KernelGradian7x7() -> kernel: imImage [in Lua 5]
imImage* imKernelSculpt ( void )

Creates a kernel with the following values:

  -1 0 0
   0 0 0
   0 0 1

im.KernelSculpt() -> kernel: imImage [in Lua 5]
imImage* imKernelMean3x3 ( void )

Creates a kernel with the following values:

  1 1 1
  1 1 1
  1 1 1

im.KernelMean3x3() -> kernel: imImage [in Lua 5]
imImage* imKernelMean5x5 ( void )

Creates a kernel with the following values:

  1 1 1 1 1
  1 1 1 1 1
  1 1 1 1 1
  1 1 1 1 1
  1 1 1 1 1

im.KernelMean5x5() -> kernel: imImage [in Lua 5]
imImage* imKernelCircularMean5x5 ( void )

Creates a kernel with the following values:

  0 1 1 1 0
  1 1 1 1 1
  1 1 1 1 1
  1 1 1 1 1
  0 1 1 1 0

im.KernelMean5x5() -> kernel: imImage [in Lua 5]
imImage* imKernelMean7x7 ( void )

Creates a kernel with the following values:

  1 1 1 1 1 1 1
  1 1 1 1 1 1 1
  1 1 1 1 1 1 1
  1 1 1 1 1 1 1
  1 1 1 1 1 1 1
  1 1 1 1 1 1 1
  1 1 1 1 1 1 1

im.KernelMean7x7() -> kernel: imImage [in Lua 5]
imImage* imKernelCircularMean7x7 ( void )

Creates a kernel with the following values:

  0 0 1 1 1 0 0
  0 1 1 1 1 1 0
  1 1 1 1 1 1 1
  1 1 1 1 1 1 1
  1 1 1 1 1 1 1
  0 1 1 1 1 1 0
  0 0 1 1 1 0 0

im.KernelCircularMean7x7() -> kernel: imImage [in Lua 5]
imImage* imKernelGaussian3x3 ( void )

Creates a kernel with the following values:

  1 2 1
  2 4 2
  1 2 1

im.KernelGaussian3x3() -> kernel: imImage [in Lua 5]
imImage* imKernelGaussian5x5 ( void )

Creates a kernel with the following values:

  1  4  6  4 1
  4 16 24 16 4
  6 24 36 24 6
  4 16 24 16 4
  1  4  6  4 1

im.KernelGaussian5x5() -> kernel: imImage [in Lua 5]
imImage* imKernelBarlett5x5 ( void )

Creates a kernel with the following values:

  1 2 3 2 1
  2 4 6 4 2
  3 6 9 6 3
  2 4 6 4 2
  1 2 3 2 1

im.KernelBarlett5x5() -> kernel: imImage [in Lua 5]
imImage* imKernelTopHat5x5 ( void )

Creates a kernel with the following values:

   0 -1 -1 -1  0
  -1 -1  3 -1 -1
  -1  3  4  3 -1
  -1 -1  3 -1 -1
   0 -1 -1 -1  0

im.KernelTopHat5x5() -> kernel: imImage [in Lua 5]
imImage* imKernelTopHat7x7 ( void )

Creates a kernel with the following values:

   0  0 -1 -1 -1  0  0
   0 -1 -1 -1 -1 -1  0
  -1 -1  3  3  3 -1 -1
  -1 -1  3  4  3 -1 -1
  -1 -1  3  3  3 -1 -1
   0 -1 -1 -1 -1 -1  0
   0  0 -1 -1 -1  0  0

im.KernelTopHat7x7() -> kernel: imImage [in Lua 5]
imImage* imKernelEnhance ( void )

Creates a kernel with the following values:

   0 -1 -2 -1  0
  -1 -4  0 -4 -1
  -2  0 40  0 -2
  -1 -4  0 -4 -1
   0 -1 -2 -1  0

im.KernelEnhance() -> kernel: imImage [in Lua 5]


IM: Rank Convolution Operations

Functions

Rank Convolution Operations
[Image Processing]

Collaboration diagram for Rank Convolution Operations:

Functions

int | imProcessMedianConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessRangeConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessRankClosestConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessRankMaxConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessRankMinConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)

Detailed Description

All the rank convolution use the same base function. Near the border the base function includes only the real image pixels in the rank. No border extensions are used.
See im_process_loc.h

Function Documentation

int imProcessMedianConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Rank convolution using the median value.
Returns zero if the counter aborted.
Supports all data types except IM_CFLOAT. Can be applied on color images.

im.ProcessMedianConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessMedianConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessRangeConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Rank convolution using (maximum-minimum) value.
Returns zero if the counter aborted.
Supports all data types except IM_CFLOAT. Can be applied on color images.

im.ProcessRangeConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessRangeConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessRankClosestConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Rank convolution using the closest maximum or minimum value.
Returns zero if the counter aborted.
Supports all data types except IM_CFLOAT. Can be applied on color images.

im.ProcessRankClosestConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessRankClosestConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessRankMaxConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Rank convolution using the maximum value.
Returns zero if the counter aborted.
Supports all data types except IM_CFLOAT. Can be applied on color images.

im.ProcessRankMaxConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessRankMaxConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessRankMinConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Rank convolution using the minimum value.
Returns zero if the counter aborted.
Supports all data types except IM_CFLOAT. Can be applied on color images.

im.ProcessRankMinConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessRankMinConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Morphology Operations for Binary Images

Functions

Morphology Operations for Binary Images
[Image Processing]

Collaboration diagram for Morphology Operations for Binary Images:

Functions

int | imProcessBinMorphConvolve (const imImage *src_image, imImage *dst_image, const imImage *kernel, int hit_white, int iter)
int | imProcessBinMorphErode (const imImage *src_image, imImage *dst_image, int kernel_size, int iter)
int | imProcessBinMorphDilate (const imImage *src_image, imImage *dst_image, int kernel_size, int iter)
int | imProcessBinMorphOpen (const imImage *src_image, imImage *dst_image, int kernel_size, int iter)
int | imProcessBinMorphClose (const imImage *src_image, imImage *dst_image, int kernel_size, int iter)
int | imProcessBinMorphOutline (const imImage *src_image, imImage *dst_image, int kernel_size, int iter)
void | imProcessBinMorphThin (const imImage *src_image, imImage *dst_image)

Detailed Description

See im_process_loc.h

Function Documentation

int imProcessBinMorphConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | const imImage * | kernel,
 |  | int | hit_white,
 |  | int | iter
 | ) |  |

Base binary morphology convolution.
Images are all IM_BINARY. Kernel is IM_INT, but values can be only 1, 0 or -1. Use kernel size odd for better results.
Hit white means hit=1 and miss=0, or else hit=0 and miss=1.
Use -1 for don't care positions in kernel. Kernel values are simply compared with image values.
The operation can be repeated by a number of iterations. The border is zero extended.
Almost all the binary morphology operations use this function.
If the kernel image attribute "Description" exists it is used by the counter.

im.ProcessBinMorphConvolve(src_image: imImage, dst_image: imImage, kernel: imImage, hit_white: boolean, iter: number) -> counter: boolean [in Lua 5]
im.ProcessBinMorphConvolveNew(image: imImage, kernel: imImage, hit_white: boolean, iter: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessBinMorphErode | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size,
 |  | int | iter
 | ) |  |

Binary morphology convolution with a kernel full of "1"s and hit white.

im.ProcessBinMorphErode(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5]
im.ProcessBinMorphErodeNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessBinMorphDilate | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size,
 |  | int | iter
 | ) |  |

Binary morphology convolution with a kernel full of "0"s and hit black.

im.ProcessBinMorphDilate(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5]
im.ProcessBinMorphDilateNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessBinMorphOpen | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size,
 |  | int | iter
 | ) |  |

Erode+Dilate. When iteration is more than one it means Erode+Erode+Erode+...+Dilate+Dilate+Dilate+...

im.ProcessBinMorphOpen(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5]
im.ProcessBinMorphOpenNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessBinMorphClose | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size,
 |  | int | iter
 | ) |  |

Dilate+Erode.

im.ProcessBinMorphClose(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5]
im.ProcessBinMorphCloseNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessBinMorphOutline | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size,
 |  | int | iter
 | ) |  |

Erode+Difference.
The difference from the source image is applied only once.

im.ProcessBinMorphOutline(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5]
im.ProcessBinMorphOutlineNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5]
void imProcessBinMorphThin | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Thins the supplied binary image using Rosenfeld's parallel thinning algorithm.
Reference:
"Efficient Binary Image Thinning using Neighborhood Maps"
by Joseph M. Cychosz, 3ksnn64@ecn.purdue.edu
in "Graphics Gems IV", Academic Press, 1994

im.ProcessBinMorphThin(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessBinMorphThinNew(image: imImage) -> new_image: imImage [in Lua 5]


IM: Morphology Operations for Gray Images

Functions

Morphology Operations for Gray Images
[Image Processing]

Collaboration diagram for Morphology Operations for Gray Images:

Functions

int | imProcessGrayMorphConvolve (const imImage *src_image, imImage *dst_image, const imImage *kernel, int ismax)
int | imProcessGrayMorphErode (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphDilate (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphOpen (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphClose (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphTopHat (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphWell (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphGradient (const imImage *src_image, imImage *dst_image, int kernel_size)

Detailed Description

See im_process_loc.h

Function Documentation

int imProcessGrayMorphConvolve | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | const imImage * | kernel,
 |  | int | ismax
 | ) |  |

Base gray morphology convolution.
Supports all data types except IM_CFLOAT. Can be applied on color images.
Kernel is always IM_INT. Use kernel size odd for better results.
Use -1 for don't care positions in kernel. Kernel values are added to image values, then
you can use the maximum or the minimum within the kernel area.
No border extensions are used. All the gray morphology operations use this function.
If the kernel image attribute "Description" exists it is used by the counter.

im.ProcessGrayMorphConvolve(src_image: imImage, dst_image: imImage, kernel: imImage, ismax: boolean) -> counter: boolean [in Lua 5]
im.ProcessGrayMorphConvolveNew(image: imImage, kernel: imImage, ismax: boolean) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessGrayMorphErode | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Gray morphology convolution with a kernel full of "0"s and use minimum value.

im.ProcessGrayMorphErode(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessGrayMorphErodeNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessGrayMorphDilate | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Gray morphology convolution with a kernel full of "0"s and use maximum value.

im.ProcessGrayMorphDilate(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessGrayMorphDilateNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessGrayMorphOpen | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Erode+Dilate.

im.ProcessGrayMorphOpen(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessGrayMorphOpenNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessGrayMorphClose | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Dilate+Erode.

im.ProcessGrayMorphClose(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessGrayMorphCloseNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessGrayMorphTopHat | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Open+Difference.

im.ProcessGrayMorphTopHat(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessGrayMorphTopHatNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessGrayMorphWell | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Close+Difference.

im.ProcessGrayMorphWell(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessGrayMorphWellNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessGrayMorphGradient | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | kernel_size
 | ) |  |

Difference(Erode, Dilate).

im.ProcessGrayMorphGradient(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5]
im.ProcessGrayMorphGradientNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5]


IM: Fourier Transform Operations

Functions

Fourier Transform Operations
[Image Processing]

Collaboration diagram for Fourier Transform Operations:

Functions

void | imProcessFFT (const imImage *src_image, imImage *dst_image)
void | imProcessIFFT (const imImage *src_image, imImage *dst_image)
void | imProcessFFTraw (imImage *image, int inverse, int center, int normalize)
void | imProcessSwapQuadrants (imImage *image, int center2origin)

Detailed Description

All Fourier transforms use FFTW library.
The pre-compiled binaries for FFTW version 2.1.5 includes all the necessary files. The pre-compiled binaries for FFTW version 3.x depends on an external library, not provided. To build the code that uses FFTW version 3 you must define USE_FFTW3.
FFTW Copyright Matteo Frigo, Steven G. Johnson and the MIT.
http://www.fftw.org
See "fftw.h"
Must link with "im_fftw" library.
IMPORTANT: The FFTW lib has a GPL license. The license of the "im_fftw" library is automatically the GPL. So you cannot use it for commercial applications without contacting the authors.
See im_process_glo.h

Function Documentation

void imProcessFFT | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Forward FFT.
The result has its lowest frequency at the center of the image.
This is an unnormalized fft.
Images must be of the same size. Destiny image must be of type complex.

im.ProcessFFT(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessFFTNew(image: imImage) -> new_image: imImage [in Lua 5]
void imProcessIFFT | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Inverse FFT.
The image has its lowest frequency restored to the origin before the transform.
The result is normalized by (width*height).
Images must be of the same size and both must be of type complex.

im.ProcessIFFT(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessIFFTNew(image: imImage) -> new_image: imImage [in Lua 5]
void imProcessFFTraw | ( | imImage * | image,
 |  | int | inverse,
 |  | int | center,
 |  | int | normalize
 | ) |  |

Raw in-place FFT (forward or inverse).
The lowest frequency can be centered after forward, or can be restored to the origin before inverse.
The result can be normalized after the transform by sqrt(w*h) [1] or by (w*h) [2], or left unnormalized [0].
Images must be of the same size and both must be of type complex.

im.ProcessFFTraw(image: imImage, inverse: number, center: number, normalize: number) [in Lua 5]
void imProcessSwapQuadrants | ( | imImage * | image,
 |  | int | center2origin
 | ) |  |

Auxiliary function for the raw FFT.
This is the function used internally to change the lowest frequency position in the image.
If the image size has even dimensions the flag "center2origin" is useless. But if it is odd, you must specify if its from center to origin (usually used before inverse) or from origin to center (usually used after forward).
Notice that this function is used for images in the the frequency domain.
Image type must be complex.

im.ProcessSwapQuadrants(image: imImage, center2origin: number) [in Lua 5]


IM: Other Domain Transform Operations

Functions

Other Domain Transform Operations
[Image Processing]

Collaboration diagram for Other Domain Transform Operations:

Functions

int | imProcessHoughLines (const imImage *src_image, imImage *dst_image)
int | imProcessHoughLinesDraw (const imImage *src_image, const imImage *hough, const imImage *hough_points, imImage *dst_image)
void | imProcessCrossCorrelation (const imImage *src_image1, const imImage *src_image2, imImage *dst_image)
void | imProcessAutoCorrelation (const imImage *src_image, imImage *dst_image)
void | imProcessDistanceTransform (const imImage *src_image, imImage *dst_image)
void | imProcessRegionalMaximum (const imImage *src_image, imImage *dst_image)

Detailed Description

Hough, Distance.

See im_process_glo.h

Function Documentation

int imProcessHoughLines | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Hough Lines Transform.
It will detect white lines in a black background. So the source image must be a IM_BINARY image with the white lines of interest enhanced. The better the threshold with the white lines the better the line detection.
The destiny image must have IM_GRAY, IM_INT, hg_width=180, hg_height=2*rmax+1, where rmax is the image diagonal/2 (rmax = srqrt(width*width + height*height)).
The hough transform defines "cos(theta) * X + sin(theta) * Y = rho" and the parameters are in the interval:
theta = "0 .. 179", rho = "-hg_height/2 .. hg_height/2" .
Where rho is the perpendicular distance from the center of the image and theta the angle with the normal. So do not confuse theta with the line angle, they are perpendicular.
Returns zero if the counter aborted.
Inspired from ideas in XITE, Copyright 1991, Blab, UiO
http://www.ifi.uio.no/~blab/Software/Xite/

im.ProcessHoughLines(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5]
im.ProcessHoughLinesNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5]
int imProcessHoughLinesDraw | ( | const imImage * | src_image,
 |  | const imImage * | hough,
 |  | const imImage * | hough_points,
 |  | imImage * | dst_image
 | ) |  |

Draw detected hough lines.
The source image must be IM_GRAY and IM_BYTE. The destiny image can be a clone of the source image or it can be the source image for in place processing.
If the hough transform is not NULL, then the hough points are filtered to include only lines that are significally different from each other.
The hough image is the hough transform image, but it is optional and can be NULL. If not NULL then it will be used to filter lines that are very similar.
The hough points image is a hough transform image that was thresholded to a IM_BINARY image, usually using a Local Max threshold operation (see imProcessLocalMaxThreshold). Again the better the threshold the better the results.
The destiny image will be set to IM_MAP, and the detected lines will be drawn using a red color.
Returns the number of detected lines.

im.ProcessHoughLinesDraw(src_image: imImage, hough: imImage, hough_points: imImage, dst_image: imImage) -> lines: number [in Lua 5]
im.ProcessHoughLinesDrawNew(image: imImage, hough: imImage, hough_points: imImage) -> lines: number, new_image: imImage [in Lua 5]
void imProcessCrossCorrelation | ( | const imImage * | src_image1,
 |  | const imImage * | src_image2,
 |  | imImage * | dst_image
 | ) |  |

Calculates the Cross Correlation in the frequency domain.
CrossCorr(a,b) = IFFT(Conj(FFT(a))*FFT(b))
Images must be of the same size and only destiny image must be of type complex.

im.ProcessCrossCorrelation(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5]
im.ProcessCrossCorrelationNew(image1: imImage, image2: imImage) -> new_image: imImage [in Lua 5]
void imProcessAutoCorrelation | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Calculates the Auto Correlation in the frequency domain.
Uses the cross correlation. Images must be of the same size and only destiny image must be of type complex.

im.ProcessAutoCorrelation(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessAutoCorrelationNew(image: imImage) -> new_image: imImage [in Lua 5]
void imProcessDistanceTransform | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Calculates the Distance Transform of a binary image using an aproximation of the euclidian distance.
Each white pixel in the binary image is assigned a value equal to its distance from the nearest black pixel.
Uses a two-pass algorithm incrementally calculating the distance.
Source image must be IM_BINARY, destiny must be IM_FLOAT.

im.ProcessDistanceTransform(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessDistanceTransformNew(image: imImage) -> new_image: imImage [in Lua 5]
void imProcessRegionalMaximum | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Marks all the regional maximum of the distance transform.
source is IMGRAY/IM_FLOAT destiny in IM_BINARY.
We consider maximum all connected pixel values that have smaller pixel values around it.

im.ProcessRegionalMaximum(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessRegionalMaximumNew(image: imImage) -> new_image: imImage [in Lua 5]


IM: Special Effects

Functions

Special Effects
[Image Processing]

Collaboration diagram for Special Effects:

Functions

void | imProcessPixelate (const imImage *src_image, imImage *dst_image, int box_size)
void | imProcessPosterize (const imImage *src_image, imImage *dst_image, int level)

Detailed Description

Operations to change image appearance.
See im_process_pon.h

Function Documentation

void imProcessPixelate | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | box_size
 | ) |  |

Generates a zoom in effect averaging colors inside a square region.
Operates only on IM_BYTE images.

im.ProcessPixelate(src_image: imImage, dst_image: imImage, box_size: number) [in Lua 5]
im.ProcessPixelateNew(src_image: imImage, box_size: number) -> new_image: imImage [in Lua 5]
void imProcessPosterize | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | level
 | ) |  |

A simple Posterize effect. It reduces the number of colors in the image eliminating less significant bit planes. Can have 1 to 7 levels. See imProcessBitMask.
Images must have data type IM_BYTE.

im.ProcessPosterize(src_image: imImage, dst_image: imImage, level: number) [in Lua 5]
im.ProcessPosterizeNew(src_image: imImage, level: number) -> new_image: imImage [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Image Statistics Calculations

Image Statistics Calculations
[Image Processing]

Collaboration diagram for Image Statistics Calculations:

Data Structures

struct | _imStats

Typedefs

typedef struct _imStats | imStats

Functions

float | imCalcRMSError (const imImage *image1, const imImage *image2)
float | imCalcSNR (const imImage *src_image, const imImage *noise_image)
unsigned long | imCalcCountColors (const imImage *image)
void | imCalcHistogram (const unsigned char *data, int count, unsigned long *histo, int cumulative)
void | imCalcUShortHistogram (const unsigned short *data, int count, unsigned long *histo, int cumulative)
void | imCalcGrayHistogram (const imImage *image, unsigned long *histo, int cumulative)
void | imCalcImageStatistics (const imImage *image, imStats *stats)
void | imCalcHistogramStatistics (const imImage *image, imStats *stats)
void | imCalcHistoImageStatistics (const imImage *image, int *median, int *mode)

Detailed Description

Operations to calculate some statistics over images.
See im_process_ana.h

Typedef Documentation

typedef struct _imStats imStats

Numerical Statistics Structure

Function Documentation

float imCalcRMSError | ( | const imImage * | image1,
 |  | const imImage * | image2
 | ) |  |

Calculates the RMS error between two images (Root Mean Square Error).

im.CalcRMSError(image1: imImage, image2: imImage) -> rms: number [in Lua 5]
float imCalcSNR | ( | const imImage * | src_image,
 |  | const imImage * | noise_image
 | ) |  |

Calculates the SNR of an image and its noise (Signal Noise Ratio).

im.CalcSNR(src_image: imImage, noise_image: imImage) -> snr: number [in Lua 5]
unsigned long imCalcCountColors ( const imImage * image )

Count the number of different colors in an image.
Image must be IM_BYTE, but all color spaces except IM_CMYK.

im.CalcCountColors(image: imImage) -> count: number [in Lua 5]
void imCalcHistogram | ( | const unsigned char * | data,
 |  | int | count,
 |  | unsigned long * | histo,
 |  | int | cumulative
 | ) |  |

Calculates the histogram of a IM_BYTE data.
Histogram is always 256 positions long.
When cumulative is different from zero it calculates the cumulative histogram.

im.CalcHistogram(image: imImage, plane: number, cumulative: boolean) -> histo: table of numbers [in Lua 5]

Where plane is the depth plane to calculate the histogram.
The returned table is zero indexed. image can be IM_USHORT or IM_BYTE.

void imCalcUShortHistogram | ( | const unsigned short * | data,
 |  | int | count,
 |  | unsigned long * | histo,
 |  | int | cumulative
 | ) |  |

Calculates the histogram of a IM_USHORT data.
Histogram is always 65535 positions long.
When cumulative is different from zero it calculates the cumulative histogram.
Use imCalcHistogram in Lua.

void imCalcGrayHistogram | ( | const imImage * | image,
 |  | unsigned long * | histo,
 |  | int | cumulative
 | ) |  |

Calculates the gray histogram of an image.
Image must be IM_BYTE/(IM_RGB, IM_GRAY, IM_BINARY or IM_MAP).
If the image is IM_RGB then the histogram of the luma component is calculated.
Histogram is always 256 positions long.
When cumulative is different from zero it calculates the cumulative histogram.

im.CalcGrayHistogram(image: imImage, cumulative: boolean) -> histo: table of numbers [in Lua 5]
void imCalcImageStatistics | ( | const imImage * | image,
 |  | imStats * | stats
 | ) |  |

Calculates the statistics about the image data.
There is one stats for each depth plane. For ex: stats[0]=red stats, stats[0]=green stats, ...
Supports all data types except IM_CFLOAT.

im.CalcImageStatistics(image: imImage) -> stats: table [in Lua 5]

Table contains the following fields: max, min, positive, negative, zeros, mean, stddev. The same as the imStats structure.

void imCalcHistogramStatistics | ( | const imImage * | image,
 |  | imStats * | stats
 | ) |  |

Calculates the statistics about the image histogram data.
There is one stats for each depth plane. For ex: stats[0]=red stats, stats[0]=green stats, ...
Only IM_BYTE images are supported.

im.CalcHistogramStatistics(image: imImage) -> stats: table [in Lua 5]
void imCalcHistoImageStatistics | ( | const imImage * | image,
 |  | int * | median,
 |  | int * | mode
 | ) |  |

Calculates some extra statistics about the image histogram data.
There is one stats for each depth plane.
Only IM_BYTE images are supported.
mode will be -1 if more than one max is found.

im.CalcHistoImageStatistics(image: imImage) -> median: number, mode: number [in Lua 5]


IM: Image Analysis

Functions

Image Analysis
[Image Processing]

Collaboration diagram for Image Analysis:

Functions

int | imAnalyzeFindRegions (const imImage *src_image, imImage *dst_image, int connect, int touch_border)
void | imAnalyzeMeasureArea (const imImage *image, int *area, int region_count)
void | imAnalyzeMeasurePerimArea (const imImage *image, float *perimarea)
void | imAnalyzeMeasureCentroid (const imImage *image, const int *area, int region_count, float *cx, float *cy)
void | imAnalyzeMeasurePrincipalAxis (const imImage *image, const int *area, const float *cx, const float *cy, const int region_count, float *major_slope, float *major_length, float *minor_slope, float *minor_length)
void | imAnalyzeMeasureHoles (const imImage *image, int connect, int *holes_count, int *area, float *perim)
void | imAnalyzeMeasurePerimeter (const imImage *image, float *perim, int region_count)
void | imProcessPerimeterLine (const imImage *src_image, imImage *dst_image)
void | imProcessRemoveByArea (const imImage *src_image, imImage *dst_image, int connect, int start_size, int end_size, int inside)
void | imProcessFillHoles (const imImage *src_image, imImage *dst_image, int connect)

Detailed Description

See im_process_ana.h

Function Documentation

int imAnalyzeFindRegions | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | connect,
 |  | int | touch_border
 | ) |  |

Find white regions in binary image.
Result is IM_GRAY/IM_USHORT type. Regions can be 4 connected or 8 connected.
Returns the number of regions found. Background is marked as 0.
Regions touching the border are considered only if touch_border=1.

im.AnalyzeFindRegions(src_image: imImage, dst_image: imImage, connect: number, touch_border: boolean) -> count: number [in Lua 5]
im.AnalyzeFindRegionsNew(image: imImage, connect: number, touch_border: boolean) -> count: number, new_image: imImage [in Lua 5]
void imAnalyzeMeasureArea | ( | const imImage * | image,
 |  | int * | area,
 |  | int | region_count
 | ) |  |

Measure the actual area of all regions. Holes are not included.
This is the number of pixels of each region.
Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions).
area has size the number of regions.

im.AnalyzeMeasureArea(image: imImage, [region_count: number]) -> area: table of numbers [in Lua 5]

The returned table is zero indexed.

void imAnalyzeMeasurePerimArea | ( | const imImage * | image,
 |  | float * | perimarea
 | ) |  |

Measure the polygonal area limited by the perimeter line of all regions. Holes are not included.
Notice that some regions may have polygonal area zero.
Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions).
perimarea has size the number of regions.

im.AnalyzeMeasurePerimArea(image: imImage, [region_count: number]) -> perimarea: table of numbers [in Lua 5]

The returned table is zero indexed.

void imAnalyzeMeasureCentroid | ( | const imImage * | image,
 |  | const int * | area,
 |  | int | region_count,
 |  | float * | cx,
 |  | float * | cy
 | ) |  |

Calculate the centroid position of all regions. Holes are not included.
Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions).
area, cx and cy have size the number of regions. If area is NULL will be internally calculated.

im.AnalyzeMeasureCentroid(image: imImage, [area: table of numbers], [region_count: number]) -> cx: table of numbers, cy: table of numbers [in Lua 5]

The returned tables are zero indexed.

void imAnalyzeMeasurePrincipalAxis | ( | const imImage * | image,
 |  | const int * | area,
 |  | const float * | cx,
 |  | const float * | cy,
 |  | const int | region_count,
 |  | float * | major_slope,
 |  | float * | major_length,
 |  | float * | minor_slope,
 |  | float * | minor_length
 | ) |  |

Calculate the principal major axis slope of all regions.
Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions).
data has size the number of regions. If area or centroid are NULL will be internally calculated.
Principal (major and minor) axes are defined to be those axes that pass through the centroid, about which the moment of inertia of the region is, respectively maximal or minimal.

im.AnalyzeMeasurePrincipalAxis(image: imImage, [area: table of numbers], [cx: table of numbers], [cy: table of numbers], [region_count: number])
                              -> major_slope: table of numbers, major_length: table of numbers, minor_slope: table of numbers, minor_length: table of numbers [in Lua 5]

The returned tables are zero indexed.

void imAnalyzeMeasureHoles | ( | const imImage * | image,
 |  | int | connect,
 |  | int * | holes_count,
 |  | int * | area,
 |  | float * | perim
 | ) |  |

Measure the number and area of holes of all regions.
Source image is IM_USHORT type (the result of imAnalyzeFindRegions).
area and perim has size the number of regions, if some is NULL it will be not calculated.

im.AnalyzeMeasureHoles(image: imImage, connect: number, [region_count: number]) -> holes_count: number, area: table of numbers, perim: table of numbers [in Lua 5]

The returned tables are zero indexed.

void imAnalyzeMeasurePerimeter | ( | const imImage * | image,
 |  | float * | perim,
 |  | int | region_count
 | ) |  |

Measure the total perimeter of all regions (external and internal).
Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions).
It uses a half-pixel inter distance for 8 neighboors in a perimeter of a 4 connected region.
This function can also be used to measure line lenght.
perim has size the number of regions.

im.AnalyzeMeasurePerimeter(image: imImage) -> perim: table of numbers [in Lua 5]
void imProcessPerimeterLine | ( | const imImage * | src_image,
 |  | imImage * | dst_image
 | ) |  |

Isolates the perimeter line of gray integer images. Background is defined as being black (0).
It just checks if at least one of the 4 connected neighboors is non zero. Image borders are extended with zeros.

im.ProcessPerimeterLine(src_image: imImage, dst_image: imImage) [in Lua 5]
im.ProcessPerimeterLineNew(image: imImage) -> new_image: imImage [in Lua 5]
void imProcessRemoveByArea | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | connect,
 |  | int | start_size,
 |  | int | end_size,
 |  | int | inside
 | ) |  |

Eliminates regions that have area size outside or inside the given interval.
Source and destiny are a binary images. Regions can be 4 connected or 8 connected.
Can be done in-place. end_size can be zero to indicate no upper limit or an area with width*height size.
When searching inside the region the limits are inclusive (<= size >=), when searching outside the limits are exclusive (> size <).

im.ProcessRemoveByArea(src_image: imImage, dst_image: imImage, connect: number, start_size: number, end_size: number, inside: boolean) [in Lua 5]
im.ProcessRemoveByAreaNew(image: imImage, connect: number, start_size: number, end_size: number, inside: boolean) -> new_image: imImage [in Lua 5]
void imProcessFillHoles | ( | const imImage * | src_image,
 |  | imImage * | dst_image,
 |  | int | connect
 | ) |  |

Fill holes inside white regions.
Source and destiny are a binary images. Regions can be 4 connected or 8 connected.
Can be done in-place.

im.ProcessFillHoles(src_image: imImage, dst_image: imImage, connect: number) [in Lua 5]
im.ProcessFillHolesNew(image: imImage, connect: number) -> new_image: imImage [in Lua 5]


IM: Module Index

Modules

Here is a list of all modules:
  • Image Capture
    • Windows Attributes Names
  • Image Representation
    • Raw Data Conversion Utilities
    • imImage
      • Image Conversion
    • Raw Data Utilities
    • Color Mode Utilities
  • Image Storage
    • File Format SDK
    • imImage Storage
    • File Formats
      • TIFF - Tagged Image File Format
      • JPEG - JPEG File Interchange Format
      • PNG - Portable Network Graphic Format
      • GIF - Graphics Interchange Format
      • BMP - Windows Device Independent Bitmap
      • RAS - Sun Raster File
      • LED - IUP image in LED
      • SGI - Silicon Graphics Image File Format
      • PCX - ZSoft Picture
      • TGA - Truevision Graphics Adapter File
      • PNM - Netpbm Portable Image Map
      • ICO - Windows Icon
      • KRN - IM Kernel File Format
      • AVI - Windows Audio-Video Interleaved RIFF
      • ECW - ECW JPEG 2000
      • JP2 - JPEG-2000 JP2 File Format
      • RAW - RAW File
      • WMV - Windows Media Video Format
  • Image Processing
    • Image Statistics Calculations
    • Image Analysis
    • Other Domain Transform Operations
    • Fourier Transform Operations
    • Image Resize
    • Geometric Operations
    • Morphology Operations for Gray Images
    • Morphology Operations for Binary Images
    • Rank Convolution Operations
    • Convolution Operations
      • Kernel Generators
    • Arithmetic Operations
    • Additional Image Quantization Operations
    • Histogram Based Operations
    • Color Processing Operations
    • Logical Arithmetic Operations
    • Synthetic Image Render
    • Tone Gamut Operations
    • Threshold Operations
    • Special Effects
  • Utilities
    • Binary File Access
    • Color Manipulation
      • HSI Color Coordinate System Conversions
    • Complex Numbers
    • Counter
    • Windows DIB
    • Library Management
    • Math Utilities
    • Palette Generators
    • String Utilities
    • Color Utilities
    • Data Type Utilities
    • Binary Data Utilities
    • Data Compression Utilities
    • ImLua 5 Binding Reference
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Utilities

Utilities

Collaboration diagram for Utilities:

Data Structures

class | imAttribTable
Attributes Table. More...
class | imAttribArray
Attributes Table. More...

Modules

Binary File Access
Color Manipulation
Complex Numbers
Counter
Windows DIB
Library Management
Math Utilities
Palette Generators
String Utilities
Color Utilities
Data Type Utilities
Binary Data Utilities
Data Compression Utilities
ImLua 5 Binding Reference

Defines

#define | IM_MIN(_a, _b) (_a < _b? _a: _b)
#define | IM_MAX(_a, _b) (_a > _b? _a: _b)

Detailed Description

See im_util.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Library Management

Library Management
[Utilities]

Collaboration diagram for Library Management:

Defines

#define | IM_AUTHOR "Antonio Scuri"
#define | IM_COPYRIGHT "Copyright (C) 1994-2010 Tecgraf, PUC-Rio."
#define | IM_VERSION "3.6"
#define | IM_VERSION_NUMBER 306000
#define | IM_VERSION_DATE "2010/01/26"
#define | IM_DESCRIPTION "Image Representation, Storage, Capture and Processing"
#define | IM_NAME "IM - An Imaging Toolkit"

Functions

const char * | imVersion (void)
const char * | imVersionDate (void)
int | imVersionNumber (void)

Detailed Description

Usefull definitions for about dialogs and for comparing the compiled version with the linked version of the library.
im._AUTHOR [in Lua 5]
im._COPYRIGHT [in Lua 5]
im._VERSION [in Lua 5]
im._VERSION_DATE [in Lua 5]
im._VERSION_NUMBER [in Lua 5]
im._DESCRIPTION [in Lua 5]
im._NAME [in Lua 5]
See im_lib.h

Function Documentation

const char* imVersion ( void )

Returns the library current version. Returns the definition IM_VERSION plus the bug fix number.

im.Version() -> version: string [in Lua 5]
const char* imVersionDate ( void )

Returns the library current version release date. Returns the definition IM_VERSION_DATE.

im.VersionDate() -> date: string [in Lua 5]
int imVersionNumber ( void )

Returns the library current version number. Returns the definition IM_VERSION_NUMBER plus the bug fix number.
Can be compared in run time with IM_VERSION_NUMBER to compare compiled and linked versions of the library.

im.VersionNumber() -> version: number [in Lua 5]


IM: ImLua 5 Binding Reference

Functions

ImLua 5 Binding Reference
[Utilities]

Collaboration diagram for ImLua 5 Binding Reference:

Functions

int | imlua_open (lua_State *L)
int | imlua_open_capture (lua_State *L)
int | imlua_open_process (lua_State *L)
int | imlua_open_fftw (lua_State *L)

Detailed Description

Binding for the Lua 5 scripting language.
Lua 5.1 Copyright (C) 1994-2005 Lua.org, PUC-Rio
R. Ierusalimschy, L. H. de Figueiredo & W. Celes
http://www.lua.org
See imlua.h

Function Documentation

int imlua_open ( lua_State * L )

Initializes the Lua binding of the main IM library.
Returns 1 (leaves the "im" table on the top of the stack). You must link the application with the "imlua51" library.

int imlua_open_capture ( lua_State * L )

Initializes the Lua binding of the capture library.
Returns 1 (leaves the "im" table on the top of the stack). You must link the application with the "imlua_capture51" library.

int imlua_open_process ( lua_State * L )

Initializes the Lua binding of the process library.
Returns 1 (leaves the "im" table on the top of the stack). You must link the application with the "imlua_process51" library.

int imlua_open_fftw ( lua_State * L )

Initializes the Lua binding of the fourier transform library.
Returns 1 (leaves the "im" table on the top of the stack). You must link the application with the "imlua_fftw51" library.

Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Color Utilities

Functions

Color Utilities
[Utilities]

Collaboration diagram for Color Utilities:

Functions

long | imColorEncode (unsigned char red, unsigned char green, unsigned char blue)
void | imColorDecode (unsigned char *red, unsigned char *green, unsigned char *blue, long color)

Detailed Description

See im_util.h

Function Documentation

long imColorEncode | ( | unsigned char | red,
 |  | unsigned char | green,
 |  | unsigned char | blue
 | ) |  |

Encode RGB components in a long for palete usage.
"long" definition is compatible with the CD library definition.

im.ColorEncode(red: number, green: number, blue: number) -> color: lightuserdata [in Lua 5]
void imColorDecode | ( | unsigned char * | red,
 |  | unsigned char * | green,
 |  | unsigned char * | blue,
 |  | long | color
 | ) |  |

Decode RGB components from a long for palete usage.
"long" definition is compatible with the CD library definition.

im.ColorDecode(color: lightuserdata) -> red: number, green: number, blue: number [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Color Manipulation

Color Manipulation
[Utilities]

Collaboration diagram for Color Manipulation:

Modules

HSI Color Coordinate System Conversions

Functions

float | imColorZero (int data_type)
int | imColorMax (int data_type)
template<class T >
T | imColorQuantize (const float &value, const T &max)
template<class T >
float | imColorReconstruct (const T &value, const T &max)
template<class T >
void | imColorYCbCr2RGB (const T Y, const T Cb, const T Cr, T &R, T &G, T &B, const T &zero, const T &max)
template<class T >
void | imColorRGB2YCbCr (const T R, const T G, const T B, T &Y, T &Cb, T &Cr, const T &zero)
template<class T >
void | imColorCMYK2RGB (const T C, const T M, const T Y, const T K, T &R, T &G, T &B, const T &max)
template<class T >
void | imColorXYZ2RGB (const T X, const T Y, const T Z, T &R, T &G, T &B, const T &max)
template<class T >
void | imColorRGB2XYZ (const T R, const T G, const T B, T &X, T &Y, T &Z)
void | imColorXYZ2Lab (const float X, const float Y, const float Z, float &L, float &a, float &b)
void | imColorLab2XYZ (const float L, const float a, const float b, float &X, float &Y, float &Z)
void | imColorXYZ2Luv (const float X, const float Y, const float Z, float &L, float &u, float &v)
void | imColorLuv2XYZ (const float L, const float u, const float v, float &X, float &Y, float &Z)
float | imColorTransfer2Linear (const float &nonlinear_value)
float | imColorTransfer2Nonlinear (const float &value)
void | imColorRGB2RGBNonlinear (const float RL, const float GL, const float BL, float &R, float &G, float &B)
template<class T >
T | imColorRGB2Luma (const T R, const T G, const T B)
float | imColorLuminance2Lightness (const float &Y)
float | imColorLightness2Luminance (const float &L)

Detailed Description

Functions to convert from one color space to another, and color gammut utilities.
See im_color.h

Some Color Science

Y is luminance, a linear-light quantity. It is directly proportional to physical intensity weighted by the spectral sensitivity of human vision.
L* is lightness, a nonlinear luminance that aproximates the perception of brightness. It is nearly perceptual uniform. It has a range of 0 to 100.
Y' is luma, a nonlinear luminance that aproximates lightness.
Brightness is a visual sensation according to which an area apears to exhibit more or less light. It is a subjective quantity and can not be measured.
One unit of euclidian distante in CIE L*u*v* or CIE L*a*b* corresponds roughly to a just-noticeable difference (JND) of color.
 ChromaUV = sqrt(u*u + v*v)
 HueUV = atan2(v, u)
 SaturationUV = ChromaUV / L      (called psychometric saturation)
 (the same can be calculated for Lab)
IEC 61966-2.1 Default RGB colour space - sRGB
  • ITU-R Recommendation BT.709 (D65 white point).
  • D65 White Point (X,Y,Z) = (0.9505 1.0000 1.0890)
Documentation extracted from Charles Poynton - Digital Video and HDTV - Morgan Kaufmann - 2003.

Links

  • www.color.org - ICC
  • www.srgb.com - sRGB
  • www.poynton.com - Charles Poynton
  • www.littlecms.com - A free Color Management System (use this if you need precise color conversions)

Color Component Intervals

All the color components are stored in the 0-max interval, even the signed ones.
Here are the pre-defined intervals for each data type. These values are used for standard color conversion. You should normalize data before converting betwwen color spaces.
 byte   [0,255]      or [-128,+127]          (1 byte)
 ushort [0,65535]    or [-32768,+32767]      (2 bytes)
 int    [0,16777215] or [-8388608,+8388607]  (3 bytes)
 float  [0,1]        or [-0.5,+0.5]          (4 bytes)

Function Documentation

float imColorZero ( int data_type ) [inline]

Returns the zero value for color conversion porpouses.
This is a value to be compensated when the data_type is unsigned and component is signed.

{
  float zero[] = {128.0f, 32768.0f, 8388608.0f, 0.5f};
  return zero[data_type];
}

int imColorMax ( int data_type ) [inline]

Returns the maximum value for color conversion porpouses.

{
  int max[] = {255, 65535, 16777215, 1};
  return max[data_type];
}

template<class T >
T imColorQuantize | ( | const float & | value,
 |  | const T & | max |
 | ) |  |  | [inline]

Quantize r=0-1 values into q=0-max. max is the maximum value. max and the returned value are usually integers, but the dummy quantizer uses real values. See also Math Utilities.

{
  if (max == 1) return (T)value; // to allow a dummy quantizer
  if (value >= 1) return max;
  if (value <= 0) return 0;
  /* return (T)imRound(value*(max + 1) - 0.5f);  not necessary since all values are positive */
  return (T)(value*(max + 1));
}

template<class T >
float imColorReconstruct | ( | const T & | value,
 |  | const T & | max |
 | ) |  |  | [inline]

Reconstruct 0-max values into 0-1.
max is the maximum value. max and the given value are usually integers, but the dummy reconstructor uses real values. See also Math Utilities.

{
  if (max == 1) return (float)value;  // to allow a dummy reconstructor
  if (value <= 0) return 0;
  if (value >= max) return 1;
  return (((float)value + 0.5f)/((float)max + 1.0f));
}

template<class T >
void imColorYCbCr2RGB | ( | const T | Y,
 |  | const T | Cb,
 |  | const T | Cr,
 |  | T & | R,
 |  | T & | G,
 |  | T & | B,
 |  | const T & | zero,
 |  | const T & | max |
 | ) |  |  | [inline]

Converts Y'CbCr to R'G'B' (all nonlinear).
ITU-R Recommendation 601-1 with no headroom/footroom.

 0 <= Y <= 1 ; -0.5 <= CbCr <= 0.5 ; 0 <= RGB <= 1

 R'= Y' + 0.000 *Cb + 1.402 *Cr
 G'= Y' - 0.344 *Cb - 0.714 *Cr
 B'= Y' + 1.772 *Cb + 0.000 *Cr

{
  float r = float(Y                        + 1.402f * (Cr - zero));
  float g = float(Y - 0.344f * (Cb - zero) - 0.714f * (Cr - zero));
  float b = float(Y + 1.772f * (Cb - zero));

  // now we should enforce 0<= rgb <= max

  R = (T)IM_CROPMAX(r, max);
  G = (T)IM_CROPMAX(g, max);
  B = (T)IM_CROPMAX(b, max);
}

template<class T >
void imColorRGB2YCbCr | ( | const T | R,
 |  | const T | G,
 |  | const T | B,
 |  | T & | Y,
 |  | T & | Cb,
 |  | T & | Cr,
 |  | const T & | zero |
 | ) |  |  | [inline]

Converts R'G'B' to Y'CbCr (all nonlinear).
ITU-R Recommendation 601-1 with no headroom/footroom.

 0 <= Y <= 1 ; -0.5 <= CbCr <= 0.5 ; 0 <= RGB <= 1

 Y' =  0.299 *R' + 0.587 *G' + 0.114 *B'
 Cb = -0.169 *R' - 0.331 *G' + 0.500 *B'
 Cr =  0.500 *R' - 0.419 *G' - 0.081 *B'

{
  Y  = (T)( 0.299f *R + 0.587f *G + 0.114f *B);
  Cb = (T)(-0.169f *R - 0.331f *G + 0.500f *B + (float)zero);
  Cr = (T)( 0.500f *R - 0.419f *G - 0.081f *B + (float)zero);

  // there is no need for cropping here, YCrCr is already at the limits
}

template<class T >
void imColorCMYK2RGB | ( | const T | C,
 |  | const T | M,
 |  | const T | Y,
 |  | const T | K,
 |  | T & | R,
 |  | T & | G,
 |  | T & | B,
 |  | const T & | max |
 | ) |  |  | [inline]

Converts C'M'Y'K' to R'G'B' (all nonlinear).
This is a poor conversion that works for a simple visualization.

  0 <= CMYK <= 1 ; 0 <= RGB <= 1

  R = (1 - K) * (1 - C)
  G = (1 - K) * (1 - M)
  B = (1 - K) * (1 - Y)

{
  T W = max - K;
  R = (T)((W * (max - C)) / max);
  G = (T)((W * (max - M)) / max);
  B = (T)((W * (max - Y)) / max);

  // there is no need for cropping here, RGB is already at the limits
}

template<class T >
void imColorXYZ2RGB | ( | const T | X,
 |  | const T | Y,
 |  | const T | Z,
 |  | T & | R,
 |  | T & | G,
 |  | T & | B,
 |  | const T & | max |
 | ) |  |  | [inline]

Converts CIE XYZ to Rec 709 RGB (all linear).
ITU-R Recommendation BT.709 (D65 white point).

  0 <= XYZ <= 1 ; 0 <= RGB <= 1

  R =  3.2406 *X - 1.5372 *Y - 0.4986 *Z
  G = -0.9689 *X + 1.8758 *Y + 0.0415 *Z
  B =  0.0557 *X - 0.2040 *Y + 1.0570 *Z

{
  float r =  3.2406f *X - 1.5372f *Y - 0.4986f *Z;
  float g = -0.9689f *X + 1.8758f *Y + 0.0415f *Z;
  float b =  0.0557f *X - 0.2040f *Y + 1.0570f *Z;

  // we need to crop because not all XYZ colors are visible

  R = (T)IM_CROPMAX(r, max);
  G = (T)IM_CROPMAX(g, max);
  B = (T)IM_CROPMAX(b, max);
}

template<class T >
void imColorRGB2XYZ | ( | const T | R,
 |  | const T | G,
 |  | const T | B,
 |  | T & | X,
 |  | T & | Y,
 |  | T & | Z |
 | ) |  |  | [inline]

Converts Rec 709 RGB to CIE XYZ (all linear).
ITU-R Recommendation BT.709 (D65 white point).

  0 <= XYZ <= 1 ; 0 <= RGB <= 1

  X = 0.4124 *R + 0.3576 *G + 0.1805 *B
  Y = 0.2126 *R + 0.7152 *G + 0.0722 *B
  Z = 0.0193 *R + 0.1192 *G + 0.9505 *B

{
  X = (T)(0.4124f *R + 0.3576f *G + 0.1805f *B);
  Y = (T)(0.2126f *R + 0.7152f *G + 0.0722f *B);
  Z = (T)(0.0193f *R + 0.1192f *G + 0.9505f *B);

  // there is no need for cropping here, XYZ is already at the limits
}

void imColorXYZ2Lab | ( | const float | X,
 |  | const float | Y,
 |  | const float | Z,
 |  | float & | L,
 |  | float & | a,
 |  | float & | b |
 | ) |  |  | [inline]

Converts CIE XYZ (linear) to CIE L*a*b* (nonlinear).
The white point is D65.

  0 <= L <= 1 ; -0.5 <= ab <= +0.5 ; 0 <= XYZ <= 1

  if (t > 0.008856)
    f(t) = pow(t, 1/3)
  else
    f(t) = 7.787*t + 16/116

  fX = f(X / Xn)      fY = f(Y / Yn)      fZ = f(Z / Zn)

  L = 1.16 * fY - 0.16
  a = 2.5 * (fX - fY)
  b = (fY - fZ)

{
  float fX = X / 0.9505f;  // white point D65
  float fY = Y / 1.0f;
  float fZ = Z / 1.0890f;

  fX = IM_FWLAB(fX);
  fY = IM_FWLAB(fY);
  fZ = IM_FWLAB(fZ);

  L = 1.16f * fY - 0.16f;
  a = 2.5f * (fX - fY);
  b = (fY - fZ);
}

void imColorLab2XYZ | ( | const float | L,
 |  | const float | a,
 |  | const float | b,
 |  | float & | X,
 |  | float & | Y,
 |  | float & | Z |
 | ) |  |  | [inline]

Converts CIE L*a*b* (nonlinear) to CIE XYZ (linear).
The white point is D65.
0 <= L <= 1 ; -0.5 <= ab <= +0.5 ; 0 <= XYZ <= 1

{
  float fY = (L + 0.16f) / 1.16f;
  float gY = IM_GWLAB(fY);

  float fgY = IM_FWLAB(gY);
  float gX = fgY + a / 2.5f;
  float gZ = fgY - b;
  gX = IM_GWLAB(gX);
  gZ = IM_GWLAB(gZ);

  X = gX * 0.9505f;     // white point D65
  Y = gY * 1.0f;
  Z = gZ * 1.0890f;
}

void imColorXYZ2Luv | ( | const float | X,
 |  | const float | Y,
 |  | const float | Z,
 |  | float & | L,
 |  | float & | u,
 |  | float & | v |
 | ) |  |  | [inline]

Converts CIE XYZ (linear) to CIE L*u*v* (nonlinear).
The white point is D65.

  0 <= L <= 1 ; -1 <= uv <= +1 ; 0 <= XYZ <= 1

  Y = Y / 1.0      (for D65)
  if (Y > 0.008856)
    fY = pow(Y, 1/3)
  else
    fY = 7.787 * Y + 0.16/1.16
  L = 1.16 * fY - 0.16

  U(x, y, z) = (4 * x)/(x + 15 * y + 3 * z)
  V(x, y, z) = (9 * x)/(x + 15 * y + 3 * z)
  un = U(Xn, Yn, Zn) = 0.1978      (for D65)
  vn = V(Xn, Yn, Zn) = 0.4683      (for D65)
  fu = U(X, Y, Z)
  fv = V(X, Y, Z)

  u = 13 * L * (fu - un)
  v = 13 * L * (fv - vn)

{
  float XYZ = (float)(X + 15 * Y + 3 * Z);
  float fY = Y / 1.0f;

  if (XYZ != 0)
  {
    L = 1.16f * IM_FWLAB(fY) - 0.16f;
    u = 6.5f * L * ((4 * X)/XYZ - 0.1978f);
    v = 6.5f * L * ((9 * Y)/XYZ - 0.4683f);
  }
  else
  {
    L = u = v = 0;
  }
}

void imColorLuv2XYZ | ( | const float | L,
 |  | const float | u,
 |  | const float | v,
 |  | float & | X,
 |  | float & | Y,
 |  | float & | Z |
 | ) |  |  | [inline]

Converts CIE L*u*v* (nonlinear) to CIE XYZ (linear).
The white point is D65. 0 <= L <= 1 ; -0.5 <= uv <= +0.5 ; 0 <= XYZ <= 1

{
  float fY = (L + 0.16f) / 1.16f;
  Y = IM_GWLAB(fY) * 1.0f;

  float ul = 0.1978f, vl = 0.4683f;
  if (L != 0)
  {
    ul = u / (6.5f * L) + 0.1978f;
    vl = v / (6.5f * L) + 0.4683f;
  }

  X = ((9 * ul) / (4 * vl)) * Y;
  Z = ((12 - 3 * ul - 20 * vl) / (4 * vl)) * Y;
}

float imColorTransfer2Linear ( const float & nonlinear_value ) [inline]

Converts nonlinear values to linear values.
We use the sRGB transfer function. sRGB uses ITU-R 709 primaries and D65 white point.

  0 <= l <= 1 ; 0 <= v <= 1

  if (v < 0.03928)
    l = v / 12.92
  else
    l = pow((v + 0.055) / 1.055, 2.4)

{
  if (nonlinear_value < 0.03928f)
    return nonlinear_value / 12.92f;
  else
    return powf((nonlinear_value + 0.055f) / 1.055f, 2.4f);
}

float imColorTransfer2Nonlinear ( const float & value ) [inline]

Converts linear values to nonlinear values.
We use the sRGB transfer function. sRGB uses ITU-R 709 primaries and D65 white point.

  0 <= l <= 1 ; 0 <= v <= 1

  if (l < 0.0031308)
    v = 12.92 * l
  else
    v = 1.055 * pow(l, 1/2.4) - 0.055

Referenced by imColorRGB2RGBNonlinear().

{
  if (value < 0.0031308f)
    return 12.92f * value;
  else
    return 1.055f * powf(value, 1.0f/2.4f) - 0.055f;
}

void imColorRGB2RGBNonlinear | ( | const float | RL,
 |  | const float | GL,
 |  | const float | BL,
 |  | float & | R,
 |  | float & | G,
 |  | float & | B |
 | ) |  |  | [inline]

Converts RGB (linear) to R'G'B' (nonlinear).

References imColorTransfer2Nonlinear().

{
  R = imColorTransfer2Nonlinear(RL);
  G = imColorTransfer2Nonlinear(GL);
  B = imColorTransfer2Nonlinear(BL);
}

template<class T >
T imColorRGB2Luma | ( | const T | R,
 |  | const T | G,
 |  | const T | B |
 | ) |  |  | [inline]

Converts R'G'B' to Y' (all nonlinear).

 Y'  =  0.299 *R' + 0.587 *G' + 0.114 *B'

{
  return (T)((299 * R + 587 * G + 114 * B) / 1000);
}

float imColorLuminance2Lightness ( const float & Y ) [inline]

Converts Luminance (CIE Y) to Lightness (CIE L*) (all linear).
The white point is D65.

  0 <= Y <= 1 ; 0 <= L* <= 1

  Y = Y / 1.0      (for D65)
  if (Y > 0.008856)
    fY = pow(Y, 1/3)
  else
    fY = 7.787 * Y + 0.16/1.16
  L = 1.16 * fY - 0.16

{
  return 1.16f * IM_FWLAB(Y) - 0.16f;
}

float imColorLightness2Luminance ( const float & L ) [inline]

Converts Lightness (CIE L*) to Luminance (CIE Y) (all linear).
The white point is D65.

  0 <= Y <= 1 ; 0 <= L* <= 1

  fY = (L + 0.16)/1.16
  if (fY > 0.20689)
    Y = pow(fY, 3)
  else
    Y = 0.1284 * (fY - 0.16/1.16)
  Y = Y * 1.0      (for D65)

{
  float fY = (L + 0.16f) / 1.16f;
  return IM_GWLAB(fY);
}


IM: HSI Color Coordinate System Conversions

Functions

HSI Color Coordinate System Conversions
[Color Manipulation]

Collaboration diagram for HSI Color Coordinate System Conversions:

Functions

float | imColorHSI_ImaxS (float h, double cosh, double sinh)
void | imColorRGB2HSI (float r, float g, float b, float *h, float *s, float *i)
void | imColorRGB2HSIbyte (unsigned char r, unsigned char g, unsigned char b, float *h, float *s, float *i)
void | imColorHSI2RGB (float h, float s, float i, float *r, float *g, float *b)
void | imColorHSI2RGBbyte (float h, float s, float i, unsigned char *r, unsigned char *g, unsigned char *b)

Detailed Description

HSI is just the RGB color space written in a different coordinate system.
"I" is defined along the cube diagonal. It ranges from 0 (black) to 1 (white).
HS are the polar coordinates of a plane normal to "I".
"S" is the normal distance from the diagonal of the RGB cube. It ranges from 0 to 1.
"H" is the angle starting from the red vector, given in degrees.
This is not a new color space, this is exactly the same gammut as RGB.
See im_colorhsi.h

Function Documentation

float imColorHSI_ImaxS | ( | float | h,
 |  | double | cosh,
 |  | double | sinh
 | ) |  |

Returns I where S is maximum given H (here in radians).

void imColorRGB2HSI | ( | float | r,
 |  | float | g,
 |  | float | b,
 |  | float * | h,
 |  | float * | s,
 |  | float * | i
 | ) |  |

Converts from RGB to HSI.

void imColorRGB2HSIbyte | ( | unsigned char | r,
 |  | unsigned char | g,
 |  | unsigned char | b,
 |  | float * | h,
 |  | float * | s,
 |  | float * | i
 | ) |  |

Converts from RGB (byte) to HSI.

void imColorHSI2RGB | ( | float | h,
 |  | float | s,
 |  | float | i,
 |  | float * | r,
 |  | float * | g,
 |  | float * | b
 | ) |  |

Converts from HSI to RGB.

void imColorHSI2RGBbyte | ( | float | h,
 |  | float | s,
 |  | float | i,
 |  | unsigned char * | r,
 |  | unsigned char * | g,
 |  | unsigned char * | b
 | ) |  |

Converts from HSI to RGB (byte).


IM: Palette Generators

Functions

Palette Generators
[Utilities]

Collaboration diagram for Palette Generators:

Functions

int | imPaletteFindNearest (const long *palette, int palette_count, long color)
int | imPaletteFindColor (const long *palette, int palette_count, long color, unsigned char tol)
long * | imPaletteGray (void)
long * | imPaletteRed (void)
long * | imPaletteGreen (void)
long * | imPaletteBlue (void)
long * | imPaletteYellow (void)
long * | imPaletteMagenta (void)
long * | imPaletteCian (void)
long * | imPaletteRainbow (void)
long * | imPaletteHues (void)
long * | imPaletteBlueIce (void)
long * | imPaletteHotIron (void)
long * | imPaletteBlackBody (void)
long * | imPaletteHighContrast (void)
long * | imPaletteUniform (void)
int | imPaletteUniformIndex (long color)
int | imPaletteUniformIndexHalftoned (long color, int x, int y)

Detailed Description

Creates several standard palettes. The palette is just an array of encoded color values. See also Color Utilities.
In Lua, to create a palette you can call im.PaletteCreate.
im.PaletteCreate([count: number]) -> pal: imPalette [in Lua 5]
Default count is 256. IMLua and CDLua palettes are 100% compatible. The IM palette metatable name is "imPalette".
When converted to a string will return "imPalete(%p)" where p is replaced by the userdata address. If the palette is already destroyed by im.PaletteDestroy, then it will return also the suffix "-destroyed".
In Lua, to destroy a palette you can call im.PaletteDestroy. If this function is not called, the palette is destroyed by the garbage collector.
im.PaletteDestroy(pal: imPalette) [in Lua 5]
In Lua, array access is enabled so you can do:.
color = pal[index]
pal[index] = color
count = #pal
See im_palette.h

Function Documentation

int imPaletteFindNearest | ( | const long * | palette,
 |  | int | palette_count,
 |  | long | color
 | ) |  |

Searches for the nearest color on the table and returns the color index if successful. It looks in all palette entries and finds the minimum euclidian square distance. If the color matches the given color it returns immediately. See also Color Utilities.

im.PaletteFindNearest(pal: imPalette, color: lightuserdata) -> index: number [in Lua 5]
int imPaletteFindColor | ( | const long * | palette,
 |  | int | palette_count,
 |  | long | color,
 |  | unsigned char | tol
 | ) |  |

Searches for the color on the table and returns the color index if successful. If the tolerance is 0 search for the exact match in the palette else search for the first color that fits in the tolerance range. See also Color Utilities.

im.PaletteFindColor(pal: imPalette, color: lightuserdata, tol: number) -> index: number [in Lua 5]
long* imPaletteGray ( void )

Creates a palette of gray scale values. The colors are arranged from black to white.

im.PaletteGray() -> pal: imPalette [in Lua 5]
long* imPaletteRed ( void )

Creates a palette of a gradient of red colors. The colors are arranged from black to pure red.

im.PaletteRed() -> pal: imPalette [in Lua 5]
long* imPaletteGreen ( void )

Creates a palette of a gradient of green colors. The colors are arranged from black to pure green.

im.PaletteGreen() -> pal: imPalette [in Lua 5]
long* imPaletteBlue ( void )

Creates a palette of a gradient of blue colors. The colors are arranged from black to pure blue.

im.PaletteBlue() -> pal: imPalette [in Lua 5]
long* imPaletteYellow ( void )

Creates a palette of a gradient of yellow colors. The colors are arranged from black to pure yellow.

im.PaletteYellow() -> pal: imPalette [in Lua 5]
long* imPaletteMagenta ( void )

Creates a palette of a gradient of magenta colors. The colors are arranged from black to pure magenta.

im.PaletteMagenta() -> pal: imPalette [in Lua 5]
long* imPaletteCian ( void )

Creates a palette of a gradient of cian colors. The colors are arranged from black to pure cian.

im.PaletteCian() -> pal: imPalette [in Lua 5]
long* imPaletteRainbow ( void )

Creates a palette of rainbow colors. The colors are arranged in the light wave length spectrum order (starting from purple).

im.PaletteRainbow() -> pal: imPalette [in Lua 5]
long* imPaletteHues ( void )

Creates a palette of hues with maximum saturation.

im.PaletteHues() -> pal: imPalette [in Lua 5]
long* imPaletteBlueIce ( void )

Creates a palette of a gradient of blue colors. The colors are arranged from pure blue to white.

im.PaletteBlueIce() -> pal: imPalette [in Lua 5]
long* imPaletteHotIron ( void )

Creates a palette of a gradient from black to white passing trough red and orange.

im.PaletteHotIron() -> pal: imPalette [in Lua 5]
long* imPaletteBlackBody ( void )

Creates a palette of a gradient from black to white passing trough red and yellow.

im.PaletteBlackBody() -> pal: imPalette [in Lua 5]
long* imPaletteHighContrast ( void )

Creates a palette with high contrast colors.

im.PaletteHighContrast() -> pal: imPalette [in Lua 5]
long* imPaletteUniform ( void )

Creates a palette of an uniform range of colors from black to white. This is a 2^(2.6) bits per pixel palette.

im.PaletteUniform() -> pal: imPalette [in Lua 5]
int imPaletteUniformIndex ( long color )

Returns the index of the correspondent RGB color of an uniform palette.

im.PaletteUniformIndex(color: lightuserdata) -> index: number [in Lua 5]
int imPaletteUniformIndexHalftoned | ( | long | color,
 |  | int | x,
 |  | int | y
 | ) |  |

Returns the index of the correspondent RGB color of an uniform palette. Uses an 8x8 ordered dither to lookup the index in a halftone matrix. The spatial position used by the halftone method.

im.PaletteUniformIndexHalftoned(color: lightuserdata, x: number, y: number) -> index: number [in Lua 5]


IM: Binary Data Utilities

Binary Data Utilities
[Utilities]

Collaboration diagram for Binary Data Utilities:

Enumerations

enum | imByteOrder { IM_LITTLEENDIAN, IM_BIGENDIAN }

Functions

int | imBinCPUByteOrder (void)
void | imBinSwapBytes (void *data, int count, int size)
void | imBinSwapBytes2 (void *data, int count)
void | imBinSwapBytes4 (void *data, int count)
void | imBinSwapBytes8 (void *data, int count)

Detailed Description

See im_util.h

Enumeration Type Documentation

enum imByteOrder

CPU Byte Orders.

Enumerator:
IM_LITTLEENDIAN

Little Endian - The most significant byte is on the right end of a word. Used by Intel processors.

IM_BIGENDIAN

Big Endian - The most significant byte is on the left end of a word. Used by Motorola processors, also is the network standard byte order.

{
  IM_LITTLEENDIAN, /**< Little Endian - The most significant byte is on the right end of a word. Used by Intel processors. */
  IM_BIGENDIAN     /**< Big Endian - The most significant byte is on the left end of a word. Used by Motorola processors, also is the network standard byte order. */
};

Function Documentation

int imBinCPUByteOrder ( void )

Returns the current CPU byte order.

void imBinSwapBytes | ( | void * | data,
 |  | int | count,
 |  | int | size
 | ) |  |

Changes the byte order of an array of 2, 4 or 8 byte values.

void imBinSwapBytes2 | ( | void * | data,
 |  | int | count
 | ) |  |

Changes the byte order of an array of 2 byte values.

void imBinSwapBytes4 | ( | void * | data,
 |  | int | count
 | ) |  |

Inverts the byte order of the 4 byte values

void imBinSwapBytes8 | ( | void * | data,
 |  | int | count
 | ) |  |

Inverts the byte order of the 8 byte values

Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Complex Numbers

Complex Numbers
[Utilities]

Collaboration diagram for Complex Numbers:

Data Structures

class | imcfloat
Complex Float Data Type. More...

Functions

int | operator<= (const imcfloat &C1, const imcfloat &C2)
int | operator<= (const imcfloat &C, const float &F)
int | operator< (const imcfloat &C1, const imcfloat &C2)
int | operator< (const imcfloat &C, const float &F)
int | operator> (const imcfloat &C1, const imcfloat &C2)
int | operator> (const imcfloat &C, const float &F)
imcfloat | operator+ (const imcfloat &C1, const imcfloat &C2)
imcfloat | operator+= (const imcfloat &C1, const imcfloat &C2)
imcfloat | operator- (const imcfloat &C1, const imcfloat &C2)
imcfloat | operator* (const imcfloat &C1, const imcfloat &C2)
imcfloat | operator/ (const imcfloat &C1, const imcfloat &C2)
imcfloat | operator/ (const imcfloat &C, const float &R)
imcfloat | operator/= (const imcfloat &C, const float &R)
imcfloat | operator* (const imcfloat &C, const float &R)
int | operator== (const imcfloat &C1, const imcfloat &C2)
float | cpxreal (const imcfloat &C)
float | cpximag (const imcfloat &C)
float | cpxmag (const imcfloat &C)
float | cpxphase (const imcfloat &C)
imcfloat | cpxconj (const imcfloat &C)
imcfloat | log (const imcfloat &C)
imcfloat | exp (const imcfloat &C)
imcfloat | pow (const imcfloat &C1, const imcfloat &C2)
imcfloat | sqrt (const imcfloat &C)
imcfloat | cpxpolar (const float &mag, const float &phase)

Detailed Description

See im_complex.h

Complex numbers operators.


IM: Data Type Utilities

Data Type Utilities
[Utilities]

Collaboration diagram for Data Type Utilities:

Defines

#define | IM_BYTECROP(_v) (_v < 0? 0: _v > 255? 255: _v)
#define | IM_CROPMAX(_v, _max) (_v < 0? 0: _v > _max? _max: _v)

Typedefs

typedef unsigned char | imbyte
typedef unsigned short | imushort

Functions

int | imDataTypeSize (int data_type)
const char * | imDataTypeName (int data_type)
unsigned long | imDataTypeIntMax (int data_type)
long | imDataTypeIntMin (int data_type)

Detailed Description

See im_util.h

Function Documentation

int imDataTypeSize ( int data_type )

Returns the size in bytes of a specified numeric data type.

im.DataTypeSize(data_type: number) -> size: number [in Lua 5]
const char* imDataTypeName ( int data_type )

Returns the numeric data type name given its identifier.

im.DataTypeName(data_type: number) -> name: string [in Lua 5]
unsigned long imDataTypeIntMax ( int data_type )

Returns the maximum value of an integer data type. For floating point returns 0.

im.DataTypeIntMax(data_type: number) -> int_max: number [in Lua 5]
long imDataTypeIntMin ( int data_type )

Returns the minimum value of an integer data type. For floating point returns 0.

im.DataTypeIntMin(data_type: number) -> int_min: number [in Lua 5]
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Math Utilities

Functions

Math Utilities
[Utilities]

Collaboration diagram for Math Utilities:

Functions

int | imRound (float x)
int | imResample (int x, float factor)
template<class T , class TU >
T | imZeroOrderDecimation (int width, int height, T *map, float xl, float yl, float box_width, float box_height, TU Dummy)
template<class T , class TU >
T | imBilinearDecimation (int width, int height, T *map, float xl, float yl, float box_width, float box_height, TU Dummy)
template<class T >
T | imZeroOrderInterpolation (int width, int height, T *map, float xl, float yl)
template<class T >
T | imBilinearInterpolation (int width, int height, T *map, float xl, float yl)
template<class T , class TU >
T | imBicubicInterpolation (int width, int height, T *map, float xl, float yl, TU Dummy)
template<class T >
void | imMinMax (const T *map, int count, T &min, T &max)

Detailed Description

When converting between continuous and discrete use:
Continuous = Discrete + 0.5 [Reconstruction/Interpolation]
Discrete = Round(Continuous - 0.5) [Sampling/Quantization]
Notice that must check 0-max limits when converting from Continuous to Discrete.
When converting between discrete and discrete use:
integer src_size, dst_len, src_i, dst_i
real factor = (real)(dst_size)/(real)(src_size)
dst_i = Round(factor*(src_i + 0.5) - 0.5)
See im_math.h

Function Documentation

int imRound ( float x ) [inline]

Round a real to the nearest integer.

Referenced by imZeroOrderInterpolation().

{
  return (int)(x < 0? x-0.5f: x+0.5f);
}

int imResample | ( | int | x,
 |  | float | factor |
 | ) |  |  | [inline]

Converts between two discrete grids. factor is "dst_size/src_size".

{
  float xr = factor*(x + 0.5f) - 0.5f;
  return (int)(xr < 0? xr-0.5f: xr+0.5f);  /* Round */
}

template<class T , class TU >
T imZeroOrderDecimation | ( | int | width,
 |  | int | height,
 |  | T * | map,
 |  | float | xl,
 |  | float | yl,
 |  | float | box_width,
 |  | float | box_height,
 |  | TU | Dummy |
 | ) |  |  | [inline]

Does Zero Order Decimation (Mean).

{
  int x0,x1,y0,y1;
  (void)Dummy;

  x0 = (int)floor(xl - box_width/2.0 - 0.5) + 1;
  y0 = (int)floor(yl - box_height/2.0 - 0.5) + 1;
  x1 = (int)floor(xl + box_width/2.0 - 0.5);
  y1 = (int)floor(yl + box_height/2.0 - 0.5);

  if (x0 == x1) x1++;
  if (y0 == y1) y1++;

  x0 = x0<0? 0: x0>width-1? width-1: x0;
  y0 = y0<0? 0: y0>height-1? height-1: y0;
  x1 = x1<0? 0: x1>width-1? width-1: x1;
  y1 = y1<0? 0: y1>height-1? height-1: y1;

  TU Value;
  int Count = 0;

  Value = 0;

  for (int y = y0; y <= y1; y++)
  {
    for (int x = x0; x <= x1; x++)
    {
      Value += map[y*width+x];
      Count++;
    }
  }

  if (Count == 0)
  {
    Value = 0;
    return (T)Value;
  }

  return (T)(Value/(float)Count);
}

template<class T , class TU >
T imBilinearDecimation | ( | int | width,
 |  | int | height,
 |  | T * | map,
 |  | float | xl,
 |  | float | yl,
 |  | float | box_width,
 |  | float | box_height,
 |  | TU | Dummy |
 | ) |  |  | [inline]

Does Bilinear Decimation.

{
  int x0,x1,y0,y1;
  (void)Dummy;

  x0 = (int)floor(xl - box_width/2.0 - 0.5) + 1;
  y0 = (int)floor(yl - box_height/2.0 - 0.5) + 1;
  x1 = (int)floor(xl + box_width/2.0 - 0.5);
  y1 = (int)floor(yl + box_height/2.0 - 0.5);

  if (x0 == x1) x1++;
  if (y0 == y1) y1++;

  x0 = x0<0? 0: x0>width-1? width-1: x0;
  y0 = y0<0? 0: y0>height-1? height-1: y0;
  x1 = x1<0? 0: x1>width-1? width-1: x1;
  y1 = y1<0? 0: y1>height-1? height-1: y1;

  TU Value, LineValue;
  float LineNorm, Norm, dxr, dyr;

  Value = 0;
  Norm = 0;

  for (int y = y0; y <= y1; y++)
  {
    dyr = yl - (y+0.5f);
    if (dyr < 0) dyr *= -1;

    LineValue = 0;
    LineNorm = 0;

    for (int x = x0; x <= x1; x++)
    {
      dxr = xl - (x+0.5f);
      if (dxr < 0) dxr *= -1;

      LineValue += map[y*width+x] * dxr;
      LineNorm += dxr;
    }

    Value += LineValue * dyr;
    Norm += dyr * LineNorm;
  }

  if (Norm == 0)
  {
    Value = 0;
    return (T)Value;
  }

  return (T)(Value/Norm);
}

template<class T >
T imZeroOrderInterpolation | ( | int | width,
 |  | int | height,
 |  | T * | map,
 |  | float | xl,
 |  | float | yl |
 | ) |  |  | [inline]

Does Zero Order Interpolation (Nearest Neighborhood).

References imRound().

{
  int x0 = imRound(xl-0.5f);
  int y0 = imRound(yl-0.5f);
  x0 = x0<0? 0: x0>width-1? width-1: x0;
  y0 = y0<0? 0: y0>height-1? height-1: y0;
  return map[y0*width + x0];
}

template<class T >
T imBilinearInterpolation | ( | int | width,
 |  | int | height,
 |  | T * | map,
 |  | float | xl,
 |  | float | yl |
 | ) |  |  | [inline]

Does Bilinear Interpolation.

{
  int x0, y0, x1, y1;
  float t, u;

  if (xl < 0.5)
  {
    x1 = x0 = 0;
    t = 0;
  }
  else if (xl >= width-0.5)
  {
    x1 = x0 = width-1;
    t = 0;
  }
  else
  {
    x0 = (int)(xl-0.5f);
    x1 = x0+1;
    t = xl - (x0+0.5f);
  }

  if (yl < 0.5)
  {
    y1 = y0 = 0;
    u = 0;
  }
  else if (yl >= height-0.5)
  {
    y1 = y0 = height-1;
    u = 0;
  }
  else
  {
    y0 = (int)(yl-0.5f);
    y1 = y0+1;
    u = yl - (y0+0.5f);
  }

  T fll = map[y0*width + x0];
  T fhl = map[y0*width + x1];
  T flh = map[y1*width + x0];
  T fhh = map[y1*width + x1];

  return (T)((fhh - flh - fhl + fll) * u * t +
                         (fhl - fll) * t +
                         (flh - fll) * u +
                                fll);
}

template<class T , class TU >
T imBicubicInterpolation | ( | int | width,
 |  | int | height,
 |  | T * | map,
 |  | float | xl,
 |  | float | yl,
 |  | TU | Dummy |
 | ) |  |  | [inline]

Does Bicubic Interpolation.

{
  int X[4], Y[4];
  float t, u;
  (void)Dummy;

  if (xl >= width-0.5)
  {
    X[3] = X[2] = X[1] = width-1;
    X[0] = X[1]-1;
    t = 0;
  }
  else
  {
    X[1] = (int)(xl-0.5f);
    if (X[1] < 0) X[1] = 0;

    X[0] = X[1]-1;
    X[2] = X[1]+1;
    X[3] = X[1]+2;

    if (X[0] < 0) X[0] = 0;
    if (X[3] > width-1) X[3] = width-1;

    t = xl - (X[1]+0.5f);
  }

  if (yl >= height-0.5)
  {
    Y[3] = Y[2] = Y[1] = height-1;
    Y[0] = Y[1]-1;
    u = 0;
  }
  else
  {
    Y[1] = (int)(yl-0.5f);
    if (Y[1] < 0) Y[1] = 0;

    Y[0] = Y[1]-1;
    Y[2] = Y[1]+1;
    Y[3] = Y[1]+2;

    if (Y[0] < 0) Y[0] = 0;
    if (Y[3] > height-1) Y[3] = height-1;

    u = yl - (Y[1]+0.5f);
  }

  float CX[4], CY[4];

  // Optimize calculations
  {
    float c, c2, c3;

#define C0 (-c3 + 2.0f*c2 - c)
#define C1 ( c3 - 2.0f*c2 + 1.0f)
#define C2 (-c3 + c2 + c)
#define C3 ( c3 - c2)

    c = t;
    c2 = c*c; c3 = c2*c;
    CX[0] = C0; CX[1] = C1; CX[2] = C2; CX[3] = C3;

    c = u;
    c2 = c*c; c3 = c2*c;
    CY[0] = C0; CY[1] = C1; CY[2] = C2; CY[3] = C3;

#undef C0
#undef C1
#undef C2
#undef C3
  }

  TU LineValue, Value;
  float LineNorm, Norm;

  Value = 0;
  Norm = 0;

  for (int y = 0; y < 4; y++)
  {
    LineValue = 0;
    LineNorm = 0;

    for (int x = 0; x < 4; x++)
    {
      LineValue += map[Y[y]*width+X[x]] * CX[x];
      LineNorm += CX[x];
    }

    Value += LineValue * CY[y];
    Norm += CY[y] * LineNorm;
  }

  if (Norm == 0)
  {
    Value = 0;
    return (T)Value;
  }

  Value = (Value/Norm);

  int size = sizeof(T);
  if (size == 1)
    return (T)(Value<=(TU)0? (TU)0: Value<=(TU)255? Value: (TU)255);
  else
    return (T)(Value);
}

template<class T >
void imMinMax | ( | const T * | map,
 |  | int | count,
 |  | T & | min,
 |  | T & | max |
 | ) |  |  | [inline]

Calculates minimum and maximum values.

{
  min = *map++;
  max = min;
  for (int i = 1; i < count; i++)
  {
    T value = *map++;

    if (value > max)
      max = value;
    else if (value < min)
      min = value;
  }
}


IM: String Utilities

Functions

String Utilities
[Utilities]

Collaboration diagram for String Utilities:

Functions

int | imStrEqual (const char *str1, const char *str2)
int | imStrNLen (const char *str, int max_len)
int | imStrCheck (const void *data, int count)

Detailed Description

See im_util.h

Function Documentation

int imStrEqual | ( | const char * | str1,
 |  | const char * | str2
 | ) |  |

Check if the two strings are equal.

int imStrNLen | ( | const char * | str,
 |  | int | max_len
 | ) |  |

Calculate the size of the string but limited to max_len.

int imStrCheck | ( | const void * | data,
 |  | int | count
 | ) |  |

Check if the data is a string.

Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Binary File Access

Binary File Access
[Utilities]

Collaboration diagram for Binary File Access:

Data Structures

struct | _imBinMemoryFileName
Memory File I/O Filename. More...

Typedefs

typedef struct _imBinMemoryFileName | imBinMemoryFileName

Enumerations

enum imBinFileModule {
IM_RAWFILE, IM_STREAM, IM_MEMFILE, IM_SUBFILE,
IM_FILEHANDLE, IM_IOCUSTOM0
}

Functions

imBinFile * | imBinFileOpen (const char *pFileName)
imBinFile * | imBinFileNew (const char *pFileName)
void | imBinFileClose (imBinFile *bfile)
int | imBinFileError (imBinFile *bfile)
unsigned long | imBinFileSize (imBinFile *bfile)
int | imBinFileByteOrder (imBinFile *bfile, int pByteOrder)
unsigned long | imBinFileRead (imBinFile *bfile, void *pValues, unsigned long pCount, int pSizeOf)
unsigned long | imBinFileWrite (imBinFile *bfile, void *pValues, unsigned long pCount, int pSizeOf)
unsigned long | imBinFilePrintf (imBinFile *bfile, char *format,...)
int | imBinFileReadInteger (imBinFile *handle, int *value)
int | imBinFileReadFloat (imBinFile *handle, float *value)
void | imBinFileSeekTo (imBinFile *bfile, unsigned long pOffset)
void | imBinFileSeekOffset (imBinFile *bfile, long pOffset)
void | imBinFileSeekFrom (imBinFile *bfile, long pOffset)
unsigned long | imBinFileTell (imBinFile *bfile)
int | imBinFileEndOfFile (imBinFile *bfile)
int | imBinFileSetCurrentModule (int pModule)
void | imBinMemoryRelease (unsigned char *buffer)

Detailed Description

These functions are very usefull for reading/writing binary files that have headers or data that have to be converted depending on the current CPU byte order. It can invert 2, 4 or 8 bytes numbers to/from little/big-endian orders.
It will process the data only if the file format is diferent from the current CPU.
Can read from disk or memory. In case of a memory buffer, the file name must be the imBinMemoryFileName structure.
See im_binfile.h

Typedef Documentation

typedef struct _imBinMemoryFileName imBinMemoryFileName

Memory File I/O Filename.

Fake file name for the memory I/O module.

Enumeration Type Documentation

enum imBinFileModule

Predefined I/O Modules.

Enumerator:
IM_RAWFILE

System dependent file I/O Rotines.

IM_STREAM

Standard Ansi C Stream I/O Rotines.

IM_MEMFILE

Uses a memory buffer (see imBinMemoryFileName).

IM_SUBFILE

It is a sub file. FileName is a imBinFile* pointer from any other module.

IM_FILEHANDLE

System dependent file I/O Rotines, but FileName is a system file handle ("int" in UNIX and "HANDLE" in Windows).

IM_IOCUSTOM0

Other registered modules starts from here.

{
        IM_RAWFILE,   /**< System dependent file I/O Rotines. */
        IM_STREAM,    /**< Standard Ansi C Stream I/O Rotines. */
        IM_MEMFILE,   /**< Uses a memory buffer (see \ref imBinMemoryFileName). */
        IM_SUBFILE,   /**< It is a sub file. FileName is a imBinFile* pointer from any other module. */
  IM_FILEHANDLE,/**< System dependent file I/O Rotines, but FileName is a system file handle ("int" in UNIX and "HANDLE" in Windows). */
        IM_IOCUSTOM0  /**< Other registered modules starts from here. */
};

Function Documentation

imBinFile* imBinFileOpen ( const char * pFileName )

Opens an existant binary file for reading. The default file byte order is the CPU byte order. Returns NULL if failed.

imBinFile* imBinFileNew ( const char * pFileName )

Creates a new binary file for writing. The default file byte order is the CPU byte order. Returns NULL if failed.

void imBinFileClose ( imBinFile * bfile )

Closes the file.

int imBinFileError ( imBinFile * bfile )

Indicates that was an error on the last operation.

unsigned long imBinFileSize ( imBinFile * bfile )

Returns the file size in bytes.

int imBinFileByteOrder | ( | imBinFile * | bfile,
 |  | int | pByteOrder
 | ) |  |

Changes the file byte order. Returns the old one.

unsigned long imBinFileRead | ( | imBinFile * | bfile,
 |  | void * | pValues,
 |  | unsigned long | pCount,
 |  | int | pSizeOf
 | ) |  |

Reads an array of count values with byte sizes: 1, 2, 4, or 8. And invert the byte order if necessary after read.

unsigned long imBinFileWrite | ( | imBinFile * | bfile,
 |  | void * | pValues,
 |  | unsigned long | pCount,
 |  | int | pSizeOf
 | ) |  |

Writes an array of values with sizes: 1, 2, 4, or 8. And invert the byte order if necessary before write.
ATENTION: The function will not make a temporary copy of the values to invert the byte order.
So after the call the values will be invalid, if the file byte order is diferent from the CPU byte order.

unsigned long imBinFilePrintf | ( | imBinFile * | bfile,
 |  | char * | format,
 |  |  | ...
 | ) |  |

Writes a string without the NULL terminator. The function uses sprintf to compose the string.
The internal buffer is fixed at 4096 bytes.

int imBinFileReadInteger | ( | imBinFile * | handle,
 |  | int * | value
 | ) |  |

Reads an integer number from the current position until found a non integer character. Returns a non zero value if sucessfull.

int imBinFileReadFloat | ( | imBinFile * | handle,
 |  | float * | value
 | ) |  |

Reads an floating point number from the current position until found a non number character. Returns a non zero value if sucessfull.

void imBinFileSeekTo | ( | imBinFile * | bfile,
 |  | unsigned long | pOffset
 | ) |  |

Moves the file pointer from the begining of the file.
When writing to a file seeking can go beyond the end of the file.

void imBinFileSeekOffset | ( | imBinFile * | bfile,
 |  | long | pOffset
 | ) |  |

Moves the file pointer from current position.
If the offset is a negative value the pointer moves backwards.

void imBinFileSeekFrom | ( | imBinFile * | bfile,
 |  | long | pOffset
 | ) |  |

Moves the file pointer from the end of the file.
The offset is usually a negative value.

unsigned long imBinFileTell ( imBinFile * bfile )

Returns the current offset position.

int imBinFileEndOfFile ( imBinFile * bfile )

Indicates that the file pointer is at the end of the file.

int imBinFileSetCurrentModule ( int pModule )

Sets the current I/O module.

Returns:
the previous function set, or -1 if failed. See also imBinFileModule.
void imBinMemoryRelease ( unsigned char * buffer )

Release the internal memory allocated when writing a Memory File (see imBinMemoryFileName).


IM: Data Compression Utilities

Functions

Data Compression Utilities
[Utilities]

Collaboration diagram for Data Compression Utilities:

Functions

int | imCompressDataZ (const void *src_data, int src_size, void *dst_data, int dst_size, int zip_quality)
int | imCompressDataUnZ (const void *src_data, int src_size, void *dst_data, int dst_size)
int | imCompressDataLZF (const void *src_data, int src_size, void *dst_data, int dst_size, int zip_quality)
int | imCompressDataUnLZF (const void *src_data, int src_size, void *dst_data, int dst_size)

Detailed Description

Deflate compression support uses zlib version 1.2.3.
http://www.zlib.org/
Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
LZF compression support uses libLZF version 3.5.
http://software.schmorp.de/pkg/liblzf
Copyright (C) 2000-2009 Marc Alexander Lehmann See im_util.h

Function Documentation

int imCompressDataZ | ( | const void * | src_data,
 |  | int | src_size,
 |  | void * | dst_data,
 |  | int | dst_size,
 |  | int | zip_quality
 | ) |  |

Compresses the data using the ZLIB Deflate compression.
The destination buffer must be at least 0.1% larger than source_size plus 12 bytes.
It compresses raw byte data. zip_quality can be 1 to 9.
Returns the size of the compressed buffer or zero if failed.

int imCompressDataUnZ | ( | const void * | src_data,
 |  | int | src_size,
 |  | void * | dst_data,
 |  | int | dst_size
 | ) |  |

Uncompresses the data compressed with the ZLIB Deflate compression.
Returns zero if failed.

int imCompressDataLZF | ( | const void * | src_data,
 |  | int | src_size,
 |  | void * | dst_data,
 |  | int | dst_size,
 |  | int | zip_quality
 | ) |  |

Compresses the data using the libLZF compression.
Returns the size of the compressed buffer or zero if failed.

int imCompressDataUnLZF | ( | const void * | src_data,
 |  | int | src_size,
 |  | void * | dst_data,
 |  | int | dst_size
 | ) |  |

Uncompresses the data compressed with the libLZF compression. Returns zero if failed.

Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Counter

Counter
[Utilities]

Collaboration diagram for Counter:

Typedefs

typedef int(* | imCounterCallback )(int counter, void *user_data, const char *text, int progress)

Functions

imCounterCallback | imCounterSetCallback (void *user_data, imCounterCallback counter_func)
int | imCounterBegin (const char *title)
void | imCounterEnd (int counter)
int | imCounterInc (int counter)
int | imCounterIncTo (int counter, int count)
void | imCounterTotal (int counter, int total, const char *message)

Detailed Description

Used to notify the application that a step in the loading, saving or processing operation has been performed.
See im_counter.h

Typedef Documentation

typedef int(* imCounterCallback)(int counter, void *user_data, const char *text, int progress)

Counter callback, informs the progress of the operation to the client.
Text contains a constant string that is NULL during normal counting, a title in the begining of a sequence and a message in the begining of a count. Counter id identifies diferrent counters.
Progress in a count reports a value from 0 to 1000. If -1 indicates the start of a sequence of operations, 1001 ends the sequence.
If returns 0 the client should abort the operation.
If the counter is aborted, the callback will be called one last time at 1001.

Function Documentation

imCounterCallback imCounterSetCallback | ( | void * | user_data,
 |  | imCounterCallback | counter_func
 | ) |  |

Changes the counter callback. Returns old callback.
User data is changed only if not NULL.

int imCounterBegin ( const char * title )

Begins a new count, or a partial-count in a sequence.
Calls the callback with "-1" and text=title, if it is at the top level.
This is to be used by the operations. Returns a counter Id.

void imCounterEnd ( int counter )

Ends a count, or a partial-count in a sequence.
Calls the callback with "1001", text=null, and releases the counter if it is at top level count.

int imCounterInc ( int counter )

Increments a count. Must set the total first.
Calls the callback, text=message if it is the first increment for the count.
Returns 0 if the callback aborted, 1 if returns normally.

int imCounterIncTo | ( | int | counter,
 |  | int | count
 | ) |  |

Set a specific count. Must set the total first.
Calls the callback, text=message if it is the first increment for the count.
Returns 0 if the callback aborted, 1 if returns normally.

void imCounterTotal | ( | int | counter,
 |  | int | total,
 |  | const char * | message
 | ) |  |

Sets the total increments of a count.


IM: Windows DIB

Windows DIB
[Utilities]

Collaboration diagram for Windows DIB:

Data Structures

struct | _imDib
Windows DIB Structure. More...

Typedefs

typedef struct _imDib | imDib
typedef unsigned int(* | imDibLineGetPixel )(unsigned char *line, int col)
typedef void(* | imDibLineSetPixel )(unsigned char *line, int col, unsigned int pixel)

Functions

imDib * | imDibCreate (int width, int height, int bpp)
imDib * | imDibCreateCopy (const imDib *dib)
imDib * | imDibCreateReference (BYTE *bmi, BYTE *bits)
imDib * | imDibCreateSection (HDC hDC, HBITMAP *image, int width, int height, int bpp)
void | imDibDestroy (imDib *dib)
imDibLineGetPixel | imDibLineGetPixelFunc (int bpp)
imDibLineSetPixel | imDibLineSetPixelFunc (int bpp)
imDib * | imDibFromHBitmap (const HBITMAP image, const HPALETTE hPalette)
HBITMAP | imDibToHBitmap (const imDib *dib)
HPALETTE | imDibLogicalPalette (const imDib *dib)
imDib * | imDibCaptureScreen (int x, int y, int width, int height)
void | imDibCopyClipboard (imDib *dib)
imDib * | imDibPasteClipboard (void)
int | imDibIsClipboardAvailable (void)
int | imDibSaveFile (const imDib *dib, const char *filename)
imDib * | imDibLoadFile (const char *filename)
void | imDibDecodeToRGBA (const imDib *dib, unsigned char *red, unsigned char *green, unsigned char *blue, unsigned char *alpha)
void | imDibDecodeToMap (const imDib *dib, unsigned char *map, long *palette)
void | imDibEncodeFromRGBA (imDib *dib, const unsigned char *red, const unsigned char *green, const unsigned char *blue, const unsigned char *alpha)
void | imDibEncodeFromMap (imDib *dib, const unsigned char *map, const long *palette, int palette_count)
void | imDibEncodeFromBitmap (imDib *dib, const unsigned char *data)
void | imDibDecodeToBitmap (const imDib *dib, unsigned char *data)

Detailed Description

Windows DIBs in memory are handled just like a BMP file without the file header.
These functions will work only in Windows. They are usefull for interchanging data with the clipboard, with capture drivers, with the AVI and WMF file formats and others.
Supported DIB aspects:
  • bpp must be 1, 4, 8, 16, 24, or 32.
  • BITMAPV4HEADER or BITMAPV5HEADER are handled but ignored.
  • BITMAPCOREHEADER is not handled .
  • BI_JPEG and BI_PNG compressions are not handled.
  • biHeight can be negative, compression can be RLE only if created from imDibCreateReference, imDibPasteClipboard, imDibLoadFile.
  • can not encode/decode Images to/from RLE compressed Dibs.
  • if working with RLE Dibs bits_size is greatter than used.
  • the resolution of a new Dib is taken from the screen.
  • SetDIBitsToDevice(start_scan is 0, scan_lines is dib->bmih->biHeight).
  • StretchDIBits(use always DIB_RGB_COLORS).
  • CreateDIBPatternBrushPt(packed_dib is dib->dib).
Must include <windows.h> before using these functions.
Check <wingdi.h> for structures and definitions.
See im_dib.h

Typedef Documentation

typedef struct _imDib imDib

Windows DIB Structure.

Handles a DIB in memory.
The DIB is stored in only one buffer. The secondary members are pointers to the main buffer.
typedef unsigned int(* imDibLineGetPixel)(unsigned char *line, int col)

DIB GetPixel function definition.
the DWORD is a raw copy of the bits, use (unsigned char*)&pixel

typedef void(* imDibLineSetPixel)(unsigned char *line, int col, unsigned int pixel)

DIB SetPixel function definition

Function Documentation

imDib* imDibCreate | ( | int | width,
 |  | int | height,
 |  | int | bpp
 | ) |  |

Creates a new DIB.
use bpp=-16/-32 to allocate space for BITFLIEDS.

imDib* imDibCreateCopy ( const imDib * dib )

Duplicates the DIB contents in a new DIB.

imDib* imDibCreateReference | ( | BYTE * | bmi,
 |  | BYTE * | bits
 | ) |  |

Creates a DIB using an already allocated memory.
"bmi" must be a pointer to BITMAPINFOHEADER.
"bits" can be NULL if it is inside "bmi" after the palette.

imDib* imDibCreateSection | ( | HDC | hDC,
 |  | HBITMAP * | image,
 |  | int | width,
 |  | int | height,
 |  | int | bpp
 | ) |  |

Creates a DIB section for drawing porposes.
Returns the image handle also created.

void imDibDestroy ( imDib * dib )

Destroy the DIB

imDibLineGetPixel imDibLineGetPixelFunc ( int bpp )

Returns a function to read pixels from a DIB line.

imDibLineSetPixel imDibLineSetPixelFunc ( int bpp )

Returns a function to write pixels into a DIB line.

imDib* imDibFromHBitmap | ( | const HBITMAP | image,
 |  | const HPALETTE | hPalette
 | ) |  |

Creates a DIB from a image handle and a palette handle.

HBITMAP imDibToHBitmap ( const imDib * dib )

Creates a image handle from a DIB.

HPALETTE imDibLogicalPalette ( const imDib * dib )

Returns a Logical palette from the DIB palette.
DIB bpp must be <=8.

imDib* imDibCaptureScreen | ( | int | x,
 |  | int | y,
 |  | int | width,
 |  | int | height
 | ) |  |

Captures the screen into a DIB.

void imDibCopyClipboard ( imDib * dib )

Transfer the DIB to the clipboard.
"dib" pointer can not be used after, or use imDibCopyClipboard(imDibCreateCopy(dib)). Warning: Clipboard functions in C++ can fail with Visual C++ /EHsc (Enable C++ Exceptions)

imDib* imDibPasteClipboard ( void )

Creates a reference for the DIB in the clipboard if any. Returns NULL otherwise. Warning: Clipboard functions in C++ can fail with Visual C++ /EHsc (Enable C++ Exceptions)

int imDibIsClipboardAvailable ( void )

Checks if there is a dib at the clipboard.

int imDibSaveFile | ( | const imDib * | dib,
 |  | const char * | filename
 | ) |  |

Saves the DIB into a file ".bmp".

imDib* imDibLoadFile ( const char * filename )

Creates a DIB from a file ".bmp".

void imDibDecodeToRGBA | ( | const imDib * | dib,
 |  | unsigned char * | red,
 |  | unsigned char * | green,
 |  | unsigned char * | blue,
 |  | unsigned char * | alpha
 | ) |  |

Converts a DIB into an RGBA image. alpha is optional. bpp must be >8.
alpha is used only when bpp=32.

void imDibDecodeToMap | ( | const imDib * | dib,
 |  | unsigned char * | map,
 |  | long * | palette
 | ) |  |

Converts a DIB into an indexed image. bpp must be <=8. colors must have room for at least 256 colors. colors is rgb packed (RGBRGBRGB...)

void imDibEncodeFromRGBA | ( | imDib * | dib,
 |  | const unsigned char * | red,
 |  | const unsigned char * | green,
 |  | const unsigned char * | blue,
 |  | const unsigned char * | alpha
 | ) |  |

Converts an RGBA image into a DIB. alpha is optional. bpp must be >8.
alpha is used only when bpp=32.

void imDibEncodeFromMap | ( | imDib * | dib,
 |  | const unsigned char * | map,
 |  | const long * | palette,
 |  | int | palette_count
 | ) |  |

Converts an indexed image into a DIB. bpp must be <=8.
colors is rgb packed (RGBRGBRGB...)

void imDibEncodeFromBitmap | ( | imDib * | dib,
 |  | const unsigned char * | data
 | ) |  |

Converts a IM_RGB packed image, with or without alpha, into a DIB.

void imDibDecodeToBitmap | ( | const imDib * | dib,
 |  | unsigned char * | data
 | ) |  |

Converts a DIB into IM_RGB packed image, with or without alpha.


IM: Data Structures

Data Structures

Here are the data structures with brief descriptions:
_imBinMemoryFileName | Memory File I/O Filename
_imDib | Windows DIB Structure
_imFile | Image File Format Base Class (SDK Use Only)
_imImage | ImImage Structure Definition
_imStats |
imAttribArray | Attributes Table
imAttribTable | Attributes Table
imcfloat | Complex Float Data Type
imFileFormatBase | Image File Format Virtual Class (SDK Use Only)
imFormat | Image File Format Descriptor (SDK Use Only)
imImageFile | C++ Wrapper for the Image File Structure
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: imAttribTable Class Reference

Public Member Functions

imAttribTable Class Reference
[Utilities]

Attributes Table. More...

Public Member Functions

imAttribTable (int hash_size)
~imAttribTable ()
int | Count () const
void | RemoveAll ()
void | CopyFrom (const imAttribTable &table)
void | Set (const char *name, int data_type, int count, const void *data)
void | UnSet (const char *name)
const void * | Get (const char *name, int *data_type=0, int *count=0) const
void | ForEach (void *user_data, imAttribTableCallback attrib_func) const

Detailed Description

All the attributes have a name, a type, a count and the data.
Names are usually strings with less that 30 chars.
Attributes are stored in a hash table for fast access.
We use the hash function described in "The Pratice of Programming" of Kernighan & Pike.

Constructor & Destructor Documentation

imAttribTable::imAttribTable ( int hash_size ) [inline]

Creates an empty table. If size is zero the default size of 101 is used. Size must be a prime number. Other common values are 67, 599 and 1499.

{

imAttribTable::~imAttribTable ( ) [inline]

Destroys the table and all the attributes.

{
  imAttribTablePrivate* ptable;

Member Function Documentation

int imAttribTable::Count ( ) const [inline]

Returns the number of elements in the table.

    { ptable = imAttribTableCreate(hash_size); }

void imAttribTable::RemoveAll ( ) [inline]

Removes all the attributes in the table

    { ptable = imAttribTableCreate(hash_size); }

void imAttribTable::CopyFrom ( const imAttribTable & table ) [inline]

Copies the contents of the given table into this table.

    { imAttribTableDestroy(ptable); ptable = 0; }

void imAttribTable::Set | ( | const char * | name,
 |  | int | data_type,
 |  | int | count,
 |  | const void * | data |
 | ) |  |  | [inline]

Inserts an attribute into the table.
If data_type is BYTE then count can be -1 to indicate a NULL terminated string. Data is duplicated if not NULL, else data is initialized with zeros. See also imDataType.

    { imAttribTableRemoveAll(ptable); }

void imAttribTable::UnSet ( const char * name ) [inline]

Removes an attribute from the table given its name.

    { imAttribTableCopyFrom(ptable, table.ptable); }

const void* imAttribTable::Get | ( | const char * | name,
 |  | int * | data_type = 0,
 |  | int * | count = 0 |
 | ) |  |  | const [inline]

Finds an attribute in the table. Returns the attribute if found, NULL otherwise. See also imDataType.

    { imAttribTableSet(ptable, name, data_type, count, data); }

void imAttribTable::ForEach | ( | void * | user_data,
 |  | imAttribTableCallback | attrib_func |
 | ) |  |  | const [inline]

For each attribute calls the user callback. If the callback returns 0 the function returns.

    { imAttribTableUnSet(ptable, name); }

The documentation for this class was generated from the following file:
  • im_attrib.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: _imBinMemoryFileName Struct Reference

Data Fields

_imBinMemoryFileName Struct Reference
[Binary File Access]

Memory File I/O Filename. More...

Data Fields

unsigned char * | buffer
int | size
float | reallocate

Detailed Description

Fake file name for the memory I/O module.

Field Documentation

unsigned char* _imBinMemoryFileName::buffer

The memory buffer. If you are reading the buffer must exists. If you are writing the buffer can be internally allocated to the given size. The buffer is never free. The buffer is allocated using "malloc", and reallocated using "realloc". Use "free" to release it. To avoid RTL conflicts use the function imBinMemoryRelease.

int _imBinMemoryFileName::size

Size of the buffer.

float _imBinMemoryFileName::reallocate

Reallocate factor for the memory buffer when writing (size += reallocate*size). Set reallocate to 0 to disable reallocation, in this case buffer must not be NULL.

The documentation for this struct was generated from the following file:
  • im_binfile.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: _imDib Struct Reference

Data Fields

_imDib Struct Reference
[Windows DIB]

Windows DIB Structure. More...

Data Fields

HGLOBAL | handle
BYTE * | dib
int | size
BITMAPINFO * | bmi
BITMAPINFOHEADER * | bmih
RGBQUAD * | bmic
BYTE * | bits
int | palette_count
int | bits_size
int | line_size
int | pad_size
int | is_reference

Detailed Description

Handles a DIB in memory.
The DIB is stored in only one buffer. The secondary members are pointers to the main buffer.

Field Documentation

HGLOBAL _imDib::handle

The windows memory handle

BYTE* _imDib::dib

The DIB as it is defined in memory

int _imDib::size

Full size in memory

BITMAPINFO* _imDib::bmi

Bitmap Info = Bitmap Info Header + Palette

BITMAPINFOHEADER* _imDib::bmih

Bitmap Info Header

RGBQUAD* _imDib::bmic

Bitmap Info Colors = Palette

BYTE* _imDib::bits

Bitmap Bits

int _imDib::palette_count

number of colors in the palette

int _imDib::bits_size

size in bytes of the Bitmap Bits

int _imDib::line_size

size in bytes of one line, includes padding

int _imDib::pad_size

number of bytes remaining in the line, lines are in a word boundary

int _imDib::is_reference

only a reference, do not free pointer

The documentation for this struct was generated from the following file:
  • im_dib.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: _imFile Struct Reference

Data Fields

_imFile Struct Reference
[File Format SDK]

Image File Format Base Class (SDK Use Only). More...

Inherited by imFileFormatBase.

Data Fields

int | is_new
void * | attrib_table
void * | line_buffer
int | line_buffer_size
int | line_buffer_extra
int | line_buffer_alloc
int | counter
int | convert_bpp
int | switch_type
long | palette [256]
int | palette_count
int | user_color_mode
int | user_data_type
int | file_color_mode
int | file_data_type
char | compression [10]
int | image_count
int | image_index
int | width
int | height

Detailed Description

Base container to hold format independent state variables.

Field Documentation

void* _imFile::attrib_table

in fact is a imAttribTable, but we hide this here

void* _imFile::line_buffer

used for line convertion, contains all components if packed, or only one if not

int _imFile::line_buffer_extra

extra bytes to be allocated

int _imFile::line_buffer_alloc

total allocated so far

int _imFile::convert_bpp

number of bpp to unpack/pack to/from 1 byte. When reading converts n packed bits to 1 byte (unpack). If n>1 will also expand to 0-255. When writing converts 1 byte to 1 bit (pack). If negative will only expand to 0-255 (no unpack or pack).

int _imFile::switch_type

flag to switch the original data type: char-byte, short-ushort, uint-int, double-float

The documentation for this struct was generated from the following file:
  • im_file.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: imFormat Class Reference

imFormat Class Reference
[File Format SDK]

Image File Format Descriptor (SDK Use Only). More...

Public Member Functions

virtual imFileFormatBase * | Create () const =0
virtual int | CanWrite (const char *compression, int color_mode, int data_type) const =0
imFormat (const char *_format, const char *_desc, const char *_ext, const char **_comp, int _comp_count, int _can_sequence)

Data Fields

const char * | format
const char * | desc
const char * | ext
const char ** | comp
int | comp_count
int | can_sequence

Detailed Description

All file formats must define these informations. They are stored by imFormatRegister.
The documentation for this class was generated from the following file:
  • im_format.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: imcfloat Class Reference

imcfloat Class Reference
[Complex Numbers]

Complex Float Data Type. More...

Public Member Functions

imcfloat ()
imcfloat (const float &r, const float &i)
imcfloat (const float &r)

Data Fields

float | real
float | imag

Detailed Description

Complex class using two floats, one for real part, one for the imaginary part.
It is not a complete complex class, we just implement constructors inside the class. All the other operators and functions are external to the class.
The documentation for this class was generated from the following file:
  • im_complex.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: _imImage Struct Reference

Data Fields

_imImage Struct Reference
[imImage]

imImage Structure Definition. More...

Data Fields

int | width
int | height
int | color_space
int | data_type
int | has_alpha
int | depth
int | line_size
int | plane_size
int | size
int | count
void ** | data
long * | palette
int | palette_count
void * | attrib_table

Detailed Description

An image representation than supports all the color spaces, but planes are always unpacked and the orientation is always bottom up.

Field Documentation

int _imImage::width

Number of columns. image:Width() -> width: number [in Lua 5].

int _imImage::height

Number of lines. image:Height() -> height: number [in Lua 5].

int _imImage::color_space

Color space descriptor. See also imColorSpace. image:ColorSpace() -> color_space: number [in Lua 5].

int _imImage::data_type

Data type descriptor. See also imDataType. image:DataType() -> data_type: number [in Lua 5].

int _imImage::has_alpha

Indicates that there is an extra channel with alpha. image:HasAlpha() -> has_alpha: boolean [in Lua 5].
It will not affect the secondary parameters, i.e. the number of planes will be in fact depth+1.
It is always 0 unless imImageAddAlpha is called, this is done in image load functions.

int _imImage::depth

Number of planes (ColorSpaceDepth) image:Depth() -> depth: number [in Lua 5].

int _imImage::line_size

Number of bytes per line in one plane (width * DataTypeSize)

int _imImage::plane_size

Number of bytes per plane. (line_size * height)

int _imImage::size

Number of bytes occupied by the image (plane_size * depth)

int _imImage::count

Number of pixels (width * height)

void** _imImage::data

Image data organized as a 2D matrix with several planes.
But plane 0 is also a pointer to the full data.
The remaining planes are: data[i] = data[0] + i*plane_size
In Lua, data indexing is possible using: image[plane][row][column]

long* _imImage::palette

Color palette. image:GetPalette() -> palette: imPalette [in Lua 5].
Used when depth=1. Otherwise is NULL.

int _imImage::palette_count

The palette is always 256 colors allocated, but can have less colors used.

void* _imImage::attrib_table

in fact is an imAttribTable, but we hide this here

The documentation for this struct was generated from the following file:
  • im_image.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: imImageFile Class Reference

Public Member Functions

imImageFile Class Reference
[Image Storage]

C++ Wrapper for the Image File Structure. More...

Collaboration diagram for imImageFile:
[legend]

Public Member Functions

imImageFile (const char *file_name)
imImageFile (const char *file_name, const char *format)
int | Failed ()
int | Error ()
void | SetAttribute (const char *attrib, int data_type, int count, const void *data)
const void * | GetAttribute (const char *attrib, int *data_type, int *count)
void | GetInfo (char *format, char *compression, int *image_count)
void | ReadImageInfo (int index, int *width, int *height, int *color_mode, int *data_type)
void | GetPalette (long *palette, int *palette_count)
void | ReadImageData (void *data, int convert2bitmap, int color_mode_flags)
void | SetInfo (const char *compression)
void | SetPalette (long *palette, int palette_count)
void | WriteImageInfo (int width, int height, int color_mode, int data_type)
void | WriteImageData (void *data)

Detailed Description

Usage is just like the C API. Open and New are replaced by equivalent constructors.
Close is replaced by the destructor. Error checking is done by the Error() member.
Open and New errors are cheked using the Failed() member.
The documentation for this class was generated from the following file:
  • im_plus.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: File Index

File List

Here is a list of all documented files with brief descriptions:
im.h [code] | Main API
im_attrib.h [code] | Attributes Table
im_attrib_flat.h [code] | Attributes Table Flat API. This will simplify the DLL export, and can be used for C aplications
im_binfile.h [code] | Binary File Access
im_capture.h [code] | Video Capture
im_color.h [code] | Color Manipulation
im_colorhsi.h [code] | HSI Color Manipulation
im_complex.h [code] | Complex Data Type
im_convert.h [code] | Image Conversion
im_counter.h [code] | Processing Counter
im_dib.h [code] | Windows DIB (Device Independent Bitmap)
im_file.h [code] | File Access
im_format.h [code] | File Format Access
im_format_all.h [code] | All the Internal File Formats. They are all automatically registered by the library. The signatures are in C, but the functions are C++. Header for internal use only
im_format_avi.h [code] | Register the AVI Format
im_format_ecw.h [code] | Register the ECW Format
im_format_jp2.h [code] | Register the JP2 Format
im_format_raw.h [code] | Initialize the RAW Format Driver Header for internal use only
im_format_wmv.h [code] | Register the WMF Format
im_image.h [code] | Image Manipulation
im_kernel.h [code] | Kernel Generators Creates several known kernels
im_lib.h [code] | Library Management and Main Documentation
im_math.h [code] | Math Utilities
im_math_op.h [code] | Math Operations
im_palette.h [code] | Palette Generators
im_plus.h [code] | C++ Wrapper for File Access
im_process.h [code] | Image Processing
im_process_ana.h [code] | Image Statistics and Analysis
im_process_glo.h [code] | Image Processing - Global Operations
im_process_loc.h [code] | Image Processing - Local Operations
im_process_pon.h [code] | Image Processing - Pontual Operations
im_raw.h [code] | RAW File Format
im_util.h [code] | Utilities
imlua.h [code] | IM Lua 5 Binding
old_im.h [code] | Old API
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: im.h File Reference

im.h File Reference

Main API. More...

Include dependency graph for im.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct _imFile | imFile

Enumerations

enum imDataType {
IM_BYTE, IM_USHORT, IM_INT, IM_FLOAT,
IM_CFLOAT
}
enum imColorSpace {
IM_RGB, IM_MAP, IM_GRAY, IM_BINARY,
IM_CMYK, IM_YCBCR, IM_LAB, IM_LUV,
IM_XYZ
}
enum | imColorModeConfig { IM_ALPHA = 0x100, IM_PACKED = 0x200, IM_TOPDOWN = 0x400 }
enum imErrorCodes {
IM_ERR_NONE, IM_ERR_OPEN, IM_ERR_ACCESS, IM_ERR_FORMAT,
IM_ERR_DATA, IM_ERR_COMPRESS, IM_ERR_MEM, IM_ERR_COUNTER
}

Functions

imFile * | imFileOpen (const char *file_name, int *error)
imFile * | imFileOpenAs (const char *file_name, const char *format, int *error)
imFile * | imFileNew (const char *file_name, const char *format, int *error)
void | imFileClose (imFile *ifile)
void * | imFileHandle (imFile *ifile, int index)
void | imFileGetInfo (imFile *ifile, char *format, char *compression, int *image_count)
void | imFileSetInfo (imFile *ifile, const char *compression)
void | imFileSetAttribute (imFile *ifile, const char *attrib, int data_type, int count, const void *data)
const void * | imFileGetAttribute (imFile *ifile, const char *attrib, int *data_type, int *count)
void | imFileGetAttributeList (imFile *ifile, char **attrib, int *attrib_count)
void | imFileGetPalette (imFile *ifile, long *palette, int *palette_count)
void | imFileSetPalette (imFile *ifile, long *palette, int palette_count)
int | imFileReadImageInfo (imFile *ifile, int index, int *width, int *height, int *file_color_mode, int *file_data_type)
int | imFileWriteImageInfo (imFile *ifile, int width, int height, int user_color_mode, int user_data_type)
int | imFileReadImageData (imFile *ifile, void *data, int convert2bitmap, int color_mode_flags)
int | imFileWriteImageData (imFile *ifile, void *data)
void | imFormatRegisterInternal (void)
void | imFormatRemoveAll (void)
void | imFormatList (char **format_list, int *format_count)
int | imFormatInfo (const char *format, char *desc, char *ext, int *can_sequence)
int | imFormatCompressions (const char *format, char **comp, int *comp_count, int color_mode, int data_type)
int | imFormatCanWriteImage (const char *format, const char *compression, int color_mode, int data_type)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_attrib.h File Reference

Data Structures

im_attrib.h File Reference

Attributes Table. More...

Include dependency graph for im_attrib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class | imAttribTable
Attributes Table. More...
class | imAttribArray
Attributes Table. More...

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_attrib_flat.h File Reference

im_attrib_flat.h File Reference

Attributes Table Flat API. This will simplify the DLL export, and can be used for C aplications. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef int(* | imAttribTableCallback )(void *user_data, int index, const char *name, int data_type, int count, const void *data)

Functions

imAttribTablePrivate * | imAttribTableCreate (int hash_size)
void | imAttribTableDestroy (imAttribTablePrivate *ptable)
int | imAttribTableCount (imAttribTablePrivate *ptable)
void | imAttribTableRemoveAll (imAttribTablePrivate *ptable)
const void * | imAttribTableGet (const imAttribTablePrivate *ptable, const char *name, int *data_type, int *count)
void | imAttribTableSet (imAttribTablePrivate *ptable, const char *name, int data_type, int count, const void *data)
void | imAttribTableUnSet (imAttribTablePrivate *ptable, const char *name)
void | imAttribTableCopyFrom (imAttribTablePrivate *ptable_dst, const imAttribTablePrivate *ptable_src)
void | imAttribTableForEach (const imAttribTablePrivate *ptable, void *user_data, imAttribTableCallback attrib_func)
imAttribTablePrivate * | imAttribArrayCreate (int hash_size)
const void * | imAttribArrayGet (const imAttribTablePrivate *ptable, int index, char *name, int *data_type, int *count)
void | imAttribArraySet (imAttribTablePrivate *ptable, int index, const char *name, int data_type, int count, const void *data)
void | imAttribArrayCopyFrom (imAttribTablePrivate *ptable_dst, const imAttribTablePrivate *ptable_src)

Detailed Description

See Copyright Notice in im_lib.h

Typedef Documentation

typedef int(* imAttribTableCallback)(void *user_data, int index, const char *name, int data_type, int count, const void *data)

Definition of the callback used in ForEach function.


IM: im_binfile.h File Reference

im_binfile.h File Reference

Binary File Access. More...

Include dependency graph for im_binfile.h:

Go to the source code of this file.

Data Structures

struct | _imBinMemoryFileName
Memory File I/O Filename. More...

Typedefs

typedef struct _imBinFile | imBinFile
typedef struct _imBinMemoryFileName | imBinMemoryFileName

Enumerations

enum imBinFileModule {
IM_RAWFILE, IM_STREAM, IM_MEMFILE, IM_SUBFILE,
IM_FILEHANDLE, IM_IOCUSTOM0
}

Functions

imBinFile * | imBinFileOpen (const char *pFileName)
imBinFile * | imBinFileNew (const char *pFileName)
void | imBinFileClose (imBinFile *bfile)
int | imBinFileError (imBinFile *bfile)
unsigned long | imBinFileSize (imBinFile *bfile)
int | imBinFileByteOrder (imBinFile *bfile, int pByteOrder)
unsigned long | imBinFileRead (imBinFile *bfile, void *pValues, unsigned long pCount, int pSizeOf)
unsigned long | imBinFileWrite (imBinFile *bfile, void *pValues, unsigned long pCount, int pSizeOf)
unsigned long | imBinFilePrintf (imBinFile *bfile, char *format,...)
int | imBinFileReadInteger (imBinFile *handle, int *value)
int | imBinFileReadFloat (imBinFile *handle, float *value)
void | imBinFileSeekTo (imBinFile *bfile, unsigned long pOffset)
void | imBinFileSeekOffset (imBinFile *bfile, long pOffset)
void | imBinFileSeekFrom (imBinFile *bfile, long pOffset)
unsigned long | imBinFileTell (imBinFile *bfile)
int | imBinFileEndOfFile (imBinFile *bfile)
int | imBinFileSetCurrentModule (int pModule)
void | imBinMemoryRelease (unsigned char *buffer)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_capture.h File Reference

im_capture.h File Reference

Video Capture. More...

Go to the source code of this file.

Typedefs

typedef struct _imVideoCapture | imVideoCapture

Functions

int IM_DECL | imVideoCaptureDeviceCount (void)
const char *IM_DECL | imVideoCaptureDeviceDesc (int device)
const char *IM_DECL | imVideoCaptureDeviceExDesc (int device)
const char *IM_DECL | imVideoCaptureDevicePath (int device)
const char *IM_DECL | imVideoCaptureDeviceVendorInfo (int device)
int IM_DECL | imVideoCaptureReloadDevices (void)
void IM_DECL | imVideoCaptureReleaseDevices (void)
imVideoCapture *IM_DECL | imVideoCaptureCreate (void)
void IM_DECL | imVideoCaptureDestroy (imVideoCapture *vc)
int IM_DECL | imVideoCaptureConnect (imVideoCapture *vc, int device)
void IM_DECL | imVideoCaptureDisconnect (imVideoCapture *vc)
int IM_DECL | imVideoCaptureDialogCount (imVideoCapture *vc)
int IM_DECL | imVideoCaptureShowDialog (imVideoCapture *vc, int dialog, void *parent)
int IM_DECL | imVideoCaptureSetInOut (imVideoCapture *vc, int input, int output, int cross)
const char *IM_DECL | imVideoCaptureDialogDesc (imVideoCapture *vc, int dialog)
int IM_DECL | imVideoCaptureFormatCount (imVideoCapture *vc)
int IM_DECL | imVideoCaptureGetFormat (imVideoCapture *vc, int format, int *width, int *height, char *desc)
int IM_DECL | imVideoCaptureSetFormat (imVideoCapture *vc, int format)
void IM_DECL | imVideoCaptureGetImageSize (imVideoCapture *vc, int *width, int *height)
int IM_DECL | imVideoCaptureSetImageSize (imVideoCapture *vc, int width, int height)
int IM_DECL | imVideoCaptureFrame (imVideoCapture *vc, unsigned char *data, int color_mode, int timeout)
int IM_DECL | imVideoCaptureOneFrame (imVideoCapture *vc, unsigned char *data, int color_mode)
int IM_DECL | imVideoCaptureLive (imVideoCapture *vc, int live)
int IM_DECL | imVideoCaptureResetAttribute (imVideoCapture *vc, const char *attrib, int fauto)
int IM_DECL | imVideoCaptureGetAttribute (imVideoCapture *vc, const char *attrib, float *percent)
int IM_DECL | imVideoCaptureSetAttribute (imVideoCapture *vc, const char *attrib, float percent)
const char **IM_DECL | imVideoCaptureGetAttributeList (imVideoCapture *vc, int *num_attrib)

Detailed Description

See Copyright Notice in im.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_color.h File Reference

im_color.h File Reference

Color Manipulation. More...

Include dependency graph for im_color.h:

Go to the source code of this file.

Defines

#define | IM_FWLAB(_w)
#define | IM_GWLAB(_w)

Functions

float | imColorZero (int data_type)
int | imColorMax (int data_type)
template<class T >
T | imColorQuantize (const float &value, const T &max)
template<class T >
float | imColorReconstruct (const T &value, const T &max)
template<class T >
void | imColorYCbCr2RGB (const T Y, const T Cb, const T Cr, T &R, T &G, T &B, const T &zero, const T &max)
template<class T >
void | imColorRGB2YCbCr (const T R, const T G, const T B, T &Y, T &Cb, T &Cr, const T &zero)
template<class T >
void | imColorCMYK2RGB (const T C, const T M, const T Y, const T K, T &R, T &G, T &B, const T &max)
template<class T >
void | imColorXYZ2RGB (const T X, const T Y, const T Z, T &R, T &G, T &B, const T &max)
template<class T >
void | imColorRGB2XYZ (const T R, const T G, const T B, T &X, T &Y, T &Z)
void | imColorXYZ2Lab (const float X, const float Y, const float Z, float &L, float &a, float &b)
void | imColorLab2XYZ (const float L, const float a, const float b, float &X, float &Y, float &Z)
void | imColorXYZ2Luv (const float X, const float Y, const float Z, float &L, float &u, float &v)
void | imColorLuv2XYZ (const float L, const float u, const float v, float &X, float &Y, float &Z)
float | imColorTransfer2Linear (const float &nonlinear_value)
float | imColorTransfer2Nonlinear (const float &value)
void | imColorRGB2RGBNonlinear (const float RL, const float GL, const float BL, float &R, float &G, float &B)
template<class T >
T | imColorRGB2Luma (const T R, const T G, const T B)
float | imColorLuminance2Lightness (const float &Y)
float | imColorLightness2Luminance (const float &L)

Detailed Description

See Copyright Notice in im_lib.h

Define Documentation

#define IM_FWLAB ( _w )
Value:
(_w > 0.008856f?               \
                        powf(_w, 1.0f/3.0f):        \
                        7.787f * _w + 0.16f/1.16f)
#define IM_GWLAB ( _w )
Value:
(_w > 0.20689f?                     \
                         powf(_w, 3.0f):                  \
                         0.1284f * (_w - 0.16f/1.16f))


IM: im_colorhsi.h File Reference

Functions

im_colorhsi.h File Reference

HSI Color Manipulation. More...

Go to the source code of this file.

Functions

float | imColorHSI_ImaxS (float h, double cosh, double sinh)
void | imColorRGB2HSI (float r, float g, float b, float *h, float *s, float *i)
void | imColorRGB2HSIbyte (unsigned char r, unsigned char g, unsigned char b, float *h, float *s, float *i)
void | imColorHSI2RGB (float h, float s, float i, float *r, float *g, float *b)
void | imColorHSI2RGBbyte (float h, float s, float i, unsigned char *r, unsigned char *g, unsigned char *b)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_complex.h File Reference

im_complex.h File Reference

Complex Data Type. More...

Include dependency graph for im_complex.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class | imcfloat
Complex Float Data Type. More...

Functions

int | operator<= (const imcfloat &C1, const imcfloat &C2)
int | operator<= (const imcfloat &C, const float &F)
int | operator< (const imcfloat &C1, const imcfloat &C2)
int | operator< (const imcfloat &C, const float &F)
int | operator> (const imcfloat &C1, const imcfloat &C2)
int | operator> (const imcfloat &C, const float &F)
imcfloat | operator+ (const imcfloat &C1, const imcfloat &C2)
imcfloat | operator+= (const imcfloat &C1, const imcfloat &C2)
imcfloat | operator- (const imcfloat &C1, const imcfloat &C2)
imcfloat | operator* (const imcfloat &C1, const imcfloat &C2)
imcfloat | operator/ (const imcfloat &C1, const imcfloat &C2)
imcfloat | operator/ (const imcfloat &C, const float &R)
imcfloat | operator/= (const imcfloat &C, const float &R)
imcfloat | operator* (const imcfloat &C, const float &R)
int | operator== (const imcfloat &C1, const imcfloat &C2)
float | cpxreal (const imcfloat &C)
float | cpximag (const imcfloat &C)
float | cpxmag (const imcfloat &C)
float | cpxphase (const imcfloat &C)
imcfloat | cpxconj (const imcfloat &C)
imcfloat | log (const imcfloat &C)
imcfloat | exp (const imcfloat &C)
imcfloat | pow (const imcfloat &C1, const imcfloat &C2)
imcfloat | sqrt (const imcfloat &C)
imcfloat | cpxpolar (const float &mag, const float &phase)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_convert.h File Reference

im_convert.h File Reference

Image Conversion. More...

Include dependency graph for im_convert.h:

Go to the source code of this file.

Enumerations

enum | imComplex2Real { IM_CPX_REAL, IM_CPX_IMAG, IM_CPX_MAG, IM_CPX_PHASE }
enum imGammaFactor {
IM_GAMMA_LINEAR = 0, IM_GAMMA_LOGLITE = -10, IM_GAMMA_LOGHEAVY = -1000, IM_GAMMA_EXPLITE = 2,
IM_GAMMA_EXPHEAVY = 7
}
enum | imCastMode { IM_CAST_MINMAX, IM_CAST_FIXED, IM_CAST_DIRECT }

Functions

int | imConvertDataType (const imImage *src_image, imImage *dst_image, int cpx2real, float gamma, int abssolute, int cast_mode)
int | imConvertColorSpace (const imImage *src_image, imImage *dst_image)
int | imConvertToBitmap (const imImage *src_image, imImage *dst_image, int cpx2real, float gamma, int abssolute, int cast_mode)
void * | imImageGetOpenGLData (const imImage *image, int *glformat)
imImage * | imImageCreateFromOpenGLData (int width, int height, int glformat, const void *gldata)
void | imConvertPacking (const void *src_data, void *dst_data, int width, int height, int src_depth, int dst_depth, int data_type, int src_is_packed)
void | imConvertMapToRGB (unsigned char *data, int count, int depth, int packed, long *palette, int palette_count)
int | imConvertRGB2Map (int width, int height, unsigned char *red, unsigned char *green, unsigned char *blue, unsigned char *map, long *palette, int *palette_count)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_counter.h File Reference

im_counter.h File Reference

Processing Counter. More...

Go to the source code of this file.

Typedefs

typedef int(* | imCounterCallback )(int counter, void *user_data, const char *text, int progress)

Functions

imCounterCallback | imCounterSetCallback (void *user_data, imCounterCallback counter_func)
int | imCounterBegin (const char *title)
void | imCounterEnd (int counter)
int | imCounterInc (int counter)
int | imCounterIncTo (int counter, int count)
void | imCounterTotal (int counter, int total, const char *message)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_dib.h File Reference

im_dib.h File Reference

Windows DIB (Device Independent Bitmap). More...

Go to the source code of this file.

Data Structures

struct | _imDib
Windows DIB Structure. More...

Typedefs

typedef struct _imDib | imDib
typedef unsigned int(* | imDibLineGetPixel )(unsigned char *line, int col)
typedef void(* | imDibLineSetPixel )(unsigned char *line, int col, unsigned int pixel)

Functions

imDib * | imDibCreate (int width, int height, int bpp)
imDib * | imDibCreateCopy (const imDib *dib)
imDib * | imDibCreateReference (BYTE *bmi, BYTE *bits)
imDib * | imDibCreateSection (HDC hDC, HBITMAP *image, int width, int height, int bpp)
void | imDibDestroy (imDib *dib)
imDibLineGetPixel | imDibLineGetPixelFunc (int bpp)
imDibLineSetPixel | imDibLineSetPixelFunc (int bpp)
imDib * | imDibFromHBitmap (const HBITMAP image, const HPALETTE hPalette)
HBITMAP | imDibToHBitmap (const imDib *dib)
HPALETTE | imDibLogicalPalette (const imDib *dib)
imDib * | imDibCaptureScreen (int x, int y, int width, int height)
void | imDibCopyClipboard (imDib *dib)
imDib * | imDibPasteClipboard (void)
int | imDibIsClipboardAvailable (void)
int | imDibSaveFile (const imDib *dib, const char *filename)
imDib * | imDibLoadFile (const char *filename)
void | imDibDecodeToRGBA (const imDib *dib, unsigned char *red, unsigned char *green, unsigned char *blue, unsigned char *alpha)
void | imDibDecodeToMap (const imDib *dib, unsigned char *map, long *palette)
void | imDibEncodeFromRGBA (imDib *dib, const unsigned char *red, const unsigned char *green, const unsigned char *blue, const unsigned char *alpha)
void | imDibEncodeFromMap (imDib *dib, const unsigned char *map, const long *palette, int palette_count)
void | imDibEncodeFromBitmap (imDib *dib, const unsigned char *data)
void | imDibDecodeToBitmap (const imDib *dib, unsigned char *data)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_file.h File Reference

im_file.h File Reference

File Access. More...

Include dependency graph for im_file.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct | _imFile
Image File Format Base Class (SDK Use Only). More...

Functions

void | imFileClear (imFile *ifile)
void | imFileLineBufferInit (imFile *ifile)
int | imFileCheckConversion (imFile *ifile)
int | imFileLineBufferCount (imFile *ifile)
void | imFileLineBufferInc (imFile *ifile, int *row, int *plane)
void | imFileLineBufferRead (imFile *ifile, void *data, int line, int plane)
void | imFileLineBufferWrite (imFile *ifile, const void *data, int line, int plane)
int | imFileLineSizeAligned (int width, int bpp, int align)
void | imFileSetBaseAttributes (imFile *ifile)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format.h File Reference

im_format.h File Reference

File Format Access. More...

Include dependency graph for im_format.h:

Go to the source code of this file.

Data Structures

class | imFileFormatBase
Image File Format Virtual Class (SDK Use Only). More...
class | imFormat
Image File Format Descriptor (SDK Use Only). More...

Functions

imFileFormatBase * | imFileFormatBaseOpen (const char *file_name, int *error)
imFileFormatBase * | imFileFormatBaseOpenAs (const char *file_name, const char *format, int *error)
imFileFormatBase * | imFileFormatBaseNew (const char *file_name, const char *format, int *error)
void | imFormatRegister (imFormat *iformat)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_all.h File Reference

Functions

im_format_all.h File Reference

All the Internal File Formats. They are all automatically registered by the library. The signatures are in C, but the functions are C++. Header for internal use only. More...

Go to the source code of this file.

Functions

void | imFormatRegisterTIFF (void)
void | imFormatRegisterJPEG (void)
void | imFormatRegisterPNG (void)
void | imFormatRegisterGIF (void)
void | imFormatRegisterBMP (void)
void | imFormatRegisterRAS (void)
void | imFormatRegisterLED (void)
void | imFormatRegisterSGI (void)
void | imFormatRegisterPCX (void)
void | imFormatRegisterTGA (void)
void | imFormatRegisterPNM (void)
void | imFormatRegisterICO (void)
void | imFormatRegisterKRN (void)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_avi.h File Reference

Functions

im_format_avi.h File Reference

Register the AVI Format. More...

Go to the source code of this file.

Functions

void imFormatRegisterAVI (void)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_jp2.h File Reference

Functions

im_format_jp2.h File Reference

Register the JP2 Format. More...

Go to the source code of this file.

Functions

void imFormatRegisterJP2 (void)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_raw.h File Reference

Functions

im_format_raw.h File Reference

Initialize the RAW Format Driver Header for internal use only. More...

Go to the source code of this file.

Functions

imFormat * | imFormatInitRAW (void)
void | imFormatFinishRAW (void)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_wmv.h File Reference

Functions

im_format_wmv.h File Reference

Register the WMF Format. More...

Go to the source code of this file.

Functions

void imFormatRegisterWMV (void)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_image.h File Reference

im_image.h File Reference

Image Manipulation. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct | _imImage
imImage Structure Definition. More...

Defines

#define | imcdCanvasPutImage(_canvas, _image, _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax)

Typedefs

typedef struct _imImage | imImage

Functions

imImage * | imImageCreate (int width, int height, int color_space, int data_type)
imImage * | imImageInit (int width, int height, int color_space, int data_type, void *data_buffer, long *palette, int palette_count)
imImage * | imImageCreateBased (const imImage *image, int width, int height, int color_space, int data_type)
void | imImageDestroy (imImage *image)
void | imImageAddAlpha (imImage *image)
void | imImageSetAlpha (imImage *image, float alpha)
void | imImageReshape (imImage *image, int width, int height)
void | imImageCopy (const imImage *src_image, imImage *dst_image)
void | imImageCopyData (const imImage *src_image, imImage *dst_image)
void | imImageCopyAttributes (const imImage *src_image, imImage *dst_image)
void | imImageCopyPlane (const imImage *src_image, int src_plane, imImage *dst_image, int dst_plane)
imImage * | imImageDuplicate (const imImage *image)
imImage * | imImageClone (const imImage *image)
void | imImageSetAttribute (const imImage *image, const char *attrib, int data_type, int count, const void *data)
const void * | imImageGetAttribute (const imImage *image, const char *attrib, int *data_type, int *count)
void | imImageGetAttributeList (const imImage *image, char **attrib, int *attrib_count)
void | imImageClear (imImage *image)
int | imImageIsBitmap (const imImage *image)
void | imImageSetPalette (imImage *image, long *palette, int palette_count)
int | imImageMatchSize (const imImage *image1, const imImage *image2)
int | imImageMatchColor (const imImage *image1, const imImage *image2)
int | imImageMatchDataType (const imImage *image1, const imImage *image2)
int | imImageMatchColorSpace (const imImage *image1, const imImage *image2)
int | imImageMatch (const imImage *image1, const imImage *image2)
void | imImageSetBinary (imImage *image)
void | imImageMakeBinary (imImage *image)
void | imImageMakeGray (imImage *image)
imImage * | imFileLoadImage (imFile *ifile, int index, int *error)
void | imFileLoadImageFrame (imFile *ifile, int index, imImage *image, int *error)
imImage * | imFileLoadBitmap (imFile *ifile, int index, int *error)
imImage * | imFileLoadImageRegion (imFile *ifile, int index, int bitmap, int *error, int xmin, int xmax, int ymin, int ymax, int width, int height)
void | imFileLoadBitmapFrame (imFile *ifile, int index, imImage *image, int *error)
int | imFileSaveImage (imFile *ifile, const imImage *image)
imImage * | imFileImageLoad (const char *file_name, int index, int *error)
imImage * | imFileImageLoadBitmap (const char *file_name, int index, int *error)
imImage * | imFileImageLoadRegion (const char *file_name, int index, int bitmap, int *error, int xmin, int xmax, int ymin, int ymax, int width, int height)
int | imFileImageSave (const char *file_name, const char *format, const imImage *image)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_lib.h File Reference

im_lib.h File Reference

Library Management and Main Documentation. More...

Go to the source code of this file.

Defines

#define | IM_AUTHOR "Antonio Scuri"
#define | IM_COPYRIGHT "Copyright (C) 1994-2010 Tecgraf, PUC-Rio."
#define | IM_VERSION "3.6"
#define | IM_VERSION_NUMBER 306000
#define | IM_VERSION_DATE "2010/01/26"
#define | IM_DESCRIPTION "Image Representation, Storage, Capture and Processing"
#define | IM_NAME "IM - An Imaging Toolkit"

Functions

const char * | imVersion (void)
const char * | imVersionDate (void)
int | imVersionNumber (void)

Detailed Description

See Copyright Notice in this file.


IM: im_math.h File Reference

im_math.h File Reference

Math Utilities. More...

Include dependency graph for im_math.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define | C0 (-c3 + 2.0f*c2 - c)
#define | C1 ( c3 - 2.0f*c2 + 1.0f)
#define | C2 (-c3 + c2 + c)
#define | C3 ( c3 - c2)

Functions

int | imRound (float x)
int | imRound (double x)
int | imResample (int x, float factor)
template<class T , class TU >
T | imZeroOrderDecimation (int width, int height, T *map, float xl, float yl, float box_width, float box_height, TU Dummy)
template<class T , class TU >
T | imBilinearDecimation (int width, int height, T *map, float xl, float yl, float box_width, float box_height, TU Dummy)
template<class T >
T | imZeroOrderInterpolation (int width, int height, T *map, float xl, float yl)
template<class T >
T | imBilinearInterpolation (int width, int height, T *map, float xl, float yl)
template<class T , class TU >
T | imBicubicInterpolation (int width, int height, T *map, float xl, float yl, TU Dummy)
template<class T >
void | imMinMax (const T *map, int count, T &min, T &max)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_math_op.h File Reference

Functions

im_math_op.h File Reference

Math Operations. More...

Include dependency graph for im_math_op.h:

Go to the source code of this file.

Functions

template<class T >
T | crop_byte (const T &v)
template<class T1 , class T2 >
T1 | add_op (const T1 &v1, const T2 &v2)
template<class T1 , class T2 >
T1 | sub_op (const T1 &v1, const T2 &v2)
template<class T1 , class T2 >
T1 | mul_op (const T1 &v1, const T2 &v2)
template<class T1 , class T2 >
T1 | div_op (const T1 &v1, const T2 &v2)
template<class T >
T | inv_op (const T &v)
template<class T1 , class T2 >
T1 | diff_op (const T1 &v1, const T2 &v2)
template<class T1 , class T2 >
T1 | min_op (const T1 &v1, const T2 &v2)
template<class T1 , class T2 >
T1 | max_op (const T1 &v1, const T2 &v2)
imbyte | pow_op (const imbyte &v1, const imbyte &v2)
imushort | pow_op (const imushort &v1, const imushort &v2)
int | pow_op (const int &v1, const int &v2)
template<class T1 , class T2 >
T1 | pow_op (const T1 &v1, const T2 &v2)
template<class T >
T | abs_op (const T &v)
template<class T >
T | less_op (const T &v)
template<class T >
T | sqr_op (const T &v)
int | sqrt (const int &C)
template<class T >
T | sqrt_op (const T &v)
int | exp (const int &v)
template<class T >
T | exp_op (const T &v)
int | log (const int &v)
template<class T >
T | log_op (const T &v)
imcfloat | sin (const imcfloat &v)
int | sin (const int &v)
template<class T >
T | sin_op (const T &v)
int | cos (const int &v)
imcfloat | cos (const imcfloat &v)
template<class T >
T | cos_op (const T &v)
void | imDataBitSet (imbyte *data, int index, int bit)
int | imDataBitGet (imbyte *data, int index)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_palette.h File Reference

Functions

im_palette.h File Reference

Palette Generators. More...

Go to the source code of this file.

Functions

int | imPaletteFindNearest (const long *palette, int palette_count, long color)
int | imPaletteFindColor (const long *palette, int palette_count, long color, unsigned char tol)
long * | imPaletteGray (void)
long * | imPaletteRed (void)
long * | imPaletteGreen (void)
long * | imPaletteBlue (void)
long * | imPaletteYellow (void)
long * | imPaletteMagenta (void)
long * | imPaletteCian (void)
long * | imPaletteRainbow (void)
long * | imPaletteHues (void)
long * | imPaletteBlueIce (void)
long * | imPaletteHotIron (void)
long * | imPaletteBlackBody (void)
long * | imPaletteHighContrast (void)
long * | imPaletteUniform (void)
int | imPaletteUniformIndex (long color)
int | imPaletteUniformIndexHalftoned (long color, int x, int y)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_plus.h File Reference

Data Structures

im_plus.h File Reference

C++ Wrapper for File Access. More...

Go to the source code of this file.

Data Structures

class imImageFile
C++ Wrapper for the Image File Structure. More...

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_process_ana.h File Reference

im_process_ana.h File Reference

Image Statistics and Analysis. More...

Include dependency graph for im_process_ana.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct | _imStats

Typedefs

typedef struct _imStats | imStats

Functions

float | imCalcRMSError (const imImage *image1, const imImage *image2)
float | imCalcSNR (const imImage *src_image, const imImage *noise_image)
unsigned long | imCalcCountColors (const imImage *image)
void | imCalcHistogram (const unsigned char *data, int count, unsigned long *histo, int cumulative)
void | imCalcUShortHistogram (const unsigned short *data, int count, unsigned long *histo, int cumulative)
void | imCalcGrayHistogram (const imImage *image, unsigned long *histo, int cumulative)
void | imCalcImageStatistics (const imImage *image, imStats *stats)
void | imCalcHistogramStatistics (const imImage *image, imStats *stats)
void | imCalcHistoImageStatistics (const imImage *image, int *median, int *mode)
int | imAnalyzeFindRegions (const imImage *src_image, imImage *dst_image, int connect, int touch_border)
void | imAnalyzeMeasureArea (const imImage *image, int *area, int region_count)
void | imAnalyzeMeasurePerimArea (const imImage *image, float *perimarea)
void | imAnalyzeMeasureCentroid (const imImage *image, const int *area, int region_count, float *cx, float *cy)
void | imAnalyzeMeasurePrincipalAxis (const imImage *image, const int *area, const float *cx, const float *cy, const int region_count, float *major_slope, float *major_length, float *minor_slope, float *minor_length)
void | imAnalyzeMeasureHoles (const imImage *image, int connect, int *holes_count, int *area, float *perim)
void | imAnalyzeMeasurePerimeter (const imImage *image, float *perim, int region_count)
void | imProcessPerimeterLine (const imImage *src_image, imImage *dst_image)
void | imProcessRemoveByArea (const imImage *src_image, imImage *dst_image, int connect, int start_size, int end_size, int inside)
void | imProcessFillHoles (const imImage *src_image, imImage *dst_image, int connect)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_process_glo.h File Reference

Functions

im_process_glo.h File Reference

Image Processing - Global Operations. More...

Include dependency graph for im_process_glo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int | imProcessHoughLines (const imImage *src_image, imImage *dst_image)
int | imProcessHoughLinesDraw (const imImage *src_image, const imImage *hough, const imImage *hough_points, imImage *dst_image)
void | imProcessCrossCorrelation (const imImage *src_image1, const imImage *src_image2, imImage *dst_image)
void | imProcessAutoCorrelation (const imImage *src_image, imImage *dst_image)
void | imProcessDistanceTransform (const imImage *src_image, imImage *dst_image)
void | imProcessRegionalMaximum (const imImage *src_image, imImage *dst_image)
void | imProcessFFT (const imImage *src_image, imImage *dst_image)
void | imProcessIFFT (const imImage *src_image, imImage *dst_image)
void | imProcessFFTraw (imImage *image, int inverse, int center, int normalize)
void | imProcessSwapQuadrants (imImage *image, int center2origin)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_process_loc.h File Reference

Functions

im_process_loc.h File Reference

Image Processing - Local Operations. More...

Include dependency graph for im_process_loc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int | imProcessReduce (const imImage *src_image, imImage *dst_image, int order)
int | imProcessResize (const imImage *src_image, imImage *dst_image, int order)
void | imProcessReduceBy4 (const imImage *src_image, imImage *dst_image)
void | imProcessCrop (const imImage *src_image, imImage *dst_image, int xmin, int ymin)
void | imProcessInsert (const imImage *src_image, const imImage *region_image, imImage *dst_image, int xmin, int ymin)
void | imProcessAddMargins (const imImage *src_image, imImage *dst_image, int xmin, int ymin)
void | imProcessCalcRotateSize (int width, int height, int *new_width, int *new_height, double cos0, double sin0)
int | imProcessRotate (const imImage *src_image, imImage *dst_image, double cos0, double sin0, int order)
int | imProcessRotateRef (const imImage *src_image, imImage *dst_image, double cos0, double sin0, int x, int y, int to_origin, int order)
void | imProcessRotate90 (const imImage *src_image, imImage *dst_image, int dir_clockwise)
void | imProcessRotate180 (const imImage *src_image, imImage *dst_image)
void | imProcessMirror (const imImage *src_image, imImage *dst_image)
void | imProcessFlip (const imImage *src_image, imImage *dst_image)
int | imProcessRadial (const imImage *src_image, imImage *dst_image, float k1, int order)
int | imProcessSwirl (const imImage *src_image, imImage *dst_image, float k1, int order)
void | imProcessInterlaceSplit (const imImage *src_image, imImage *dst_image1, imImage *dst_image2)
int | imProcessGrayMorphConvolve (const imImage *src_image, imImage *dst_image, const imImage *kernel, int ismax)
int | imProcessGrayMorphErode (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphDilate (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphOpen (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphClose (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphTopHat (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphWell (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGrayMorphGradient (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessBinMorphConvolve (const imImage *src_image, imImage *dst_image, const imImage *kernel, int hit_white, int iter)
int | imProcessBinMorphErode (const imImage *src_image, imImage *dst_image, int kernel_size, int iter)
int | imProcessBinMorphDilate (const imImage *src_image, imImage *dst_image, int kernel_size, int iter)
int | imProcessBinMorphOpen (const imImage *src_image, imImage *dst_image, int kernel_size, int iter)
int | imProcessBinMorphClose (const imImage *src_image, imImage *dst_image, int kernel_size, int iter)
int | imProcessBinMorphOutline (const imImage *src_image, imImage *dst_image, int kernel_size, int iter)
void | imProcessBinMorphThin (const imImage *src_image, imImage *dst_image)
int | imProcessMedianConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessRangeConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessRankClosestConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessRankMaxConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessRankMinConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessRangeContrastThreshold (const imImage *src_image, imImage *dst_image, int kernel_size, int min_range)
int | imProcessLocalMaxThreshold (const imImage *src_image, imImage *dst_image, int kernel_size, int min_level)
int | imProcessConvolve (const imImage *src_image, imImage *dst_image, const imImage *kernel)
int | imProcessConvolveSep (const imImage *src_image, imImage *dst_image, const imImage *kernel)
int | imProcessConvolveDual (const imImage *src_image, imImage *dst_image, const imImage *kernel1, const imImage *kernel2)
int | imProcessConvolveRep (const imImage *src_image, imImage *dst_image, const imImage *kernel, int count)
int | imProcessCompassConvolve (const imImage *src_image, imImage *dst_image, imImage *kernel)
void | imProcessRotateKernel (imImage *kernel)
int | imProcessDiffOfGaussianConvolve (const imImage *src_image, imImage *dst_image, float stddev1, float stddev2)
int | imProcessLapOfGaussianConvolve (const imImage *src_image, imImage *dst_image, float stddev)
int | imProcessMeanConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessGaussianConvolve (const imImage *src_image, imImage *dst_image, float stddev)
int | imProcessBarlettConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int | imProcessSobelConvolve (const imImage *src_image, imImage *dst_image)
int | imProcessPrewittConvolve (const imImage *src_image, imImage *dst_image)
int | imProcessSplineEdgeConvolve (const imImage *src_image, imImage *dst_image)
void | imProcessZeroCrossing (const imImage *src_image, imImage *dst_image)
void | imProcessCanny (const imImage *src_image, imImage *dst_image, float stddev)
int | imGaussianStdDev2KernelSize (float stddev)
float | imGaussianKernelSize2StdDev (int kernel_size)
int | imProcessUnsharp (const imImage *src_image, imImage *dst_image, float stddev, float amount, float threshold)
int | imProcessSharp (const imImage *src_image, imImage *dst_image, float amount, float threshold)
int | imProcessSharpKernel (const imImage *src_image, const imImage *kernel, imImage *dst_image, float amount, float threshold)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_process_pon.h File Reference

im_process_pon.h File Reference

Image Processing - Pontual Operations. More...

Include dependency graph for im_process_pon.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef float(* | imRenderFunc )(int x, int y, int d, float *param)
typedef float(* | imRenderCondFunc )(int x, int y, int d, int *cond, float *param)

Enumerations

enum imUnaryOp {
IM_UN_EQL, IM_UN_ABS, IM_UN_LESS, IM_UN_INV,
IM_UN_SQR, IM_UN_SQRT, IM_UN_LOG, IM_UN_EXP,
IM_UN_SIN, IM_UN_COS, IM_UN_CONJ, IM_UN_CPXNORM
}
enum imBinaryOp {
IM_BIN_ADD, IM_BIN_SUB, IM_BIN_MUL, IM_BIN_DIV,
IM_BIN_DIFF, IM_BIN_POW, IM_BIN_MIN, IM_BIN_MAX
}
enum | imLogicOp { IM_BIT_AND, IM_BIT_OR, IM_BIT_XOR }
enum imToneGamut {
IM_GAMUT_NORMALIZE, IM_GAMUT_POW, IM_GAMUT_LOG, IM_GAMUT_EXP,
IM_GAMUT_INVERT, IM_GAMUT_ZEROSTART, IM_GAMUT_SOLARIZE, IM_GAMUT_SLICE,
IM_GAMUT_EXPAND, IM_GAMUT_CROP, IM_GAMUT_BRIGHTCONT
}

Functions

void | imProcessUnArithmeticOp (const imImage *src_image, imImage *dst_image, int op)
void | imProcessArithmeticOp (const imImage *src_image1, const imImage *src_image2, imImage *dst_image, int op)
void | imProcessArithmeticConstOp (const imImage *src_image, float src_const, imImage *dst_image, int op)
void | imProcessBlendConst (const imImage *src_image1, const imImage *src_image2, imImage *dst_image, float alpha)
void | imProcessBlend (const imImage *src_image1, const imImage *src_image2, const imImage *alpha_image, imImage *dst_image)
void | imProcessCompose (const imImage *src_image1, const imImage *src_image2, imImage *dst_image)
void | imProcessSplitComplex (const imImage *src_image, imImage *dst_image1, imImage *dst_image2, int polar)
void | imProcessMergeComplex (const imImage *src_image1, const imImage *src_image2, imImage *dst_image, int polar)
void | imProcessMultipleMean (const imImage **src_image_list, int src_image_count, imImage *dst_image)
void | imProcessMultipleStdDev (const imImage **src_image_list, int src_image_count, const imImage *mean_image, imImage *dst_image)
int | imProcessAutoCovariance (const imImage *src_image, const imImage *mean_image, imImage *dst_image)
void | imProcessMultiplyConj (const imImage *src_image1, const imImage *src_image2, imImage *dst_image)
void | imProcessQuantizeRGBUniform (const imImage *src_image, imImage *dst_image, int do_dither)
void | imProcessQuantizeGrayUniform (const imImage *src_image, imImage *dst_image, int grays)
void | imProcessExpandHistogram (const imImage *src_image, imImage *dst_image, float percent)
void | imProcessEqualizeHistogram (const imImage *src_image, imImage *dst_image)
void | imProcessSplitYChroma (const imImage *src_image, imImage *y_image, imImage *chroma_image)
void | imProcessSplitHSI (const imImage *src_image, imImage *h_image, imImage *s_image, imImage *i_image)
void | imProcessMergeHSI (const imImage *h_image, const imImage *s_image, const imImage *i_image, imImage *dst_image)
void | imProcessSplitComponents (const imImage *src_image, imImage **dst_image_list)
void | imProcessMergeComponents (const imImage **src_image_list, imImage *dst_image)
void | imProcessNormalizeComponents (const imImage *src_image, imImage *dst_image)
void | imProcessReplaceColor (const imImage *src_image, imImage *dst_image, float *src_color, float *dst_color)
void | imProcessBitwiseOp (const imImage *src_image1, const imImage *src_image2, imImage *dst_image, int op)
void | imProcessBitwiseNot (const imImage *src_image, imImage *dst_image)
void | imProcessBitMask (const imImage *src_image, imImage *dst_image, unsigned char mask, int op)
void | imProcessBitPlane (const imImage *src_image, imImage *dst_image, int plane, int do_reset)
int | imProcessRenderOp (imImage *image, imRenderFunc render_func, char *render_name, float *param, int plus)
int | imProcessRenderCondOp (imImage *image, imRenderCondFunc render_cond_func, char *render_name, float *param)
int | imProcessRenderAddSpeckleNoise (const imImage *src_image, imImage *dst_image, float percent)
int | imProcessRenderAddGaussianNoise (const imImage *src_image, imImage *dst_image, float mean, float stddev)
int | imProcessRenderAddUniformNoise (const imImage *src_image, imImage *dst_image, float mean, float stddev)
int | imProcessRenderRandomNoise (imImage *image)
int | imProcessRenderConstant (imImage *image, float *value)
int | imProcessRenderWheel (imImage *image, int internal_radius, int external_radius)
int | imProcessRenderCone (imImage *image, int radius)
int | imProcessRenderTent (imImage *image, int tent_width, int tent_height)
int | imProcessRenderRamp (imImage *image, int start, int end, int vert_dir)
int | imProcessRenderBox (imImage *image, int box_width, int box_height)
int | imProcessRenderSinc (imImage *image, float x_period, float y_period)
int | imProcessRenderGaussian (imImage *image, float stddev)
int | imProcessRenderLapOfGaussian (imImage *image, float stddev)
int | imProcessRenderCosine (imImage *image, float x_period, float y_period)
int | imProcessRenderGrid (imImage *image, int x_space, int y_space)
int | imProcessRenderChessboard (imImage *image, int x_space, int y_space)
void | imProcessToneGamut (const imImage *src_image, imImage *dst_image, int op, float *param)
void | imProcessUnNormalize (const imImage *src_image, imImage *dst_image)
void | imProcessDirectConv (const imImage *src_image, imImage *dst_image)
void | imProcessNegative (const imImage *src_image, imImage *dst_image)
void | imProcessThreshold (const imImage *src_image, imImage *dst_image, int level, int value)
void | imProcessThresholdByDiff (const imImage *src_image1, const imImage *src_image2, imImage *dst_image)
void | imProcessHysteresisThreshold (const imImage *src_image, imImage *dst_image, int low_thres, int high_thres)
void | imProcessHysteresisThresEstimate (const imImage *image, int *low_level, int *high_level)
int | imProcessUniformErrThreshold (const imImage *src_image, imImage *dst_image)
void | imProcessDifusionErrThreshold (const imImage *src_image, imImage *dst_image, int level)
int | imProcessPercentThreshold (const imImage *src_image, imImage *dst_image, float percent)
int | imProcessOtsuThreshold (const imImage *src_image, imImage *dst_image)
int | imProcessMinMaxThreshold (const imImage *src_image, imImage *dst_image)
void | imProcessLocalMaxThresEstimate (const imImage *image, int *level)
void | imProcessSliceThreshold (const imImage *src_image, imImage *dst_image, int start_level, int end_level)
void | imProcessPixelate (const imImage *src_image, imImage *dst_image, int box_size)
void | imProcessPosterize (const imImage *src_image, imImage *dst_image, int level)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_raw.h File Reference

Functions

im_raw.h File Reference

RAW File Format. More...

Go to the source code of this file.

Functions

imFile * | imFileOpenRaw (const char *file_name, int *error)
imFile * | imFileNewRaw (const char *file_name, int *error)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_util.h File Reference

im_util.h File Reference

Utilities. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define | IM_MIN(_a, _b) (_a < _b? _a: _b)
#define | IM_MAX(_a, _b) (_a > _b? _a: _b)
#define | imColorModeSpace(_cm) (_cm & 0xFF)
#define | imColorModeMatch(_cm1, _cm2) (imColorModeSpace(_cm1) == imColorModeSpace(_cm2))
#define | imColorModeHasAlpha(_cm) (_cm & IM_ALPHA)
#define | imColorModeIsPacked(_cm) (_cm & IM_PACKED)
#define | imColorModeIsTopDown(_cm) (_cm & IM_TOPDOWN)
#define | IM_BYTECROP(_v) (_v < 0? 0: _v > 255? 255: _v)
#define | IM_CROPMAX(_v, _max) (_v < 0? 0: _v > _max? _max: _v)

Typedefs

typedef unsigned char | imbyte
typedef unsigned short | imushort

Enumerations

enum | imByteOrder { IM_LITTLEENDIAN, IM_BIGENDIAN }

Functions

int | imStrEqual (const char *str1, const char *str2)
int | imStrNLen (const char *str, int max_len)
int | imStrCheck (const void *data, int count)
int | imImageDataSize (int width, int height, int color_mode, int data_type)
int | imImageLineSize (int width, int color_mode, int data_type)
int | imImageLineCount (int width, int color_mode)
int | imImageCheckFormat (int color_mode, int data_type)
long | imColorEncode (unsigned char red, unsigned char green, unsigned char blue)
void | imColorDecode (unsigned char *red, unsigned char *green, unsigned char *blue, long color)
const char * | imColorModeSpaceName (int color_mode)
int | imColorModeDepth (int color_mode)
int | imColorModeToBitmap (int color_mode)
int | imColorModeIsBitmap (int color_mode, int data_type)
int | imDataTypeSize (int data_type)
const char * | imDataTypeName (int data_type)
unsigned long | imDataTypeIntMax (int data_type)
long | imDataTypeIntMin (int data_type)
int | imBinCPUByteOrder (void)
void | imBinSwapBytes (void *data, int count, int size)
void | imBinSwapBytes2 (void *data, int count)
void | imBinSwapBytes4 (void *data, int count)
void | imBinSwapBytes8 (void *data, int count)
int | imCompressDataZ (const void *src_data, int src_size, void *dst_data, int dst_size, int zip_quality)
int | imCompressDataUnZ (const void *src_data, int src_size, void *dst_data, int dst_size)
int | imCompressDataLZF (const void *src_data, int src_size, void *dst_data, int dst_size, int zip_quality)
int | imCompressDataUnLZF (const void *src_data, int src_size, void *dst_data, int dst_size)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: imlua.h File Reference

Functions

imlua.h File Reference

IM Lua 5 Binding. More...

Go to the source code of this file.

Functions

int | imlua_open (lua_State *L)
int | luaopen_imlua (lua_State *L)
int | imlua_open_capture (lua_State *L)
int | luaopen_imlua_capture (lua_State *L)
int | imlua_open_process (lua_State *L)
int | luaopen_imlua_process (lua_State *L)
int | imlua_open_fftw (lua_State *L)
int | luaopen_imlua_fftw (lua_State *L)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: old_im.h File Reference

old_im.h File Reference

Old API. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define | IM_ERR_READ IM_ERR_ACCESS
#define | IM_ERR_WRITE IM_ERR_ACCESS
#define | IM_ERR_TYPE IM_ERR_DATA
#define | IM_ERR_COMP IM_ERR_COMPRESS
#define | IM_INTERRUPTED -1
#define | IM_ALL -1
#define | IM_COUNTER_CB 0
#define | IM_RESOLUTION_CB 1
#define | IM_GIF_TRANSPARENT_COLOR_CB 0
#define | IM_TIF_IMAGE_DESCRIPTION_CB 0

Typedefs

typedef int(* | imCallback )(char *filename)
typedef int(* | imFileCounterCallback )(char *filename, int percent, int io)
typedef int(* | imResolutionCallback )(char *filename, double *xres, double *yres, int *res_unit)
typedef int(* | imGifTranspIndex )(char *filename, unsigned char *transp_index)
typedef int(* | imTiffImageDesc )(char *filename, char *img_desc)

Enumerations

enum {
IM_BMP, IM_PCX, IM_GIF, IM_TIF,
IM_RAS, IM_SGI, IM_JPG, IM_LED,
IM_TGA
}
enum | { IM_NONE = 0x0000, IM_DEFAULT = 0x0100, IM_COMPRESSED = 0x0200 }
enum | { IM_RES_NONE, IM_RES_DPI, IM_RES_DPC }

Functions

long | imEncodeColor (unsigned char red, unsigned char green, unsigned char blue)
void | imDecodeColor (unsigned char *red, unsigned char *green, unsigned char *blue, long palette)
int | imFileFormat (char *filename, int *format)
int | imImageInfo (char *filename, int *width, int *height, int *type, int *palette_count)
int | imLoadRGB (char *filename, unsigned char *red, unsigned char *green, unsigned char *blue)
int | imSaveRGB (int width, int height, int format, unsigned char *red, unsigned char *green, unsigned char *blue, char *filename)
int | imLoadMap (char *filename, unsigned char *map, long *palette)
int | imSaveMap (int width, int height, int format, unsigned char *map, int palette_count, long *palette, char *filename)
void | imRGB2Map (int width, int height, unsigned char *red, unsigned char *green, unsigned char *blue, unsigned char *map, int palette_count, long *palette)
void | imMap2RGB (int width, int height, unsigned char *map, int palette_count, long *colors, unsigned char *red, unsigned char *green, unsigned char *blue)
void | imRGB2Gray (int width, int height, unsigned char *red, unsigned char *green, unsigned char *blue, unsigned char *map, long *grays)
void | imMap2Gray (int width, int height, unsigned char *map, int palette_count, long *colors, unsigned char *grey_map, long *grays)
void | imResize (int src_width, int src_height, unsigned char *src_map, int dst_width, int dst_height, unsigned char *dst_map)
void | imStretch (int src_width, int src_height, unsigned char *src_map, int dst_width, int dst_height, unsigned char *dst_map)
int | imRegisterCallback (imCallback cb, int cb_id, int format)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:

- a -

  • abs_op() : im_math_op.h
  • add_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s

- a -

  • abs_op() : im_math_op.h
  • add_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • imAttribTableCallback : im_attrib_flat.h
  • imBinMemoryFileName : im_binfile.h
  • imCounterCallback : im_counter.h
  • imDib : im_dib.h
  • imDibLineGetPixel : im_dib.h
  • imDibLineSetPixel : im_dib.h
  • imImage : im_image.h
  • imRenderCondFunc : im_process_pon.h
  • imRenderFunc : im_process_pon.h
  • imStats : im_process_ana.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • i

- i -

  • IM_ALPHA : im.h
  • IM_BIGENDIAN : im_util.h
  • IM_BIN_ADD : im_process_pon.h
  • IM_BIN_DIFF : im_process_pon.h
  • IM_BIN_DIV : im_process_pon.h
  • IM_BIN_MAX : im_process_pon.h
  • IM_BIN_MIN : im_process_pon.h
  • IM_BIN_MUL : im_process_pon.h
  • IM_BIN_POW : im_process_pon.h
  • IM_BIN_SUB : im_process_pon.h
  • IM_BINARY : im.h
  • IM_BIT_AND : im_process_pon.h
  • IM_BIT_OR : im_process_pon.h
  • IM_BIT_XOR : im_process_pon.h
  • IM_BYTE : im.h
  • IM_CAST_DIRECT : im_convert.h
  • IM_CAST_FIXED : im_convert.h
  • IM_CAST_MINMAX : im_convert.h
  • IM_CFLOAT : im.h
  • IM_CMYK : im.h
  • IM_ERR_ACCESS : im.h
  • IM_ERR_COMPRESS : im.h
  • IM_ERR_COUNTER : im.h
  • IM_ERR_DATA : im.h
  • IM_ERR_FORMAT : im.h
  • IM_ERR_MEM : im.h
  • IM_ERR_NONE : im.h
  • IM_ERR_OPEN : im.h
  • IM_FILEHANDLE : im_binfile.h
  • IM_FLOAT : im.h
  • IM_GAMUT_BRIGHTCONT : im_process_pon.h
  • IM_GAMUT_CROP : im_process_pon.h
  • IM_GAMUT_EXP : im_process_pon.h
  • IM_GAMUT_EXPAND : im_process_pon.h
  • IM_GAMUT_INVERT : im_process_pon.h
  • IM_GAMUT_LOG : im_process_pon.h
  • IM_GAMUT_NORMALIZE : im_process_pon.h
  • IM_GAMUT_POW : im_process_pon.h
  • IM_GAMUT_SLICE : im_process_pon.h
  • IM_GAMUT_SOLARIZE : im_process_pon.h
  • IM_GAMUT_ZEROSTART : im_process_pon.h
  • IM_GRAY : im.h
  • IM_INT : im.h
  • IM_IOCUSTOM0 : im_binfile.h
  • IM_LAB : im.h
  • IM_LITTLEENDIAN : im_util.h
  • IM_LUV : im.h
  • IM_MAP : im.h
  • IM_MEMFILE : im_binfile.h
  • IM_PACKED : im.h
  • IM_RAWFILE : im_binfile.h
  • IM_RGB : im.h
  • IM_STREAM : im_binfile.h
  • IM_SUBFILE : im_binfile.h
  • IM_TOPDOWN : im.h
  • IM_UN_ABS : im_process_pon.h
  • IM_UN_CONJ : im_process_pon.h
  • IM_UN_COS : im_process_pon.h
  • IM_UN_CPXNORM : im_process_pon.h
  • IM_UN_EQL : im_process_pon.h
  • IM_UN_EXP : im_process_pon.h
  • IM_UN_INV : im_process_pon.h
  • IM_UN_LESS : im_process_pon.h
  • IM_UN_LOG : im_process_pon.h
  • IM_UN_SIN : im_process_pon.h
  • IM_UN_SQR : im_process_pon.h
  • IM_UN_SQRT : im_process_pon.h
  • IM_USHORT : im.h
  • IM_XYZ : im.h
  • IM_YCBCR : im.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


          GNU LESSER GENERAL PUBLIC LICENSE
               Version 2.1, February 1999

 Copyright (c) 1991, 1999 Free Software Foundation, Inc.
     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

[This is the first released version of the Lesser GPL.  It also counts
 as the successor of the GNU Library Public License, version 2, hence
 the version number 2.1.]

                Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.

  This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it.  You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.

  When we speak of free software, we are referring to freedom of use,
not price.  Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.

  To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights.  These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.

  For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you.  You must make sure that they, too, receive or can get the source
code.  If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it.  And you must show them these terms so they know their rights.

  We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.

  To protect each distributor, we want to make it very clear that
there is no warranty for the free library.  Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.

  Finally, software patents pose a constant threat to the existence of
any free program.  We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder.  Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.

  Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License.  This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License.  We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.

  When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library.  The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom.  The Lesser General
Public License permits more lax criteria for linking other code with
the library.

  We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License.  It also provides other free software developers Less
of an advantage over competing non-free programs.  These disadvantages
are the reason we use the ordinary General Public License for many
libraries.  However, the Lesser license provides advantages in certain
special circumstances.

  For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard.  To achieve this, non-free programs must be
allowed to use the library.  A more frequent case is that a free
library does the same job as widely used non-free libraries.  In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.

  In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software.  For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.

  Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.

  The precise terms and conditions for copying, distribution and
modification follow.  Pay close attention to the difference between a
"work based on the library" and a "work that uses the library".  The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.

          GNU LESSER GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".

  A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.

  The "Library", below, refers to any such software library or work
which has been distributed under these terms.  A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language.  (Hereinafter, translation is
included without limitation in the term "modification".)

  "Source code" for a work means the preferred form of the work for
making modifications to it.  For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.

  Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it).  Whether that is true depends on what the Library does
and what the program that uses the Library does.

  1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.

  You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.

  2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) The modified work must itself be a software library.

    b) You must cause the files modified to carry prominent notices
    stating that you changed the files and the date of any change.

    c) You must cause the whole of the work to be licensed at no
    charge to all third parties under the terms of this License.

    d) If a facility in the modified Library refers to a function or a
    table of data to be supplied by an application program that uses
    the facility, other than as an argument passed when the facility
    is invoked, then you must make a good faith effort to ensure that,
    in the event an application does not supply such function or
    table, the facility still operates, and performs whatever part of
    its purpose remains meaningful.

    (For example, a function in a library to compute square roots has
    a purpose that is entirely well-defined independent of the
    application.  Therefore, Subsection 2d requires that any
    application-supplied function or table used by this function must
    be optional: if the application does not supply it, the square
    root function must still compute square roots.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.

In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library.  To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License.  (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.)  Do not make any other change in
these notices.

  Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.

  This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.

  4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.

  If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.

  5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library".  Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.

  However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library".  The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.

  When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library.  The
threshold for this to be true is not precisely defined by law.

  If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work.  (Executables containing this object code plus portions of the
Library will still fall under Section 6.)

  Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.

  6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.

  You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License.  You must supply a copy of this License.  If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License.  Also, you must do one
of these things:

    a) Accompany the work with the complete corresponding
    machine-readable source code for the Library including whatever
    changes were used in the work (which must be distributed under
    Sections 1 and 2 above); and, if the work is an executable linked
    with the Library, with the complete machine-readable "work that
    uses the Library", as object code and/or source code, so that the
    user can modify the Library and then relink to produce a modified
    executable containing the modified Library.  (It is understood
    that the user who changes the contents of definitions files in the
    Library will not necessarily be able to recompile the application
    to use the modified definitions.)

    b) Use a suitable shared library mechanism for linking with the
    Library.  A suitable mechanism is one that (1) uses at run time a
    copy of the library already present on the user's computer system,
    rather than copying library functions into the executable, and (2)
    will operate properly with a modified version of the library, if
    the user installs one, as long as the modified version is
    interface-compatible with the version that the work was made with.

    c) Accompany the work with a written offer, valid for at
    least three years, to give the same user the materials
    specified in Subsection 6a, above, for a charge no more
    than the cost of performing this distribution.

    d) If distribution of the work is made by offering access to copy
    from a designated place, offer equivalent access to copy the above
    specified materials from the same place.

    e) Verify that the user has already received a copy of these
    materials or that you have already sent this user a copy.

  For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it.  However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.

  It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system.  Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.

  7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:

    a) Accompany the combined library with a copy of the same work
    based on the Library, uncombined with any other library
    facilities.  This must be distributed under the terms of the
    Sections above.

    b) Give prominent notice with the combined library of the fact
    that part of it is a work based on the Library, and explaining
    where to find the accompanying uncombined form of the same work.

  8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License.  Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License.  However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.

  9. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Library or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.

  10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.

  11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all.  For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.

If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded.  In such case, this License incorporates the limitation as if
written in the body of this License.

  13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number.  If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation.  If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.

  14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission.  For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this.  Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.

                NO WARRANTY

  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.

             END OF TERMS AND CONDITIONS

           How to Apply These Terms to Your New Libraries

  If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change.  You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).

  To apply these terms, attach the following notices to the library.  It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

    <one line to give the library's name and a brief idea of what it does.>
    Copyright (c) <year>  <name of author>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the
  library `Frob' (a library for tweaking knobs) written by James Random Hacker.

  <signature of Ty Coon>, 1 April 1990
  Ty Coon, President of Vice

That's all there is to it!


JasPer License Version 2.0

Copyright (c) 2001-2006 Michael David Adams
Copyright (c) 1999-2000 Image Power, Inc.
Copyright (c) 1999-2000 The University of British Columbia

All rights reserved.

Permission is hereby granted, free of charge, to any person (the
"User") obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:

1.  The above copyright notices and this permission notice (which
includes the disclaimer below) shall be included in all copies or
substantial portions of the Software.

2.  The name of a copyright holder shall not be used to endorse or
promote products derived from the Software without specific prior
written permission.

THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
LICENSE.  NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
THIS DISCLAIMER.  THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.  IN NO
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.  NO ASSURANCES ARE
PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
PROPERTY RIGHTS OR OTHERWISE.  AS A CONDITION TO EXERCISING THE RIGHTS
GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY.  THE SOFTWARE
IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
RISK ACTIVITIES").  THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.


LEGAL ISSUES
============

In plain English:

1. We don't promise that this software works.  (But if you find any bugs,
   please let us know!)
2. You can use this software for whatever you want.  You don't have to pay us.
3. You may not pretend that you wrote this software.  If you use it in a
   program, you must acknowledge somewhere in your documentation that
   you've used the IJG code.

In legalese:

The authors make NO WARRANTY or representation, either express or implied,
with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose.  This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy.

This software is copyright (C) 1991-2009, Thomas G. Lane, Guido Vollbeding.
All Rights Reserved except as specified below.

Permission is hereby granted to use, copy, modify, and distribute this
software (or portions thereof) for any purpose, without fee, subject to these
conditions:
(1) If any part of the source code for this software is distributed, then this
README file must be included, with this copyright and no-warranty notice
unaltered; and any additions, deletions, or changes to the original files
must be clearly indicated in accompanying documentation.
(2) If only executable code is distributed, then the accompanying
documentation must state that "this software is based in part on the work of
the Independent JPEG Group".
(3) Permission for use of this software is granted only if the user accepts
full responsibility for any undesirable consequences; the authors accept
NO LIABILITY for damages of any kind.

These conditions apply to any software derived from or based on the IJG code,
not just to the unmodified library.  If you use our work, you ought to
acknowledge us.

Permission is NOT granted for the use of any IJG author's name or company name
in advertising or publicity relating to this software or products derived from
it.  This software may be referred to only as "the Independent JPEG Group's
software".

We specifically permit and encourage the use of this software as the basis of
commercial products, provided that all warranty or liability claims are
assumed by the product vendor.


Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de>

Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:

  1.  Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.

  2.  Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.

Alternatively, the following files carry an additional notice that
explicitly allows relicensing under the GPLv2: lzf.c lzf.h lzfP.h lzf_c.c
lzf_d.c


This copy of the libpng notices is provided for your convenience.  In case of
any discrepancy between this copy and the notices in the file png.h that is
included in the libpng distribution, the latter shall prevail.

COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:

If you modify libpng you may insert additional notices immediately following
this sentence.

This code is released under the libpng license.

libpng versions 1.2.6, August 15, 2004, through 1.2.39, August 13, 2009, are
Copyright (c) 2004, 2006-2009 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors

   Cosmin Truta

libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors

   Simon-Pierre Cadieux
   Eric S. Raymond
   Gilles Vollant

and with the following additions to the disclaimer:

   There is no warranty against interference with your enjoyment of the
   library or against infringement.  There is no warranty that our
   efforts or the library will fulfill any of your particular purposes
   or needs.  This library is provided with all faults, and the entire
   risk of satisfactory quality, performance, accuracy, and effort is with
   the user.

libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-0.96,
with the following individuals added to the list of Contributing Authors:

   Tom Lane
   Glenn Randers-Pehrson
   Willem van Schaik

libpng versions 0.89, June 1996, through 0.96, May 1997, are
Copyright (c) 1996, 1997 Andreas Dilger
Distributed according to the same disclaimer and license as libpng-0.88,
with the following individuals added to the list of Contributing Authors:

   John Bowler
   Kevin Bracey
   Sam Bushell
   Magnus Holmgren
   Greg Roelofs
   Tom Tanner

libpng versions 0.5, May 1995, through 0.88, January 1996, are
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.

For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals:

   Andreas Dilger
   Dave Martindale
   Guy Eric Schalnat
   Paul Schmidt
   Tim Wegner

The PNG Reference Library is supplied "AS IS".  The Contributing Authors
and Group 42, Inc. disclaim all warranties, expressed or implied,
including, without limitation, the warranties of merchantability and of
fitness for any purpose.  The Contributing Authors and Group 42, Inc.
assume no liability for direct, indirect, incidental, special, exemplary,
or consequential damages, which may result from the use of the PNG
Reference Library, even if advised of the possibility of such damage.

Permission is hereby granted to use, copy, modify, and distribute this
source code, or portions hereof, for any purpose, without fee, subject
to the following restrictions:

1. The origin of this source code must not be misrepresented.

2. Altered versions must be plainly marked as such and must not
   be misrepresented as being the original source.

3. This Copyright notice may not be removed or altered from any
   source or altered source distribution.

The Contributing Authors and Group 42, Inc. specifically permit, without
fee, and encourage the use of this source code as a component to
supporting the PNG file format in commercial products.  If you use this
source code in a product, acknowledgment is not required but would be
appreciated.

A "png_get_copyright" function is available, for convenient use in "about"
boxes and the like:

   printf("%s",png_get_copyright(NULL));

Also, the PNG logo (in PNG format, of course) is supplied in the
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).

Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is a
certification mark of the Open Source Initiative.

Glenn Randers-Pehrson
glennrp at users.sourceforge.net
August 13, 2009


Copyright (c) 1988-1997 Sam Leffler
Copyright (c) 1991-1997 Silicon Graphics, Inc.

Permission to use, copy, modify, distribute, and sell this software and
its documentation for any purpose is hereby granted without fee, provided
that (i) the above copyright notices and this permission notice appear in
all copies of the software and related documentation, and (ii) the names of
Sam Leffler and Silicon Graphics may not be used in any advertising or
publicity relating to the software without the specific, prior written
permission of Sam Leffler and Silicon Graphics.

THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.


Copyright notice:

 (C) 1995-2004 Jean-loup Gailly and Mark Adler

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

  Jean-loup Gailly        Mark Adler
  jloup@gzip.org          madler@alumni.caltech.edu

If you use the zlib library in a product, we would appreciate *not*
receiving lengthy legal documents to sign. The sources are provided
for free but without warranty of any kind.  The library has been
entirely written by Jean-loup Gailly and Mark Adler; it does not
include third-party code.

If you redistribute modified sources, we would appreciate that you include
in the file ChangeLog history information documenting your changes. Please
read the FAQ for more information on the distribution of modified source
versions.


IM: imAttribArray Class Reference

Public Member Functions

imAttribArray Class Reference
[Utilities]

Attributes Table. More...

Public Member Functions

imAttribArray (int count)
~imAttribArray ()
int | Count () const
void | RemoveAll ()
void | CopyFrom (const imAttribArray &table)
void | Set (int index, const char *name, int data_type, int count, const void *data)
const void * | Get (int index, char *name=0, int *data_type=0, int *count=0) const
void | ForEach (void *user_data, imAttribTableCallback attrib_func) const

Detailed Description

Same as imAttribTable, but uses an array of fixed size.

Constructor & Destructor Documentation

imAttribArray::imAttribArray ( int count ) [inline]

Creates an empty array.

    { ptable = imAttribArrayCreate(count); }

imAttribArray::~imAttribArray ( ) [inline]

Destroys the array and all the attributes.

    { imAttribTableDestroy(ptable); ptable = 0; }

Member Function Documentation

int imAttribArray::Count ( ) const [inline]

Returns the number of elements in the array.

    { return imAttribTableCount(ptable); }

void imAttribArray::RemoveAll ( ) [inline]

Removes all the attributes in the array

    { imAttribTableRemoveAll(ptable); }

void imAttribArray::CopyFrom ( const imAttribArray & table ) [inline]

Copies the contents of the given table into this table.

    { imAttribArrayCopyFrom(ptable, table.ptable); }

void imAttribArray::Set | ( | int | index,
 |  | const char * | name,
 |  | int | data_type,
 |  | int | count,
 |  | const void * | data |
 | ) |  |  | [inline]

Inserts one attribute into the array. The attribute data is a simple array of data_type elements of count length.
Data is duplicated if not NULL, else data is initialized with zeros. When NULL is specified use the Get method to retrieve a pointer to the data so you can initialize it with other values. See also imDataType.

    { imAttribArraySet(ptable, index, name, data_type, count, data); }

const void* imAttribArray::Get | ( | int | index,
 |  | char * | name = 0,
 |  | int * | data_type = 0,
 |  | int * | count = 0 |
 | ) |  |  | const [inline]

Finds one attribute in the array. Returns the attribute if found, NULL otherwise. See also imDataType.

    { return imAttribArrayGet(ptable, index, name, data_type, count); }

void imAttribArray::ForEach | ( | void * | user_data,
 |  | imAttribTableCallback | attrib_func |
 | ) |  |  | const [inline]

For each attribute calls the user callback. If the callback returns 0 the function returns.

    { imAttribTableForEach(ptable, user_data, attrib_func); }

The documentation for this class was generated from the following file:
  • im_attrib.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: imFileFormatBase Class Reference

imFileFormatBase Class Reference
[File Format SDK]

Image File Format Virtual Class (SDK Use Only). More...

Inherits _imFile.

Collaboration diagram for imFileFormatBase:
[legend]

Public Member Functions

imFileFormatBase (const imFormat *_iformat)
imAttribTable * | AttribTable ()
virtual int | Open (const char *file_name)=0
virtual int | New (const char *file_name)=0
virtual void | Close ()=0
virtual void * | Handle (int index)=0
virtual int | ReadImageInfo (int index)=0
virtual int | ReadImageData (void *data)=0
virtual int | WriteImageInfo ()=0
virtual int | WriteImageData (void *data)=0

Data Fields

const imFormat * | iformat

Detailed Description

Virtual Base class for file formats. All file formats inherit from this class.
The documentation for this class was generated from the following file:
  • im_format.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:

- l -

  • less_op() : im_math_op.h
  • log_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:

- m -

  • max_op() : im_math_op.h
  • min_op() : im_math_op.h
  • mul_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:

- c -

  • cos_op() : im_math_op.h
  • crop_byte() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:

- d -

  • diff_op() : im_math_op.h
  • div_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:

- e -

  • exp_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:

- i -

  • IM_ALPHA : im.h
  • IM_BIGENDIAN : im_util.h
  • IM_BIN_ADD : im_process_pon.h
  • IM_BIN_DIFF : im_process_pon.h
  • IM_BIN_DIV : im_process_pon.h
  • IM_BIN_MAX : im_process_pon.h
  • IM_BIN_MIN : im_process_pon.h
  • IM_BIN_MUL : im_process_pon.h
  • IM_BIN_POW : im_process_pon.h
  • IM_BIN_SUB : im_process_pon.h
  • IM_BINARY : im.h
  • IM_BIT_AND : im_process_pon.h
  • IM_BIT_OR : im_process_pon.h
  • IM_BIT_XOR : im_process_pon.h
  • IM_BYTE : im.h
  • IM_CAST_DIRECT : im_convert.h
  • IM_CAST_FIXED : im_convert.h
  • IM_CAST_MINMAX : im_convert.h
  • IM_CFLOAT : im.h
  • IM_CMYK : im.h
  • IM_ERR_ACCESS : im.h
  • IM_ERR_COMPRESS : im.h
  • IM_ERR_COUNTER : im.h
  • IM_ERR_DATA : im.h
  • IM_ERR_FORMAT : im.h
  • IM_ERR_MEM : im.h
  • IM_ERR_NONE : im.h
  • IM_ERR_OPEN : im.h
  • IM_FILEHANDLE : im_binfile.h
  • IM_FLOAT : im.h
  • IM_GAMUT_BRIGHTCONT : im_process_pon.h
  • IM_GAMUT_CROP : im_process_pon.h
  • IM_GAMUT_EXP : im_process_pon.h
  • IM_GAMUT_EXPAND : im_process_pon.h
  • IM_GAMUT_INVERT : im_process_pon.h
  • IM_GAMUT_LOG : im_process_pon.h
  • IM_GAMUT_NORMALIZE : im_process_pon.h
  • IM_GAMUT_POW : im_process_pon.h
  • IM_GAMUT_SLICE : im_process_pon.h
  • IM_GAMUT_SOLARIZE : im_process_pon.h
  • IM_GAMUT_ZEROSTART : im_process_pon.h
  • IM_GRAY : im.h
  • IM_INT : im.h
  • IM_IOCUSTOM0 : im_binfile.h
  • IM_LAB : im.h
  • IM_LITTLEENDIAN : im_util.h
  • IM_LUV : im.h
  • IM_MAP : im.h
  • IM_MEMFILE : im_binfile.h
  • IM_PACKED : im.h
  • IM_RAWFILE : im_binfile.h
  • IM_RGB : im.h
  • IM_STREAM : im_binfile.h
  • IM_SUBFILE : im_binfile.h
  • IM_TOPDOWN : im.h
  • IM_UN_ABS : im_process_pon.h
  • IM_UN_CONJ : im_process_pon.h
  • IM_UN_COS : im_process_pon.h
  • IM_UN_CPXNORM : im_process_pon.h
  • IM_UN_EQL : im_process_pon.h
  • IM_UN_EXP : im_process_pon.h
  • IM_UN_INV : im_process_pon.h
  • IM_UN_LESS : im_process_pon.h
  • IM_UN_LOG : im_process_pon.h
  • IM_UN_SIN : im_process_pon.h
  • IM_UN_SQR : im_process_pon.h
  • IM_UN_SQRT : im_process_pon.h
  • IM_USHORT : im.h
  • IM_XYZ : im.h
  • IM_YCBCR : im.h
  • imAnalyzeFindRegions() : im_process_ana.h
  • imAnalyzeMeasureArea() : im_process_ana.h
  • imAnalyzeMeasureCentroid() : im_process_ana.h
  • imAnalyzeMeasureHoles() : im_process_ana.h
  • imAnalyzeMeasurePerimArea() : im_process_ana.h
  • imAnalyzeMeasurePerimeter() : im_process_ana.h
  • imAnalyzeMeasurePrincipalAxis() : im_process_ana.h
  • imAttribTableCallback : im_attrib_flat.h
  • imBicubicInterpolation() : im_math.h
  • imBilinearDecimation() : im_math.h
  • imBilinearInterpolation() : im_math.h
  • imBinaryOp : im_process_pon.h
  • imBinCPUByteOrder() : im_util.h
  • imBinFileByteOrder() : im_binfile.h
  • imBinFileClose() : im_binfile.h
  • imBinFileEndOfFile() : im_binfile.h
  • imBinFileError() : im_binfile.h
  • imBinFileModule : im_binfile.h
  • imBinFileNew() : im_binfile.h
  • imBinFileOpen() : im_binfile.h
  • imBinFilePrintf() : im_binfile.h
  • imBinFileRead() : im_binfile.h
  • imBinFileReadFloat() : im_binfile.h
  • imBinFileReadInteger() : im_binfile.h
  • imBinFileSeekFrom() : im_binfile.h
  • imBinFileSeekOffset() : im_binfile.h
  • imBinFileSeekTo() : im_binfile.h
  • imBinFileSetCurrentModule() : im_binfile.h
  • imBinFileSize() : im_binfile.h
  • imBinFileTell() : im_binfile.h
  • imBinFileWrite() : im_binfile.h
  • imBinMemoryFileName : im_binfile.h
  • imBinMemoryRelease() : im_binfile.h
  • imBinSwapBytes() : im_util.h
  • imBinSwapBytes2() : im_util.h
  • imBinSwapBytes4() : im_util.h
  • imBinSwapBytes8() : im_util.h
  • imByteOrder : im_util.h
  • imCalcCountColors() : im_process_ana.h
  • imCalcGrayHistogram() : im_process_ana.h
  • imCalcHistogram() : im_process_ana.h
  • imCalcHistogramStatistics() : im_process_ana.h
  • imCalcHistoImageStatistics() : im_process_ana.h
  • imCalcImageStatistics() : im_process_ana.h
  • imCalcRMSError() : im_process_ana.h
  • imCalcSNR() : im_process_ana.h
  • imCalcUShortHistogram() : im_process_ana.h
  • imCastMode : im_convert.h
  • imcdCanvasPutImage : im_image.h
  • imColorCMYK2RGB() : im_color.h
  • imColorDecode() : im_util.h
  • imColorEncode() : im_util.h
  • imColorHSI2RGB() : im_colorhsi.h
  • imColorHSI2RGBbyte() : im_colorhsi.h
  • imColorHSI_ImaxS() : im_colorhsi.h
  • imColorLab2XYZ() : im_color.h
  • imColorLightness2Luminance() : im_color.h
  • imColorLuminance2Lightness() : im_color.h
  • imColorLuv2XYZ() : im_color.h
  • imColorMax() : im_color.h
  • imColorModeConfig : im.h
  • imColorModeDepth() : im_util.h
  • imColorModeHasAlpha : im_util.h
  • imColorModeIsBitmap() : im_util.h
  • imColorModeIsPacked : im_util.h
  • imColorModeIsTopDown : im_util.h
  • imColorModeMatch : im_util.h
  • imColorModeSpace : im_util.h
  • imColorModeSpaceName() : im_util.h
  • imColorModeToBitmap() : im_util.h
  • imColorQuantize() : im_color.h
  • imColorReconstruct() : im_color.h
  • imColorRGB2HSI() : im_colorhsi.h
  • imColorRGB2HSIbyte() : im_colorhsi.h
  • imColorRGB2Luma() : im_color.h
  • imColorRGB2RGBNonlinear() : im_color.h
  • imColorRGB2XYZ() : im_color.h
  • imColorRGB2YCbCr() : im_color.h
  • imColorSpace : im.h
  • imColorTransfer2Linear() : im_color.h
  • imColorTransfer2Nonlinear() : im_color.h
  • imColorXYZ2Lab() : im_color.h
  • imColorXYZ2Luv() : im_color.h
  • imColorXYZ2RGB() : im_color.h
  • imColorYCbCr2RGB() : im_color.h
  • imColorZero() : im_color.h
  • imComplex2Real : im_convert.h
  • imCompressDataLZF() : im_util.h
  • imCompressDataUnLZF() : im_util.h
  • imCompressDataUnZ() : im_util.h
  • imCompressDataZ() : im_util.h
  • imConvertColorSpace() : im_convert.h
  • imConvertDataType() : im_convert.h
  • imConvertMapToRGB() : im_convert.h
  • imConvertPacking() : im_convert.h
  • imConvertToBitmap() : im_convert.h
  • imCounterBegin() : im_counter.h
  • imCounterCallback : im_counter.h
  • imCounterEnd() : im_counter.h
  • imCounterInc() : im_counter.h
  • imCounterIncTo() : im_counter.h
  • imCounterSetCallback() : im_counter.h
  • imCounterTotal() : im_counter.h
  • imDataBitGet() : im_math_op.h
  • imDataBitSet() : im_math_op.h
  • imDataType : im.h
  • imDataTypeIntMax() : im_util.h
  • imDataTypeIntMin() : im_util.h
  • imDataTypeName() : im_util.h
  • imDataTypeSize() : im_util.h
  • imDib : im_dib.h
  • imDibCaptureScreen() : im_dib.h
  • imDibCopyClipboard() : im_dib.h
  • imDibCreate() : im_dib.h
  • imDibCreateCopy() : im_dib.h
  • imDibCreateReference() : im_dib.h
  • imDibCreateSection() : im_dib.h
  • imDibDecodeToBitmap() : im_dib.h
  • imDibDecodeToMap() : im_dib.h
  • imDibDecodeToRGBA() : im_dib.h
  • imDibDestroy() : im_dib.h
  • imDibEncodeFromBitmap() : im_dib.h
  • imDibEncodeFromMap() : im_dib.h
  • imDibEncodeFromRGBA() : im_dib.h
  • imDibFromHBitmap() : im_dib.h
  • imDibIsClipboardAvailable() : im_dib.h
  • imDibLineGetPixel : im_dib.h
  • imDibLineGetPixelFunc() : im_dib.h
  • imDibLineSetPixel : im_dib.h
  • imDibLineSetPixelFunc() : im_dib.h
  • imDibLoadFile() : im_dib.h
  • imDibLogicalPalette() : im_dib.h
  • imDibPasteClipboard() : im_dib.h
  • imDibSaveFile() : im_dib.h
  • imDibToHBitmap() : im_dib.h
  • imErrorCodes : im.h
  • imFileClose() : im.h
  • imFileGetAttribute() : im.h
  • imFileGetAttributeList() : im.h
  • imFileGetInfo() : im.h
  • imFileGetPalette() : im.h
  • imFileHandle() : im.h
  • imFileImageLoad() : im_image.h
  • imFileImageLoadBitmap() : im_image.h
  • imFileImageLoadRegion() : im_image.h
  • imFileImageSave() : im_image.h
  • imFileLineBufferCount() : im_file.h
  • imFileLineBufferInc() : im_file.h
  • imFileLineBufferRead() : im_file.h
  • imFileLineBufferWrite() : im_file.h
  • imFileLineSizeAligned() : im_file.h
  • imFileLoadBitmap() : im_image.h
  • imFileLoadBitmapFrame() : im_image.h
  • imFileLoadImage() : im_image.h
  • imFileLoadImageFrame() : im_image.h
  • imFileLoadImageRegion() : im_image.h
  • imFileNew() : im.h
  • imFileNewRaw() : im_raw.h
  • imFileOpen() : im.h
  • imFileOpenAs() : im.h
  • imFileOpenRaw() : im_raw.h
  • imFileReadImageData() : im.h
  • imFileReadImageInfo() : im.h
  • imFileSaveImage() : im_image.h
  • imFileSetAttribute() : im.h
  • imFileSetBaseAttributes() : im_file.h
  • imFileSetInfo() : im.h
  • imFileSetPalette() : im.h
  • imFileWriteImageData() : im.h
  • imFileWriteImageInfo() : im.h
  • imFormatCanWriteImage() : im.h
  • imFormatCompressions() : im.h
  • imFormatInfo() : im.h
  • imFormatList() : im.h
  • imFormatRegister() : im_format.h
  • imFormatRegisterAVI() : im_format_avi.h
  • imFormatRegisterECW() : im_format_ecw.h
  • imFormatRegisterInternal() : im.h
  • imFormatRegisterJP2() : im_format_jp2.h
  • imFormatRegisterWMV() : im_format_wmv.h
  • imFormatRemoveAll() : im.h
  • imGammaFactor : im_convert.h
  • imGaussianKernelSize2StdDev() : im_process_loc.h
  • imGaussianStdDev2KernelSize() : im_process_loc.h
  • imImage : im_image.h
  • imImageAddAlpha() : im_image.h
  • imImageCheckFormat() : im_util.h
  • imImageClear() : im_image.h
  • imImageClone() : im_image.h
  • imImageCopy() : im_image.h
  • imImageCopyAttributes() : im_image.h
  • imImageCopyData() : im_image.h
  • imImageCopyPlane() : im_image.h
  • imImageCreate() : im_image.h
  • imImageCreateBased() : im_image.h
  • imImageCreateFromOpenGLData() : im_convert.h
  • imImageDataSize() : im_util.h
  • imImageDestroy() : im_image.h
  • imImageDuplicate() : im_image.h
  • imImageGetAttribute() : im_image.h
  • imImageGetAttributeList() : im_image.h
  • imImageGetOpenGLData() : im_convert.h
  • imImageInit() : im_image.h
  • imImageIsBitmap() : im_image.h
  • imImageLineCount() : im_util.h
  • imImageLineSize() : im_util.h
  • imImageMakeBinary() : im_image.h
  • imImageMakeGray() : im_image.h
  • imImageMatch() : im_image.h
  • imImageMatchColor() : im_image.h
  • imImageMatchColorSpace() : im_image.h
  • imImageMatchDataType() : im_image.h
  • imImageMatchSize() : im_image.h
  • imImageReshape() : im_image.h
  • imImageSetAlpha() : im_image.h
  • imImageSetAttribute() : im_image.h
  • imImageSetBinary() : im_image.h
  • imImageSetPalette() : im_image.h
  • imKernelBarlett5x5() : im_kernel.h
  • imKernelCircularMean5x5() : im_kernel.h
  • imKernelCircularMean7x7() : im_kernel.h
  • imKernelEnhance() : im_kernel.h
  • imKernelGaussian3x3() : im_kernel.h
  • imKernelGaussian5x5() : im_kernel.h
  • imKernelGradian3x3() : im_kernel.h
  • imKernelGradian7x7() : im_kernel.h
  • imKernelKirsh() : im_kernel.h
  • imKernelLaplacian4() : im_kernel.h
  • imKernelLaplacian5x5() : im_kernel.h
  • imKernelLaplacian7x7() : im_kernel.h
  • imKernelLaplacian8() : im_kernel.h
  • imKernelMean3x3() : im_kernel.h
  • imKernelMean5x5() : im_kernel.h
  • imKernelMean7x7() : im_kernel.h
  • imKernelPrewitt() : im_kernel.h
  • imKernelSculpt() : im_kernel.h
  • imKernelSobel() : im_kernel.h
  • imKernelTopHat5x5() : im_kernel.h
  • imKernelTopHat7x7() : im_kernel.h
  • imLogicOp : im_process_pon.h
  • imlua_open() : imlua.h
  • imlua_open_capture() : imlua.h
  • imlua_open_fftw() : imlua.h
  • imlua_open_process() : imlua.h
  • imMinMax() : im_math.h
  • imPaletteBlackBody() : im_palette.h
  • imPaletteBlue() : im_palette.h
  • imPaletteBlueIce() : im_palette.h
  • imPaletteCian() : im_palette.h
  • imPaletteFindColor() : im_palette.h
  • imPaletteFindNearest() : im_palette.h
  • imPaletteGray() : im_palette.h
  • imPaletteGreen() : im_palette.h
  • imPaletteHighContrast() : im_palette.h
  • imPaletteHotIron() : im_palette.h
  • imPaletteHues() : im_palette.h
  • imPaletteMagenta() : im_palette.h
  • imPaletteRainbow() : im_palette.h
  • imPaletteRed() : im_palette.h
  • imPaletteUniform() : im_palette.h
  • imPaletteUniformIndex() : im_palette.h
  • imPaletteUniformIndexHalftoned() : im_palette.h
  • imPaletteYellow() : im_palette.h
  • imProcessAddMargins() : im_process_loc.h
  • imProcessArithmeticConstOp() : im_process_pon.h
  • imProcessArithmeticOp() : im_process_pon.h
  • imProcessAutoCorrelation() : im_process_glo.h
  • imProcessAutoCovariance() : im_process_pon.h
  • imProcessBarlettConvolve() : im_process_loc.h
  • imProcessBinMorphClose() : im_process_loc.h
  • imProcessBinMorphConvolve() : im_process_loc.h
  • imProcessBinMorphDilate() : im_process_loc.h
  • imProcessBinMorphErode() : im_process_loc.h
  • imProcessBinMorphOpen() : im_process_loc.h
  • imProcessBinMorphOutline() : im_process_loc.h
  • imProcessBinMorphThin() : im_process_loc.h
  • imProcessBitMask() : im_process_pon.h
  • imProcessBitPlane() : im_process_pon.h
  • imProcessBitwiseNot() : im_process_pon.h
  • imProcessBitwiseOp() : im_process_pon.h
  • imProcessBlend() : im_process_pon.h
  • imProcessBlendConst() : im_process_pon.h
  • imProcessCalcRotateSize() : im_process_loc.h
  • imProcessCanny() : im_process_loc.h
  • imProcessCompassConvolve() : im_process_loc.h
  • imProcessCompose() : im_process_pon.h
  • imProcessConvolve() : im_process_loc.h
  • imProcessConvolveDual() : im_process_loc.h
  • imProcessConvolveRep() : im_process_loc.h
  • imProcessConvolveSep() : im_process_loc.h
  • imProcessCrop() : im_process_loc.h
  • imProcessCrossCorrelation() : im_process_glo.h
  • imProcessDiffOfGaussianConvolve() : im_process_loc.h
  • imProcessDifusionErrThreshold() : im_process_pon.h
  • imProcessDirectConv() : im_process_pon.h
  • imProcessDistanceTransform() : im_process_glo.h
  • imProcessEqualizeHistogram() : im_process_pon.h
  • imProcessExpandHistogram() : im_process_pon.h
  • imProcessFFT() : im_process_glo.h
  • imProcessFFTraw() : im_process_glo.h
  • imProcessFillHoles() : im_process_ana.h
  • imProcessFlip() : im_process_loc.h
  • imProcessGaussianConvolve() : im_process_loc.h
  • imProcessGrayMorphClose() : im_process_loc.h
  • imProcessGrayMorphConvolve() : im_process_loc.h
  • imProcessGrayMorphDilate() : im_process_loc.h
  • imProcessGrayMorphErode() : im_process_loc.h
  • imProcessGrayMorphGradient() : im_process_loc.h
  • imProcessGrayMorphOpen() : im_process_loc.h
  • imProcessGrayMorphTopHat() : im_process_loc.h
  • imProcessGrayMorphWell() : im_process_loc.h
  • imProcessHoughLines() : im_process_glo.h
  • imProcessHoughLinesDraw() : im_process_glo.h
  • imProcessHysteresisThresEstimate() : im_process_pon.h
  • imProcessHysteresisThreshold() : im_process_pon.h
  • imProcessIFFT() : im_process_glo.h
  • imProcessInsert() : im_process_loc.h
  • imProcessInterlaceSplit() : im_process_loc.h
  • imProcessLapOfGaussianConvolve() : im_process_loc.h
  • imProcessLocalMaxThresEstimate() : im_process_pon.h
  • imProcessLocalMaxThreshold() : im_process_loc.h
  • imProcessMeanConvolve() : im_process_loc.h
  • imProcessMedianConvolve() : im_process_loc.h
  • imProcessMergeComplex() : im_process_pon.h
  • imProcessMergeComponents() : im_process_pon.h
  • imProcessMergeHSI() : im_process_pon.h
  • imProcessMinMaxThreshold() : im_process_pon.h
  • imProcessMirror() : im_process_loc.h
  • imProcessMultipleMean() : im_process_pon.h
  • imProcessMultipleStdDev() : im_process_pon.h
  • imProcessMultiplyConj() : im_process_pon.h
  • imProcessNegative() : im_process_pon.h
  • imProcessNormalizeComponents() : im_process_pon.h
  • imProcessOtsuThreshold() : im_process_pon.h
  • imProcessPercentThreshold() : im_process_pon.h
  • imProcessPerimeterLine() : im_process_ana.h
  • imProcessPixelate() : im_process_pon.h
  • imProcessPosterize() : im_process_pon.h
  • imProcessPrewittConvolve() : im_process_loc.h
  • imProcessQuantizeGrayUniform() : im_process_pon.h
  • imProcessQuantizeRGBUniform() : im_process_pon.h
  • imProcessRadial() : im_process_loc.h
  • imProcessRangeContrastThreshold() : im_process_loc.h
  • imProcessRangeConvolve() : im_process_loc.h
  • imProcessRankClosestConvolve() : im_process_loc.h
  • imProcessRankMaxConvolve() : im_process_loc.h
  • imProcessRankMinConvolve() : im_process_loc.h
  • imProcessReduce() : im_process_loc.h
  • imProcessReduceBy4() : im_process_loc.h
  • imProcessRegionalMaximum() : im_process_glo.h
  • imProcessRemoveByArea() : im_process_ana.h
  • imProcessRenderAddGaussianNoise() : im_process_pon.h
  • imProcessRenderAddSpeckleNoise() : im_process_pon.h
  • imProcessRenderAddUniformNoise() : im_process_pon.h
  • imProcessRenderBox() : im_process_pon.h
  • imProcessRenderChessboard() : im_process_pon.h
  • imProcessRenderCondOp() : im_process_pon.h
  • imProcessRenderCone() : im_process_pon.h
  • imProcessRenderConstant() : im_process_pon.h
  • imProcessRenderCosine() : im_process_pon.h
  • imProcessRenderGaussian() : im_process_pon.h
  • imProcessRenderGrid() : im_process_pon.h
  • imProcessRenderLapOfGaussian() : im_process_pon.h
  • imProcessRenderOp() : im_process_pon.h
  • imProcessRenderRamp() : im_process_pon.h
  • imProcessRenderRandomNoise() : im_process_pon.h
  • imProcessRenderSinc() : im_process_pon.h
  • imProcessRenderTent() : im_process_pon.h
  • imProcessRenderWheel() : im_process_pon.h
  • imProcessReplaceColor() : im_process_pon.h
  • imProcessResize() : im_process_loc.h
  • imProcessRotate() : im_process_loc.h
  • imProcessRotate180() : im_process_loc.h
  • imProcessRotate90() : im_process_loc.h
  • imProcessRotateKernel() : im_process_loc.h
  • imProcessRotateRef() : im_process_loc.h
  • imProcessSharp() : im_process_loc.h
  • imProcessSharpKernel() : im_process_loc.h
  • imProcessSliceThreshold() : im_process_pon.h
  • imProcessSobelConvolve() : im_process_loc.h
  • imProcessSplineEdgeConvolve() : im_process_loc.h
  • imProcessSplitComplex() : im_process_pon.h
  • imProcessSplitComponents() : im_process_pon.h
  • imProcessSplitHSI() : im_process_pon.h
  • imProcessSplitYChroma() : im_process_pon.h
  • imProcessSwapQuadrants() : im_process_glo.h
  • imProcessSwirl() : im_process_loc.h
  • imProcessThreshold() : im_process_pon.h
  • imProcessThresholdByDiff() : im_process_pon.h
  • imProcessToneGamut() : im_process_pon.h
  • imProcessUnArithmeticOp() : im_process_pon.h
  • imProcessUniformErrThreshold() : im_process_pon.h
  • imProcessUnNormalize() : im_process_pon.h
  • imProcessUnsharp() : im_process_loc.h
  • imProcessZeroCrossing() : im_process_loc.h
  • imRenderCondFunc : im_process_pon.h
  • imRenderFunc : im_process_pon.h
  • imResample() : im_math.h
  • imRound() : im_math.h
  • imStats : im_process_ana.h
  • imStrCheck() : im_util.h
  • imStrEqual() : im_util.h
  • imStrNLen() : im_util.h
  • imToneGamut : im_process_pon.h
  • imUnaryOp : im_process_pon.h
  • imVersion() : im_lib.h
  • imVersionDate() : im_lib.h
  • imVersionNumber() : im_lib.h
  • imVideoCaptureConnect() : im_capture.h
  • imVideoCaptureCreate() : im_capture.h
  • imVideoCaptureDestroy() : im_capture.h
  • imVideoCaptureDeviceCount() : im_capture.h
  • imVideoCaptureDeviceDesc() : im_capture.h
  • imVideoCaptureDeviceExDesc() : im_capture.h
  • imVideoCaptureDevicePath() : im_capture.h
  • imVideoCaptureDeviceVendorInfo() : im_capture.h
  • imVideoCaptureDialogCount() : im_capture.h
  • imVideoCaptureDialogDesc() : im_capture.h
  • imVideoCaptureDisconnect() : im_capture.h
  • imVideoCaptureFormatCount() : im_capture.h
  • imVideoCaptureFrame() : im_capture.h
  • imVideoCaptureGetAttribute() : im_capture.h
  • imVideoCaptureGetAttributeList() : im_capture.h
  • imVideoCaptureGetFormat() : im_capture.h
  • imVideoCaptureGetImageSize() : im_capture.h
  • imVideoCaptureLive() : im_capture.h
  • imVideoCaptureOneFrame() : im_capture.h
  • imVideoCaptureReleaseDevices() : im_capture.h
  • imVideoCaptureReloadDevices() : im_capture.h
  • imVideoCaptureResetAttribute() : im_capture.h
  • imVideoCaptureSetAttribute() : im_capture.h
  • imVideoCaptureSetFormat() : im_capture.h
  • imVideoCaptureSetImageSize() : im_capture.h
  • imVideoCaptureSetInOut() : im_capture.h
  • imVideoCaptureShowDialog() : im_capture.h
  • imZeroOrderDecimation() : im_math.h
  • imZeroOrderInterpolation() : im_math.h
  • inv_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:

- p -

  • pow_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:

- s -

  • sin_op() : im_math_op.h
  • sqr_op() : im_math_op.h
  • sqrt_op() : im_math_op.h
  • sub_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • imcdCanvasPutImage : im_image.h
  • imColorModeHasAlpha : im_util.h
  • imColorModeIsPacked : im_util.h
  • imColorModeIsTopDown : im_util.h
  • imColorModeMatch : im_util.h
  • imColorModeSpace : im_util.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • imBinaryOp : im_process_pon.h
  • imBinFileModule : im_binfile.h
  • imByteOrder : im_util.h
  • imCastMode : im_convert.h
  • imColorModeConfig : im.h
  • imColorSpace : im.h
  • imComplex2Real : im_convert.h
  • imDataType : im.h
  • imErrorCodes : im.h
  • imGammaFactor : im_convert.h
  • imLogicOp : im_process_pon.h
  • imToneGamut : im_process_pon.h
  • imUnaryOp : im_process_pon.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s

- l -

  • less_op() : im_math_op.h
  • log_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s

- m -

  • max_op() : im_math_op.h
  • min_op() : im_math_op.h
  • mul_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s

- c -

  • cos_op() : im_math_op.h
  • crop_byte() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s

- d -

  • diff_op() : im_math_op.h
  • div_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s

- e -

  • exp_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s

- i -

  • imAnalyzeFindRegions() : im_process_ana.h
  • imAnalyzeMeasureArea() : im_process_ana.h
  • imAnalyzeMeasureCentroid() : im_process_ana.h
  • imAnalyzeMeasureHoles() : im_process_ana.h
  • imAnalyzeMeasurePerimArea() : im_process_ana.h
  • imAnalyzeMeasurePerimeter() : im_process_ana.h
  • imAnalyzeMeasurePrincipalAxis() : im_process_ana.h
  • imBicubicInterpolation() : im_math.h
  • imBilinearDecimation() : im_math.h
  • imBilinearInterpolation() : im_math.h
  • imBinCPUByteOrder() : im_util.h
  • imBinFileByteOrder() : im_binfile.h
  • imBinFileClose() : im_binfile.h
  • imBinFileEndOfFile() : im_binfile.h
  • imBinFileError() : im_binfile.h
  • imBinFileNew() : im_binfile.h
  • imBinFileOpen() : im_binfile.h
  • imBinFilePrintf() : im_binfile.h
  • imBinFileRead() : im_binfile.h
  • imBinFileReadFloat() : im_binfile.h
  • imBinFileReadInteger() : im_binfile.h
  • imBinFileSeekFrom() : im_binfile.h
  • imBinFileSeekOffset() : im_binfile.h
  • imBinFileSeekTo() : im_binfile.h
  • imBinFileSetCurrentModule() : im_binfile.h
  • imBinFileSize() : im_binfile.h
  • imBinFileTell() : im_binfile.h
  • imBinFileWrite() : im_binfile.h
  • imBinMemoryRelease() : im_binfile.h
  • imBinSwapBytes() : im_util.h
  • imBinSwapBytes2() : im_util.h
  • imBinSwapBytes4() : im_util.h
  • imBinSwapBytes8() : im_util.h
  • imCalcCountColors() : im_process_ana.h
  • imCalcGrayHistogram() : im_process_ana.h
  • imCalcHistogram() : im_process_ana.h
  • imCalcHistogramStatistics() : im_process_ana.h
  • imCalcHistoImageStatistics() : im_process_ana.h
  • imCalcImageStatistics() : im_process_ana.h
  • imCalcRMSError() : im_process_ana.h
  • imCalcSNR() : im_process_ana.h
  • imCalcUShortHistogram() : im_process_ana.h
  • imColorCMYK2RGB() : im_color.h
  • imColorDecode() : im_util.h
  • imColorEncode() : im_util.h
  • imColorHSI2RGB() : im_colorhsi.h
  • imColorHSI2RGBbyte() : im_colorhsi.h
  • imColorHSI_ImaxS() : im_colorhsi.h
  • imColorLab2XYZ() : im_color.h
  • imColorLightness2Luminance() : im_color.h
  • imColorLuminance2Lightness() : im_color.h
  • imColorLuv2XYZ() : im_color.h
  • imColorMax() : im_color.h
  • imColorModeDepth() : im_util.h
  • imColorModeIsBitmap() : im_util.h
  • imColorModeSpaceName() : im_util.h
  • imColorModeToBitmap() : im_util.h
  • imColorQuantize() : im_color.h
  • imColorReconstruct() : im_color.h
  • imColorRGB2HSI() : im_colorhsi.h
  • imColorRGB2HSIbyte() : im_colorhsi.h
  • imColorRGB2Luma() : im_color.h
  • imColorRGB2RGBNonlinear() : im_color.h
  • imColorRGB2XYZ() : im_color.h
  • imColorRGB2YCbCr() : im_color.h
  • imColorTransfer2Linear() : im_color.h
  • imColorTransfer2Nonlinear() : im_color.h
  • imColorXYZ2Lab() : im_color.h
  • imColorXYZ2Luv() : im_color.h
  • imColorXYZ2RGB() : im_color.h
  • imColorYCbCr2RGB() : im_color.h
  • imColorZero() : im_color.h
  • imCompressDataLZF() : im_util.h
  • imCompressDataUnLZF() : im_util.h
  • imCompressDataUnZ() : im_util.h
  • imCompressDataZ() : im_util.h
  • imConvertColorSpace() : im_convert.h
  • imConvertDataType() : im_convert.h
  • imConvertMapToRGB() : im_convert.h
  • imConvertPacking() : im_convert.h
  • imConvertToBitmap() : im_convert.h
  • imCounterBegin() : im_counter.h
  • imCounterEnd() : im_counter.h
  • imCounterInc() : im_counter.h
  • imCounterIncTo() : im_counter.h
  • imCounterSetCallback() : im_counter.h
  • imCounterTotal() : im_counter.h
  • imDataBitGet() : im_math_op.h
  • imDataBitSet() : im_math_op.h
  • imDataTypeIntMax() : im_util.h
  • imDataTypeIntMin() : im_util.h
  • imDataTypeName() : im_util.h
  • imDataTypeSize() : im_util.h
  • imDibCaptureScreen() : im_dib.h
  • imDibCopyClipboard() : im_dib.h
  • imDibCreate() : im_dib.h
  • imDibCreateCopy() : im_dib.h
  • imDibCreateReference() : im_dib.h
  • imDibCreateSection() : im_dib.h
  • imDibDecodeToBitmap() : im_dib.h
  • imDibDecodeToMap() : im_dib.h
  • imDibDecodeToRGBA() : im_dib.h
  • imDibDestroy() : im_dib.h
  • imDibEncodeFromBitmap() : im_dib.h
  • imDibEncodeFromMap() : im_dib.h
  • imDibEncodeFromRGBA() : im_dib.h
  • imDibFromHBitmap() : im_dib.h
  • imDibIsClipboardAvailable() : im_dib.h
  • imDibLineGetPixelFunc() : im_dib.h
  • imDibLineSetPixelFunc() : im_dib.h
  • imDibLoadFile() : im_dib.h
  • imDibLogicalPalette() : im_dib.h
  • imDibPasteClipboard() : im_dib.h
  • imDibSaveFile() : im_dib.h
  • imDibToHBitmap() : im_dib.h
  • imFileClose() : im.h
  • imFileGetAttribute() : im.h
  • imFileGetAttributeList() : im.h
  • imFileGetInfo() : im.h
  • imFileGetPalette() : im.h
  • imFileHandle() : im.h
  • imFileImageLoad() : im_image.h
  • imFileImageLoadBitmap() : im_image.h
  • imFileImageLoadRegion() : im_image.h
  • imFileImageSave() : im_image.h
  • imFileLineBufferCount() : im_file.h
  • imFileLineBufferInc() : im_file.h
  • imFileLineBufferRead() : im_file.h
  • imFileLineBufferWrite() : im_file.h
  • imFileLineSizeAligned() : im_file.h
  • imFileLoadBitmap() : im_image.h
  • imFileLoadBitmapFrame() : im_image.h
  • imFileLoadImage() : im_image.h
  • imFileLoadImageFrame() : im_image.h
  • imFileLoadImageRegion() : im_image.h
  • imFileNew() : im.h
  • imFileNewRaw() : im_raw.h
  • imFileOpen() : im.h
  • imFileOpenAs() : im.h
  • imFileOpenRaw() : im_raw.h
  • imFileReadImageData() : im.h
  • imFileReadImageInfo() : im.h
  • imFileSaveImage() : im_image.h
  • imFileSetAttribute() : im.h
  • imFileSetBaseAttributes() : im_file.h
  • imFileSetInfo() : im.h
  • imFileSetPalette() : im.h
  • imFileWriteImageData() : im.h
  • imFileWriteImageInfo() : im.h
  • imFormatCanWriteImage() : im.h
  • imFormatCompressions() : im.h
  • imFormatInfo() : im.h
  • imFormatList() : im.h
  • imFormatRegister() : im_format.h
  • imFormatRegisterAVI() : im_format_avi.h
  • imFormatRegisterECW() : im_format_ecw.h
  • imFormatRegisterInternal() : im.h
  • imFormatRegisterJP2() : im_format_jp2.h
  • imFormatRegisterWMV() : im_format_wmv.h
  • imFormatRemoveAll() : im.h
  • imGaussianKernelSize2StdDev() : im_process_loc.h
  • imGaussianStdDev2KernelSize() : im_process_loc.h
  • imImageAddAlpha() : im_image.h
  • imImageCheckFormat() : im_util.h
  • imImageClear() : im_image.h
  • imImageClone() : im_image.h
  • imImageCopy() : im_image.h
  • imImageCopyAttributes() : im_image.h
  • imImageCopyData() : im_image.h
  • imImageCopyPlane() : im_image.h
  • imImageCreate() : im_image.h
  • imImageCreateBased() : im_image.h
  • imImageCreateFromOpenGLData() : im_convert.h
  • imImageDataSize() : im_util.h
  • imImageDestroy() : im_image.h
  • imImageDuplicate() : im_image.h
  • imImageGetAttribute() : im_image.h
  • imImageGetAttributeList() : im_image.h
  • imImageGetOpenGLData() : im_convert.h
  • imImageInit() : im_image.h
  • imImageIsBitmap() : im_image.h
  • imImageLineCount() : im_util.h
  • imImageLineSize() : im_util.h
  • imImageMakeBinary() : im_image.h
  • imImageMakeGray() : im_image.h
  • imImageMatch() : im_image.h
  • imImageMatchColor() : im_image.h
  • imImageMatchColorSpace() : im_image.h
  • imImageMatchDataType() : im_image.h
  • imImageMatchSize() : im_image.h
  • imImageReshape() : im_image.h
  • imImageSetAlpha() : im_image.h
  • imImageSetAttribute() : im_image.h
  • imImageSetBinary() : im_image.h
  • imImageSetPalette() : im_image.h
  • imKernelBarlett5x5() : im_kernel.h
  • imKernelCircularMean5x5() : im_kernel.h
  • imKernelCircularMean7x7() : im_kernel.h
  • imKernelEnhance() : im_kernel.h
  • imKernelGaussian3x3() : im_kernel.h
  • imKernelGaussian5x5() : im_kernel.h
  • imKernelGradian3x3() : im_kernel.h
  • imKernelGradian7x7() : im_kernel.h
  • imKernelKirsh() : im_kernel.h
  • imKernelLaplacian4() : im_kernel.h
  • imKernelLaplacian5x5() : im_kernel.h
  • imKernelLaplacian7x7() : im_kernel.h
  • imKernelLaplacian8() : im_kernel.h
  • imKernelMean3x3() : im_kernel.h
  • imKernelMean5x5() : im_kernel.h
  • imKernelMean7x7() : im_kernel.h
  • imKernelPrewitt() : im_kernel.h
  • imKernelSculpt() : im_kernel.h
  • imKernelSobel() : im_kernel.h
  • imKernelTopHat5x5() : im_kernel.h
  • imKernelTopHat7x7() : im_kernel.h
  • imlua_open() : imlua.h
  • imlua_open_capture() : imlua.h
  • imlua_open_fftw() : imlua.h
  • imlua_open_process() : imlua.h
  • imMinMax() : im_math.h
  • imPaletteBlackBody() : im_palette.h
  • imPaletteBlue() : im_palette.h
  • imPaletteBlueIce() : im_palette.h
  • imPaletteCian() : im_palette.h
  • imPaletteFindColor() : im_palette.h
  • imPaletteFindNearest() : im_palette.h
  • imPaletteGray() : im_palette.h
  • imPaletteGreen() : im_palette.h
  • imPaletteHighContrast() : im_palette.h
  • imPaletteHotIron() : im_palette.h
  • imPaletteHues() : im_palette.h
  • imPaletteMagenta() : im_palette.h
  • imPaletteRainbow() : im_palette.h
  • imPaletteRed() : im_palette.h
  • imPaletteUniform() : im_palette.h
  • imPaletteUniformIndex() : im_palette.h
  • imPaletteUniformIndexHalftoned() : im_palette.h
  • imPaletteYellow() : im_palette.h
  • imProcessAddMargins() : im_process_loc.h
  • imProcessArithmeticConstOp() : im_process_pon.h
  • imProcessArithmeticOp() : im_process_pon.h
  • imProcessAutoCorrelation() : im_process_glo.h
  • imProcessAutoCovariance() : im_process_pon.h
  • imProcessBarlettConvolve() : im_process_loc.h
  • imProcessBinMorphClose() : im_process_loc.h
  • imProcessBinMorphConvolve() : im_process_loc.h
  • imProcessBinMorphDilate() : im_process_loc.h
  • imProcessBinMorphErode() : im_process_loc.h
  • imProcessBinMorphOpen() : im_process_loc.h
  • imProcessBinMorphOutline() : im_process_loc.h
  • imProcessBinMorphThin() : im_process_loc.h
  • imProcessBitMask() : im_process_pon.h
  • imProcessBitPlane() : im_process_pon.h
  • imProcessBitwiseNot() : im_process_pon.h
  • imProcessBitwiseOp() : im_process_pon.h
  • imProcessBlend() : im_process_pon.h
  • imProcessBlendConst() : im_process_pon.h
  • imProcessCalcRotateSize() : im_process_loc.h
  • imProcessCanny() : im_process_loc.h
  • imProcessCompassConvolve() : im_process_loc.h
  • imProcessCompose() : im_process_pon.h
  • imProcessConvolve() : im_process_loc.h
  • imProcessConvolveDual() : im_process_loc.h
  • imProcessConvolveRep() : im_process_loc.h
  • imProcessConvolveSep() : im_process_loc.h
  • imProcessCrop() : im_process_loc.h
  • imProcessCrossCorrelation() : im_process_glo.h
  • imProcessDiffOfGaussianConvolve() : im_process_loc.h
  • imProcessDifusionErrThreshold() : im_process_pon.h
  • imProcessDirectConv() : im_process_pon.h
  • imProcessDistanceTransform() : im_process_glo.h
  • imProcessEqualizeHistogram() : im_process_pon.h
  • imProcessExpandHistogram() : im_process_pon.h
  • imProcessFFT() : im_process_glo.h
  • imProcessFFTraw() : im_process_glo.h
  • imProcessFillHoles() : im_process_ana.h
  • imProcessFlip() : im_process_loc.h
  • imProcessGaussianConvolve() : im_process_loc.h
  • imProcessGrayMorphClose() : im_process_loc.h
  • imProcessGrayMorphConvolve() : im_process_loc.h
  • imProcessGrayMorphDilate() : im_process_loc.h
  • imProcessGrayMorphErode() : im_process_loc.h
  • imProcessGrayMorphGradient() : im_process_loc.h
  • imProcessGrayMorphOpen() : im_process_loc.h
  • imProcessGrayMorphTopHat() : im_process_loc.h
  • imProcessGrayMorphWell() : im_process_loc.h
  • imProcessHoughLines() : im_process_glo.h
  • imProcessHoughLinesDraw() : im_process_glo.h
  • imProcessHysteresisThresEstimate() : im_process_pon.h
  • imProcessHysteresisThreshold() : im_process_pon.h
  • imProcessIFFT() : im_process_glo.h
  • imProcessInsert() : im_process_loc.h
  • imProcessInterlaceSplit() : im_process_loc.h
  • imProcessLapOfGaussianConvolve() : im_process_loc.h
  • imProcessLocalMaxThresEstimate() : im_process_pon.h
  • imProcessLocalMaxThreshold() : im_process_loc.h
  • imProcessMeanConvolve() : im_process_loc.h
  • imProcessMedianConvolve() : im_process_loc.h
  • imProcessMergeComplex() : im_process_pon.h
  • imProcessMergeComponents() : im_process_pon.h
  • imProcessMergeHSI() : im_process_pon.h
  • imProcessMinMaxThreshold() : im_process_pon.h
  • imProcessMirror() : im_process_loc.h
  • imProcessMultipleMean() : im_process_pon.h
  • imProcessMultipleStdDev() : im_process_pon.h
  • imProcessMultiplyConj() : im_process_pon.h
  • imProcessNegative() : im_process_pon.h
  • imProcessNormalizeComponents() : im_process_pon.h
  • imProcessOtsuThreshold() : im_process_pon.h
  • imProcessPercentThreshold() : im_process_pon.h
  • imProcessPerimeterLine() : im_process_ana.h
  • imProcessPixelate() : im_process_pon.h
  • imProcessPosterize() : im_process_pon.h
  • imProcessPrewittConvolve() : im_process_loc.h
  • imProcessQuantizeGrayUniform() : im_process_pon.h
  • imProcessQuantizeRGBUniform() : im_process_pon.h
  • imProcessRadial() : im_process_loc.h
  • imProcessRangeContrastThreshold() : im_process_loc.h
  • imProcessRangeConvolve() : im_process_loc.h
  • imProcessRankClosestConvolve() : im_process_loc.h
  • imProcessRankMaxConvolve() : im_process_loc.h
  • imProcessRankMinConvolve() : im_process_loc.h
  • imProcessReduce() : im_process_loc.h
  • imProcessReduceBy4() : im_process_loc.h
  • imProcessRegionalMaximum() : im_process_glo.h
  • imProcessRemoveByArea() : im_process_ana.h
  • imProcessRenderAddGaussianNoise() : im_process_pon.h
  • imProcessRenderAddSpeckleNoise() : im_process_pon.h
  • imProcessRenderAddUniformNoise() : im_process_pon.h
  • imProcessRenderBox() : im_process_pon.h
  • imProcessRenderChessboard() : im_process_pon.h
  • imProcessRenderCondOp() : im_process_pon.h
  • imProcessRenderCone() : im_process_pon.h
  • imProcessRenderConstant() : im_process_pon.h
  • imProcessRenderCosine() : im_process_pon.h
  • imProcessRenderGaussian() : im_process_pon.h
  • imProcessRenderGrid() : im_process_pon.h
  • imProcessRenderLapOfGaussian() : im_process_pon.h
  • imProcessRenderOp() : im_process_pon.h
  • imProcessRenderRamp() : im_process_pon.h
  • imProcessRenderRandomNoise() : im_process_pon.h
  • imProcessRenderSinc() : im_process_pon.h
  • imProcessRenderTent() : im_process_pon.h
  • imProcessRenderWheel() : im_process_pon.h
  • imProcessReplaceColor() : im_process_pon.h
  • imProcessResize() : im_process_loc.h
  • imProcessRotate() : im_process_loc.h
  • imProcessRotate180() : im_process_loc.h
  • imProcessRotate90() : im_process_loc.h
  • imProcessRotateKernel() : im_process_loc.h
  • imProcessRotateRef() : im_process_loc.h
  • imProcessSharp() : im_process_loc.h
  • imProcessSharpKernel() : im_process_loc.h
  • imProcessSliceThreshold() : im_process_pon.h
  • imProcessSobelConvolve() : im_process_loc.h
  • imProcessSplineEdgeConvolve() : im_process_loc.h
  • imProcessSplitComplex() : im_process_pon.h
  • imProcessSplitComponents() : im_process_pon.h
  • imProcessSplitHSI() : im_process_pon.h
  • imProcessSplitYChroma() : im_process_pon.h
  • imProcessSwapQuadrants() : im_process_glo.h
  • imProcessSwirl() : im_process_loc.h
  • imProcessThreshold() : im_process_pon.h
  • imProcessThresholdByDiff() : im_process_pon.h
  • imProcessToneGamut() : im_process_pon.h
  • imProcessUnArithmeticOp() : im_process_pon.h
  • imProcessUniformErrThreshold() : im_process_pon.h
  • imProcessUnNormalize() : im_process_pon.h
  • imProcessUnsharp() : im_process_loc.h
  • imProcessZeroCrossing() : im_process_loc.h
  • imResample() : im_math.h
  • imRound() : im_math.h
  • imStrCheck() : im_util.h
  • imStrEqual() : im_util.h
  • imStrNLen() : im_util.h
  • imVersion() : im_lib.h
  • imVersionDate() : im_lib.h
  • imVersionNumber() : im_lib.h
  • imVideoCaptureConnect() : im_capture.h
  • imVideoCaptureCreate() : im_capture.h
  • imVideoCaptureDestroy() : im_capture.h
  • imVideoCaptureDeviceCount() : im_capture.h
  • imVideoCaptureDeviceDesc() : im_capture.h
  • imVideoCaptureDeviceExDesc() : im_capture.h
  • imVideoCaptureDevicePath() : im_capture.h
  • imVideoCaptureDeviceVendorInfo() : im_capture.h
  • imVideoCaptureDialogCount() : im_capture.h
  • imVideoCaptureDialogDesc() : im_capture.h
  • imVideoCaptureDisconnect() : im_capture.h
  • imVideoCaptureFormatCount() : im_capture.h
  • imVideoCaptureFrame() : im_capture.h
  • imVideoCaptureGetAttribute() : im_capture.h
  • imVideoCaptureGetAttributeList() : im_capture.h
  • imVideoCaptureGetFormat() : im_capture.h
  • imVideoCaptureGetImageSize() : im_capture.h
  • imVideoCaptureLive() : im_capture.h
  • imVideoCaptureOneFrame() : im_capture.h
  • imVideoCaptureReleaseDevices() : im_capture.h
  • imVideoCaptureReloadDevices() : im_capture.h
  • imVideoCaptureResetAttribute() : im_capture.h
  • imVideoCaptureSetAttribute() : im_capture.h
  • imVideoCaptureSetFormat() : im_capture.h
  • imVideoCaptureSetImageSize() : im_capture.h
  • imVideoCaptureSetInOut() : im_capture.h
  • imVideoCaptureShowDialog() : im_capture.h
  • imZeroOrderDecimation() : im_math.h
  • imZeroOrderInterpolation() : im_math.h
  • inv_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s

- p -

  • pow_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Data Fields

  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • Defines
  • a
  • c
  • d
  • e
  • i
  • l
  • m
  • p
  • s

- s -

  • sin_op() : im_math_op.h
  • sqr_op() : im_math_op.h
  • sqrt_op() : im_math_op.h
  • sub_op() : im_math_op.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: Graph Legend

Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

Consider the following example:

/*! Invisible class because of truncation */
class Invisible { };

/*! Truncated class, inheritance relation is hidden */
class Truncated : public Invisible { };

/* Class not documented with doxygen comments */
class Undocumented { };

/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };

/*! A template class */
template<class T> class Templ { };

/*! Class that is inherited using protected inheritance */
class ProtectedBase { };

/*! Class that is inherited using private inheritance */
class PrivateBase { };

/*! Class that is used by the Inherited class */
class Used { };

/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,
                  protected ProtectedBase,
                  private PrivateBase,
                  public Undocumented,
                  public Templ<int>
{
  private:
    Used *m_usedClass;
};

This will result in the following graph:

The boxes in the above graph have the following meaning:

  • A filled gray box represents the struct or class for which the graph is generated.
  • A box with a black border denotes a documented struct or class.
  • A box with a grey border denotes an undocumented struct or class.
  • A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.

The arrows have the following meaning:

  • A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • A dark green arrow is used for protected inheritance.
  • A dark red arrow is used for private inheritance.
  • A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
  • A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labeled with the template parameters of the instance.
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1


IM: im.h Source File

im.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Main API
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_H
00008 #define __IM_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014
00015 /** Image data type descriptors. \n
00016  * See also \ref datatypeutl.
00017  * \ingroup imagerep */
00018 enum imDataType
00019 {
00020   IM_BYTE,   /**< "unsigned char". 1 byte from 0 to 255.                  */
00021   IM_USHORT, /**< "unsigned short". 2 bytes from 0 to 65,535.             */
00022   IM_INT,    /**< "int". 4 bytes from -2,147,483,648 to 2,147,483,647.    */
00023   IM_FLOAT,  /**< "float". 4 bytes single precision IEEE floating point.  */
00024   IM_CFLOAT  /**< complex "float". 2 float values in sequence, real and imaginary parts.   */
00025 };
00026
00027 /** Image color mode color space descriptors (first byte). \n
00028  * See also \ref colormodeutl.
00029  * \ingroup imagerep */
00030 enum imColorSpace
00031 {
00032   IM_RGB,    /**< Red, Green and Blue (nonlinear).              */
00033   IM_MAP,    /**< Indexed by RGB color map (data_type=IM_BYTE). */
00034   IM_GRAY,   /**< Shades of gray, luma (nonlinear Luminance), or an intensity value that is not related to color. */
00035   IM_BINARY, /**< Indexed by 2 colors: black (0) and white (1) (data_type=IM_BYTE).     */
00036   IM_CMYK,   /**< Cian, Magenta, Yellow and Black (nonlinear).                          */
00037   IM_YCBCR,  /**< ITU-R 601 Y'CbCr. Y' is luma (nonlinear Luminance).                   */
00038   IM_LAB,    /**< CIE L*a*b*. L* is Lightness (nonlinear Luminance, nearly perceptually uniform). */
00039   IM_LUV,    /**< CIE L*u*v*. L* is Lightness (nonlinear Luminance, nearly perceptually uniform). */
00040   IM_XYZ     /**< CIE XYZ. Linear Light Tristimulus, Y is linear Luminance.             */
00041 };
00042
00043 /** Image color mode configuration/extra descriptors (1 bit each in the second byte). \n
00044  * See also \ref colormodeutl.
00045  * \ingroup imagerep */
00046 enum imColorModeConfig
00047 {
00048   IM_ALPHA    = 0x100,  /**< adds an Alpha channel */
00049   IM_PACKED   = 0x200,  /**< packed components (rgbrgbrgb...) */
00050   IM_TOPDOWN  = 0x400   /**< orientation from top down to bottom */
00051 };
00052
00053
00054
00055 /** File Access Error Codes
00056  * \ingroup file */
00057 enum imErrorCodes
00058 {
00059   IM_ERR_NONE,     /**< No error. */
00060   IM_ERR_OPEN,     /**< Error while opening the file (read or write). */
00061   IM_ERR_ACCESS,   /**< Error while accessing the file (read or write). */
00062   IM_ERR_FORMAT,   /**< Invalid or unrecognized file format. */
00063   IM_ERR_DATA,     /**< Invalid or unsupported data. */
00064   IM_ERR_COMPRESS, /**< Invalid or unsupported compression. */
00065   IM_ERR_MEM,      /**< Insuficient memory */
00066   IM_ERR_COUNTER   /**< Interrupted by the counter */
00067 };
00068
00069 /* Internal Image File Structure. */
00070 typedef struct _imFile imFile;
00071
00072 /** Opens the file for reading. It must exists. Also reads file header.
00073  * It will try to identify the file format.
00074  * See also \ref imErrorCodes. \n
00075  * In Lua the IM file metatable name is "imFile".
00076  * When converted to a string will return "imFile(%p)" where %p is replaced by the userdata address.
00077  * If the file is already closed by im.FileClose, then it will return also the suffix "-closed".
00078  *
00079  * \verbatim im.FileOpen(file_name: string) -> ifile: imFile, error: number [in Lua 5] \endverbatim
00080  * \ingroup file */
00081 imFile* imFileOpen(const char* file_name, int *error);
00082
00083 /** Opens the file for reading using a specific format. It must exists. Also reads file header.
00084  * See also \ref imErrorCodes and \ref format.
00085  *
00086  * \verbatim im.FileOpenAs(file_name, format: string) -> ifile: imFile, error: number [in Lua 5] \endverbatim
00087  * \ingroup file */
00088 imFile* imFileOpenAs(const char* file_name, const char* format, int *error);
00089
00090 /** Creates a new file for writing using a specific format. If the file exists will be replaced. \n
00091  * It will only initialize the format driver and create the file, no data is actually written.
00092  * See also \ref imErrorCodes and \ref format.
00093  *
00094  * \verbatim im.FileNew(file_name: string, format: string) -> ifile: imFile, error: number [in Lua 5] \endverbatim
00095  * \ingroup file */
00096 imFile* imFileNew(const char* file_name, const char* format, int *error);
00097
00098 /** Closes the file. \n
00099  * In Lua if this function is not called, the file is closed by the garbage collector.
00100  *
00101  * \verbatim im.FileClose(ifile: imFile) [in Lua 5] \endverbatim
00102  * \verbatim ifile:Close() [in Lua 5] \endverbatim
00103  * \ingroup file */
00104 void imFileClose(imFile* ifile);
00105
00106 /** Returns an internal handle.
00107  * index=0 returns always an imBinFile* handle,
00108  * but for some formats returns NULL because they do not use imBinFile (like AVI and WMV).
00109  * index=1 return an internal structure used by the format, usually is a handle
00110  * to a third party library structure. This is file format dependent.
00111  *
00112  * \verbatim ifile:Handle() -> handle: userdata [in Lua 5] \endverbatim
00113  * \ingroup file */
00114 void* imFileHandle(imFile* ifile, int index);
00115
00116 /** Returns file information.
00117  * image_count is the number of images in a stack or
00118  * the number of frames in a video/animation or the depth of a volume data. \n
00119  * compression and image_count can be NULL. \n
00120  * These informations are also available as attributes:
00121  * \verbatim FileFormat (string) \endverbatim
00122  * \verbatim FileCompression (string) \endverbatim
00123  * \verbatim FileImageCount IM_INT (1) \endverbatim
00124  * See also \ref format.
00125  *
00126  * \verbatim ifile:GetInfo() -> format: string, compression: string, image_count: number [in Lua 5] \endverbatim
00127  * \ingroup file */
00128 void imFileGetInfo(imFile* ifile, char* format, char* compression, int *image_count);
00129
00130 /** Changes the write compression method. \n
00131  * If the compression is not supported will return an error code when writting. \n
00132  * Use NULL to set the default compression. You can use the imFileGetInfo to retrieve the actual compression
00133  * but only after \ref imFileWriteImageInfo. Only a few formats allow you to change the compression between frames.
00134  *
00135  * \verbatim ifile:SetInfo(compression: string) [in Lua 5] \endverbatim
00136  * \ingroup file */
00137 void imFileSetInfo(imFile* ifile, const char* compression);
00138
00139 /** Changes an extended attribute. \n
00140  * The data will be internally duplicated. \n
00141  * If data is NULL the attribute is removed.
00142  * If data_type is BYTE then count can be -1 to indicate a NULL terminated string.
00143  * See also \ref imDataType.
00144  *
00145  * \verbatim ifile:SetAttribute(attrib: string, data_type: number, data: table of numbers or string) [in Lua 5] \endverbatim
00146  * If data_type is IM_BYTE, as_string can be used as data.
00147  * \ingroup file */
00148 void imFileSetAttribute(imFile* ifile, const char* attrib, int data_type, int count, const void* data);
00149
00150 /** Returns an extended attribute. \n
00151  * Returns NULL if not found. data_type and count can be NULL.
00152  * See also \ref imDataType.
00153  *
00154  * \verbatim ifile:GetAttribute(attrib: string, [as_string: boolean]) -> data: table of numbers or string, data_type: number [in Lua 5] \endverbatim
00155  * If data_type is IM_BYTE, as_string can be used to return a string instead of a table.
00156  * \ingroup file */
00157 const void* imFileGetAttribute(imFile* ifile, const char* attrib, int *data_type, int *count);
00158
00159 /** Returns a list of the attribute names. \n
00160  * "attrib" must contain room enough for "attrib_count" names. Use "attrib=NULL" to return only the count.
00161  *
00162  * \verbatim ifile:GetAttributeList() -> data: table of strings [in Lua 5] \endverbatim
00163  * \ingroup file */
00164 void imFileGetAttributeList(imFile* ifile, char** attrib, int *attrib_count);
00165
00166 /** Returns the pallete if any. \n
00167  * "palette" must be a 256 colors alocated array. \n
00168  * Returns zero in "palette_count" if there is no palette. "palette_count" is >0 and <=256.
00169  *
00170  * \verbatim ifile:GetPalette() -> palette: imPalette [in Lua 5] \endverbatim
00171  * \ingroup file */
00172 void imFileGetPalette(imFile* ifile, long* palette, int *palette_count);
00173
00174 /** Changes the pallete. \n
00175  *  "palette_count" is >0 and <=256.
00176  *
00177  * \verbatim ifile:SetPalette(palette: imPalette) [in Lua 5] \endverbatim
00178  * \ingroup file */
00179 void imFileSetPalette(imFile* ifile, long* palette, int palette_count);
00180
00181 /** Reads the image header if any and returns image information. \n
00182  * Reads also the extended image attributes, so other image attributes will be available only after calling this function. \n
00183  * Returns an error code.
00184  * index specifies the image number between 0 and image_count-1. \n
00185  * Some drivers reads only in sequence, so "index" can be ignored by the format driver. \n
00186  * Any parameters can be NULL. This function must be called at least once, check each format documentation.
00187  * See also \ref imErrorCodes, \ref imDataType, \ref imColorSpace and \ref imColorModeConfig.
00188  *
00189  * \verbatim ifile:ReadImageInfo([index: number]) -> error: number, width: number, height: number, file_color_mode: number, file_data_type: number [in Lua 5] \endverbatim
00190  * Default index is 0.
00191  * \ingroup file */
00192 int imFileReadImageInfo(imFile* ifile, int index, int *width, int *height, int *file_color_mode, int *file_data_type);
00193
00194 /** Writes the image header. Writes the file header at the first time it is called.
00195  * Writes also the extended image attributes. \n
00196  * Must call imFileSetPalette and set other attributes before calling this function. \n
00197  * In some formats the color space will be converted to match file format specification. \n
00198  * Returns an error code. This function must be called at least once, check each format documentation.
00199  * See also \ref imErrorCodes, \ref imDataType, \ref imColorSpace and \ref imColorModeConfig.
00200  *
00201  * \verbatim ifile:WriteImageInfo(width: number, height: number, user_color_mode: number, user_data_type: number) -> error: number [in Lua 5] \endverbatim
00202  * \ingroup file */
00203 int imFileWriteImageInfo(imFile* ifile, int width, int height, int user_color_mode, int user_data_type);
00204
00205 /** Reads the image data with or without conversion. \n
00206  * The data can be converted to bitmap when reading.
00207  * Data type conversion to byte will always scan for min-max then scale to 0-255,
00208  * except integer values that min-max are already between 0-255. Complex to real conversions will use the magnitude. \n
00209  * Color mode flags contains packed, alpha and top-botttom information.
00210  * If flag is 0 means unpacked, no alpha and bottom up. If flag is -1 the file original flags are used. \n
00211  * Returns an error code.
00212  * See also \ref imErrorCodes, \ref imDataType, \ref imColorSpace and \ref imColorModeConfig.
00213  *
00214  * \verbatim ifile:ReadImageData(data: userdata, convert2bitmap: boolean, color_mode_flags: number) -> error: number [in Lua 5] \endverbatim
00215  * \ingroup file */
00216 int imFileReadImageData(imFile* ifile, void* data, int convert2bitmap, int color_mode_flags);
00217
00218 /** Writes the image data. \n
00219  * Returns an error code.
00220  *
00221  * \verbatim ifile:WriteImageData(data: userdata) -> error: number [in Lua 5] \endverbatim
00222  * \ingroup file */
00223 int imFileWriteImageData(imFile* ifile, void* data);
00224
00225
00226
00227
00228 /** Registers all the internal formats. \n
00229  * It is automatically called internally when a format is accessed,
00230  * but can be called to force the internal formats to be registered before other formats.
00231  * Notice that additional formats when registered will be registered before the internal formats
00232  * if imFormatRegisterInternal is not called yet. \n
00233  * To control the register order is usefull when two format drivers handle the same format.
00234  * The first registered format will always be used first.
00235  * \ingroup format */
00236 void imFormatRegisterInternal(void);
00237
00238 /** Remove all registered formats. Call this if you are checking memory leaks.
00239  * \ingroup format */
00240 void imFormatRemoveAll(void);
00241
00242 /** Returns a list of the registered formats. \n
00243  * format_list is an array of format identifiers.
00244  * Each format identifier is 10 chars max, maximum of 50 formats.
00245  * You can use "char* format_list[50]".
00246  *
00247  * \verbatim im.FormatList() -> format_list: table of strings [in Lua 5] \endverbatim
00248  * \ingroup format */
00249 void imFormatList(char** format_list, int *format_count);
00250
00251 /** Returns the format description. \n
00252  * Format description is 50 chars max. \n
00253  * Extensions are separated like "*.tif;*.tiff;", 50 chars max. \n
00254  * Returns an error code. The parameters can be NULL, except format.
00255  * See also \ref format.
00256  *
00257  * \verbatim im.FormatInfo(format: string) -> error: number, desc: string, ext: string, can_sequence: boolean [in Lua 5] \endverbatim
00258  * \ingroup format */
00259 int imFormatInfo(const char* format, char* desc, char* ext, int *can_sequence);
00260
00261 /** Returns the format compressions. \n
00262  * Compressions are 20 chars max each, maximum of 50 compressions. You can use "char* comp[50]". \n
00263  * color_mode and data_type are optional, use -1 to ignore them. \n
00264  * If you use them they will select only the allowed compressions checked like in \ref imFormatCanWriteImage. \n
00265  * Returns an error code.
00266  * See also \ref format, \ref imErrorCodes, \ref imDataType, \ref imColorSpace and \ref imColorModeConfig.
00267  *
00268  * \verbatim im.FormatCompressions(format: string, [color_mode: number], [data_type: number]) -> error: number, comp: table of strings [in Lua 5] \endverbatim
00269  * \ingroup format */
00270 int imFormatCompressions(const char* format, char** comp, int *comp_count, int color_mode, int data_type);
00271
00272 /** Checks if the format suport the given image class at the given compression. \n
00273  * Returns an error code.
00274  * See also \ref format, \ref imErrorCodes, \ref imDataType, \ref imColorSpace and \ref imColorModeConfig.
00275  *
00276  * \verbatim im.FormatCanWriteImage(format: string, compression: string, color_mode: number, data_type: number) -> can_write: boolean [in Lua 5] \endverbatim
00277  * \ingroup format */
00278 int imFormatCanWriteImage(const char* format, const char* compression, int color_mode, int data_type);
00279
00280
00281 #if defined(__cplusplus)
00282 }
00283 #endif
00284
00285 #include "old_im.h"
00286
00287 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_attrib.h Source File

im_attrib.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Attributes Table.
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_ATTRIB_H_
00008 #define __IM_ATTRIB_H_
00009
00010 #include "im_attrib_flat.h"
00011
00012 /** \brief Attributes Table.
00013  *
00014  * \par
00015  * All the attributes have a name, a type, a count and the data.\n
00016  * Names are usually strings with less that 30 chars.
00017  * \par
00018  * Attributes are stored in a hash table for fast access. \n
00019  * We use the hash function described in "The Pratice of Programming" of Kernighan & Pike.
00020  * \ingroup util */
00021 class imAttribTable
00022 {
00023   imAttribTablePrivate* ptable;
00024 public:
00025
00026   /** Creates an empty table.
00027    * If size is zero the default size of 101 is used. Size must be a prime number.
00028    * Other common values are 67, 599 and 1499.*/
00029   imAttribTable(int hash_size)
00030     { ptable = imAttribTableCreate(hash_size); }
00031
00032   /** Destroys the table and all the attributes. */
00033   ~imAttribTable()
00034     { imAttribTableDestroy(ptable); ptable = 0; }
00035
00036   /** Returns the number of elements in the table. */
00037   int Count() const
00038     { return imAttribTableCount(ptable); }
00039
00040   /** Removes all the attributes in the table */
00041   void RemoveAll()
00042     { imAttribTableRemoveAll(ptable); }
00043
00044   /** Copies the contents of the given table into this table. */
00045   void CopyFrom(const imAttribTable& table)
00046     { imAttribTableCopyFrom(ptable, table.ptable); }
00047
00048   /** Inserts an attribute into the table. \n
00049    * If data_type is BYTE then count can be -1 to indicate a NULL terminated string.
00050    * Data is duplicated if not NULL, else data is initialized with zeros.
00051    * See also \ref imDataType. */
00052   void Set(const char* name, int data_type, int count, const void* data)
00053     { imAttribTableSet(ptable, name, data_type, count, data); }
00054
00055   /** Removes an attribute from the table given its name. */
00056   void UnSet(const char *name)
00057     { imAttribTableUnSet(ptable, name); }
00058
00059   /** Finds an attribute in the table.
00060    * Returns the attribute if found, NULL otherwise.
00061    * See also \ref imDataType. */
00062   const void* Get(const char *name, int *data_type = 0, int *count = 0) const
00063     { return imAttribTableGet(ptable, name, data_type, count); }
00064
00065   /** For each attribute calls the user callback. If the callback returns 0 the function returns. */
00066   void ForEach(void* user_data, imAttribTableCallback attrib_func) const
00067     { imAttribTableForEach(ptable, user_data, attrib_func); }
00068 };
00069
00070 /** \brief Attributes Table.
00071  *
00072  * \par
00073  * Same as \ref imAttribTable, but uses an array of fixed size.
00074  * \ingroup util */
00075 class imAttribArray
00076 {
00077   imAttribTablePrivate* ptable;
00078 public:
00079
00080   /** Creates an empty array. */
00081   imAttribArray(int count)
00082     { ptable = imAttribArrayCreate(count); }
00083
00084   /** Destroys the array and all the attributes. */
00085   ~imAttribArray()
00086     { imAttribTableDestroy(ptable); ptable = 0; }
00087
00088   /** Returns the number of elements in the array. */
00089   int Count() const
00090     { return imAttribTableCount(ptable); }
00091
00092   /** Removes all the attributes in the array */
00093   void RemoveAll()
00094     { imAttribTableRemoveAll(ptable); }
00095
00096   /** Copies the contents of the given table into this table. */
00097   void CopyFrom(const imAttribArray& table)
00098     { imAttribArrayCopyFrom(ptable, table.ptable); }
00099
00100   /** Inserts one attribute into the array.
00101    * The attribute data is a simple array of data_type elements of count length. \n
00102    * Data is duplicated if not NULL, else data is initialized with zeros.
00103    * When NULL is specified use the Get method to retrieve a pointer to the data
00104    * so you can initialize it with other values.
00105    * See also \ref imDataType. */
00106   void Set(int index, const char* name, int data_type, int count, const void* data)
00107     { imAttribArraySet(ptable, index, name, data_type, count, data); }
00108
00109   /** Finds one attribute in the array.
00110    * Returns the attribute if found, NULL otherwise.
00111    * See also \ref imDataType. */
00112   const void* Get(int index, char *name = 0, int *data_type = 0, int *count = 0) const
00113     { return imAttribArrayGet(ptable, index, name, data_type, count); }
00114
00115   /** For each attribute calls the user callback. If the callback returns 0 the function returns. */
00116   void ForEach(void* user_data, imAttribTableCallback attrib_func) const
00117     { imAttribTableForEach(ptable, user_data, attrib_func); }
00118 };
00119
00120 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_attrib_flat.h Source File

im_attrib_flat.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Attributes Table Flat API.
00003  * This will simplify the DLL export, and can be used for C aplications.
00004  *
00005  * See Copyright Notice in im_lib.h
00006  */
00007
00008 #ifndef __IM_ATTRIB_FLAT_H_
00009 #define __IM_ATTRIB_FLAT_H_
00010
00011 #if     defined(__cplusplus)
00012 extern "C" {
00013 #endif
00014
00015 struct imAttribTablePrivate;
00016
00017 /** Definition of the callback used in ForEach function. */
00018 typedef int (*imAttribTableCallback)(void* user_data, int index, const char* name, int data_type, int count, const void* data);
00019
00020 imAttribTablePrivate* imAttribTableCreate(int hash_size);
00021 void imAttribTableDestroy(imAttribTablePrivate* ptable);
00022 int imAttribTableCount(imAttribTablePrivate* ptable);
00023 void imAttribTableRemoveAll(imAttribTablePrivate* ptable);
00024 const void* imAttribTableGet(const imAttribTablePrivate* ptable, const char *name, int *data_type, int *count);
00025 void imAttribTableSet(imAttribTablePrivate* ptable, const char* name, int data_type, int count, const void* data);
00026 void imAttribTableUnSet(imAttribTablePrivate* ptable, const char *name);
00027 void imAttribTableCopyFrom(imAttribTablePrivate* ptable_dst, const imAttribTablePrivate* ptable_src);
00028 void imAttribTableForEach(const imAttribTablePrivate* ptable, void* user_data, imAttribTableCallback attrib_func);
00029
00030 imAttribTablePrivate* imAttribArrayCreate(int hash_size);
00031 const void* imAttribArrayGet(const imAttribTablePrivate* ptable, int index, char *name, int *data_type, int *count);
00032 void imAttribArraySet(imAttribTablePrivate* ptable, int index, const char* name, int data_type, int count, const void* data);
00033 void imAttribArrayCopyFrom(imAttribTablePrivate* ptable_dst, const imAttribTablePrivate* ptable_src);
00034
00035 #if defined(__cplusplus)
00036 }
00037 #endif
00038
00039 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_binfile.h Source File

im_binfile.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Binary File Access.
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #include "im_util.h"
00008
00009 #ifndef __IM_BINFILE_H
00010 #define __IM_BINFILE_H
00011
00012 #if     defined(__cplusplus)
00013 extern "C" {
00014 #endif
00015
00016
00017 /** \defgroup binfile Binary File Access
00018  *
00019  * \par
00020  * These functions are very usefull for reading/writing binary files
00021  * that have headers or data that have to be converted depending on
00022  * the current CPU byte order. It can invert 2, 4 or 8 bytes numbers to/from little/big-endian orders.
00023  * \par
00024  * It will process the data only if the file format is diferent from the current CPU.
00025  * \par
00026  * Can read from disk or memory. In case of a memory buffer, the file name must be the \ref imBinMemoryFileName structure.
00027  * \par
00028  * See \ref im_binfile.h
00029  * \ingroup util */
00030
00031 typedef struct _imBinFile imBinFile;
00032
00033 /** Opens an existant binary file for reading.
00034  * The default file byte order is the CPU byte order.
00035  * Returns NULL if failed.
00036  * \ingroup binfile */
00037 imBinFile* imBinFileOpen(const char* pFileName);
00038
00039 /** Creates a new binary file for writing.
00040  * The default file byte order is the CPU byte order.
00041  * Returns NULL if failed.
00042  * \ingroup binfile */
00043 imBinFile* imBinFileNew(const char* pFileName);
00044
00045 /** Closes the file.
00046  * \ingroup binfile */
00047 void imBinFileClose(imBinFile* bfile);
00048
00049 /** Indicates that was an error on the last operation.
00050  * \ingroup binfile */
00051 int imBinFileError(imBinFile* bfile);
00052
00053 /** Returns the file size in bytes.
00054  * \ingroup binfile */
00055 unsigned long imBinFileSize(imBinFile* bfile);
00056
00057 /** Changes the file byte order. Returns the old one.
00058  * \ingroup binfile */
00059 int imBinFileByteOrder(imBinFile* bfile, int pByteOrder);
00060
00061 /** Reads an array of count values with byte sizes: 1, 2, 4, or 8. And invert the byte order if necessary after read.
00062  * \ingroup binfile */
00063 unsigned long imBinFileRead(imBinFile* bfile, void* pValues, unsigned long pCount, int pSizeOf);
00064
00065 /** Writes an array of values with sizes: 1, 2, 4, or 8. And invert the byte order if necessary before write.\n
00066  * <b>ATENTION</b>: The function will not make a temporary copy of the values to invert the byte order.\n
00067  * So after the call the values will be invalid, if the file byte order is diferent from the CPU byte order.
00068  * \ingroup binfile */
00069 unsigned long imBinFileWrite(imBinFile* bfile, void* pValues, unsigned long pCount, int pSizeOf);
00070
00071 /** Writes a string without the NULL terminator. The function uses sprintf to compose the string. \n
00072  * The internal buffer is fixed at 4096 bytes.
00073  * \ingroup binfile */
00074 unsigned long imBinFilePrintf(imBinFile* bfile, char *format, ...);
00075
00076 /** Reads an integer number from the current position until found a non integer character.
00077  * Returns a non zero value if sucessfull.
00078  * \ingroup binfile */
00079 int imBinFileReadInteger(imBinFile* handle, int *value);
00080
00081 /** Reads an floating point number from the current position until found a non number character.
00082  * Returns a non zero value if sucessfull.
00083  * \ingroup binfile */
00084 int imBinFileReadFloat(imBinFile* handle, float *value);
00085
00086 /** Moves the file pointer from the begining of the file.\n
00087  * When writing to a file seeking can go beyond the end of the file.
00088  * \ingroup binfile */
00089 void imBinFileSeekTo(imBinFile* bfile, unsigned long pOffset);
00090
00091 /** Moves the file pointer from current position.\n
00092  * If the offset is a negative value the pointer moves backwards.
00093  * \ingroup binfile */
00094 void imBinFileSeekOffset(imBinFile* bfile, long pOffset);
00095
00096 /** Moves the file pointer from the end of the file.\n
00097  * The offset is usually a negative value.
00098  * \ingroup binfile */
00099 void imBinFileSeekFrom(imBinFile* bfile, long pOffset);
00100
00101 /** Returns the current offset position.
00102  * \ingroup binfile */
00103 unsigned long imBinFileTell(imBinFile* bfile);
00104
00105 /** Indicates that the file pointer is at the end of the file.
00106  * \ingroup binfile */
00107 int imBinFileEndOfFile(imBinFile* bfile);
00108
00109 /** Predefined I/O Modules.
00110  * \ingroup binfile */
00111 enum imBinFileModule
00112 {
00113         IM_RAWFILE,   /**< System dependent file I/O Rotines. */
00114         IM_STREAM,    /**< Standard Ansi C Stream I/O Rotines. */
00115         IM_MEMFILE,   /**< Uses a memory buffer (see \ref imBinMemoryFileName). */
00116         IM_SUBFILE,   /**< It is a sub file. FileName is a imBinFile* pointer from any other module. */
00117   IM_FILEHANDLE,/**< System dependent file I/O Rotines, but FileName is a system file handle ("int" in UNIX and "HANDLE" in Windows). */
00118         IM_IOCUSTOM0  /**< Other registered modules starts from here. */
00119 };
00120
00121 /** Sets the current I/O module.
00122  * \returns the previous function set, or -1 if failed.
00123  * See also \ref imBinFileModule.
00124  * \ingroup binfile */
00125 int imBinFileSetCurrentModule(int pModule);
00126
00127 /** \brief Memory File I/O Filename
00128  *
00129  * \par
00130  *  Fake file name for the memory I/O module.
00131  * \ingroup binfile */
00132 typedef struct _imBinMemoryFileName
00133 {
00134   unsigned char *buffer; /**< The memory buffer. If you are reading the buffer must exists.
00135                           *   If you are writing the buffer can be internally allocated to the given size. The buffer is never free.
00136                           *   The buffer is allocated using "malloc", and reallocated using "realloc". Use "free" to release it.
00137                           *   To avoid RTL conflicts use the function imBinMemoryRelease. */
00138   int size;              /**< Size of the buffer. */
00139   float reallocate;      /**< Reallocate factor for the memory buffer when writing (size += reallocate*size).
00140                           *   Set reallocate to 0 to disable reallocation, in this case buffer must not be NULL. */
00141 }imBinMemoryFileName;
00142
00143 /** Release the internal memory allocated when writing a Memory File (see \ref imBinMemoryFileName).
00144  * \ingroup binfile */
00145 void imBinMemoryRelease(unsigned char *buffer);
00146
00147
00148 #if     defined(__cplusplus)
00149 }
00150 #endif
00151
00152
00153 #if     defined(__cplusplus)
00154
00155 /** Base class to help the creation of new modules.\n
00156  * It handles the read/write operations with byte order correction if necessary.
00157  * \ingroup binfile */
00158 class imBinFileBase
00159 {
00160   friend class imBinSubFile;
00161
00162 protected:
00163   int IsNew,
00164       FileByteOrder,
00165       DoByteOrder;   // to speed up byte order checking
00166
00167   // These will actually read/write the data
00168   virtual unsigned long ReadBuf(void* pValues, unsigned long pSize) = 0;
00169   virtual unsigned long WriteBuf(void* pValues, unsigned long pSize) = 0;
00170
00171 public:
00172
00173   int InitByteOrder(int ByteOrder)
00174   {
00175     int old_byte_order = this->FileByteOrder;
00176     this->FileByteOrder = ByteOrder;
00177
00178           if (ByteOrder != imBinCPUByteOrder())
00179             this->DoByteOrder = 1;
00180           else
00181       this->DoByteOrder = 0;
00182     return old_byte_order;
00183   }
00184
00185   // These will take care of byte swap if needed.
00186
00187   unsigned long Read(void* pValues, unsigned long pCount, int pSizeOf)
00188   {
00189     unsigned long rSize = ReadBuf(pValues, pCount * pSizeOf);
00190     if (pSizeOf != 1 && DoByteOrder) imBinSwapBytes(pValues, pCount, pSizeOf);
00191     return rSize/pSizeOf;
00192   }
00193
00194   unsigned long Write(void* pValues, unsigned long pCount, int pSizeOf)
00195   {
00196     if (pSizeOf != 1 && DoByteOrder) imBinSwapBytes(pValues, pCount, pSizeOf);
00197     return WriteBuf(pValues, pCount * pSizeOf)/pSizeOf;
00198   }
00199
00200   virtual void Open(const char* pFileName) = 0;
00201   virtual void New(const char* pFileName) = 0;
00202   virtual void Close() = 0;
00203   virtual unsigned long FileSize() = 0;
00204   virtual int HasError() const = 0;
00205   virtual void SeekTo(unsigned long pOffset) = 0;
00206   virtual void SeekOffset(long pOffset) = 0;
00207   virtual void SeekFrom(long pOffset) = 0;
00208   virtual unsigned long Tell() const = 0;
00209   virtual int EndOfFile() const = 0;
00210 };
00211
00212 /** File I/O module creation callback.
00213  * \ingroup binfile */
00214 typedef imBinFileBase* (*imBinFileNewFunc)();
00215
00216 /** Register a user I/O module.\n
00217  * Returns the new function set id.\n
00218  * Accepts up to 10 modules.
00219  * \ingroup binfile */
00220 extern "C" int imBinFileRegisterModule(imBinFileNewFunc pNewFunc);
00221
00222 #endif
00223
00224 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_capture.h Source File

im_capture.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Video Capture
00003  *
00004  * See Copyright Notice in im.h
00005  */
00006
00007 #ifndef __IM_CAPTURE_H
00008 #define __IM_CAPTURE_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014 /* declarations to create an export library for Watcom. */
00015 #if ! defined (IM_DECL)
00016   #if defined (__WATCOMC__)
00017     #define IM_DECL   __cdecl
00018   #elif defined(__WATCOM_CPLUSPLUS__)
00019     #define IM_DECL   __cdecl
00020   #else
00021     #define IM_DECL
00022   #endif
00023 #endif
00024
00025 /** \defgroup capture Image Capture
00026  * \par
00027  * Functions to capture images from live video devices.
00028  * \par
00029  * See \ref im_capture.h
00030  */
00031
00032 typedef struct _imVideoCapture imVideoCapture;
00033
00034 /** Returns the number of available devices.
00035  *
00036  * \verbatim im.VideoCaptureDeviceCount() -> count: number [in Lua 5] \endverbatim
00037  * \ingroup capture */
00038 int IM_DECL imVideoCaptureDeviceCount(void);
00039
00040 /** Returns the device description. Returns NULL only if it is an invalid device.
00041  *
00042  * \verbatim im.VideoCaptureDeviceDesc(device: number) -> desc: string [in Lua 5] \endverbatim
00043  * \ingroup capture */
00044 const char* IM_DECL imVideoCaptureDeviceDesc(int device);
00045
00046 /** Returns the extendend device description. May return NULL.
00047  *
00048  * \verbatim im.VideoCaptureDeviceExDesc(device: number) -> desc: string [in Lua 5] \endverbatim
00049  * \ingroup capture */
00050 const char* IM_DECL imVideoCaptureDeviceExDesc(int device);
00051
00052 /** Returns the device path configuration. This is a unique string.
00053  *
00054  * \verbatim im.VideoCaptureDevicePath(device: number) -> desc: string [in Lua 5] \endverbatim
00055  * \ingroup capture */
00056 const char* IM_DECL imVideoCaptureDevicePath(int device);
00057
00058 /** Returns the vendor information. May return NULL.
00059  *
00060  * \verbatim im.VideoCaptureDeviceVendorInfo(device: number) -> desc: string [in Lua 5] \endverbatim
00061  * \ingroup capture */
00062 const char* IM_DECL imVideoCaptureDeviceVendorInfo(int device);
00063
00064 /** Reload the device list. The devices can be dynamically removed or added to the system.
00065  * Returns the number of available devices.
00066  *
00067  * \verbatim im.imVideoCaptureReloadDevices() -> count: number [in Lua 5] \endverbatim
00068  * \ingroup capture */
00069 int IM_DECL imVideoCaptureReloadDevices(void);
00070
00071 /** Release the device list. Usefull is you need to track leak erros in your application.
00072  *
00073  * \verbatim im.imVideoCaptureReleaseDevices() [in Lua 5] \endverbatim
00074  * \ingroup capture */
00075 void IM_DECL imVideoCaptureReleaseDevices(void);
00076
00077 /** Creates a new imVideoCapture object. \n
00078  * Returns NULL if there is no capture device available. \n
00079  * In Windows returns NULL if DirectX version is older than 8. \n
00080  * In Lua the IM videocapture metatable name is "imVideoCapture".
00081  * When converted to a string will return "imVideoCapture(%p)" where %p is replaced by the userdata address.
00082  * If the videocapture is already destroyed by im.VideoCaptureDestroy, then it will return also the suffix "-destroyed".
00083  *
00084  * \verbatim im.VideoCaptureCreate() -> vc: imVideoCapture [in Lua 5] \endverbatim
00085  * \ingroup capture */
00086 imVideoCapture* IM_DECL imVideoCaptureCreate(void);
00087
00088 /** Destroys a imVideoCapture object. \n
00089  * In Lua if this function is not called, the videocapture is destroyed by the garbage collector.
00090  *
00091  * \verbatim im.VideoCaptureDestroy(vc: imVideoCapture) [in Lua 5] \endverbatim
00092  * \verbatim vc:Destroy() [in Lua 5] \endverbatim
00093  * \ingroup capture */
00094 void IM_DECL imVideoCaptureDestroy(imVideoCapture* vc);
00095
00096 /** Connects to a capture device.
00097  * More than one imVideoCapture object can be created
00098  * but they must be connected to different devices.  \n
00099  * If the object is conected it will disconnect first. \n
00100  * Use -1 to return the current connected device,
00101  * in this case returns -1 if not connected. \n
00102  * Returns zero if failed.
00103  *
00104  * \verbatim vc:Connect([device: number]) -> ret: number [in Lua 5] \endverbatim
00105  * \ingroup capture */
00106 int IM_DECL imVideoCaptureConnect(imVideoCapture* vc, int device);
00107
00108 /** Disconnect from a capture device.
00109  *
00110  * \verbatim vc:Disconnect() [in Lua 5] \endverbatim
00111  * \ingroup capture */
00112 void IM_DECL imVideoCaptureDisconnect(imVideoCapture* vc);
00113
00114 /** Returns the number of available configuration dialogs.
00115  *
00116  * \verbatim vc:DialogCount() -> count: number [in Lua 5] \endverbatim
00117  * \ingroup capture */
00118 int IM_DECL imVideoCaptureDialogCount(imVideoCapture* vc);
00119
00120 /** Displays a configuration modal dialog of the connected device. \n
00121  * In Windows, the capturing will be stopped in some cases. \n
00122  * In Windows parent is a HWND of a parent window, it can be NULL. \n
00123  * dialog can be from 0 to \ref imVideoCaptureDialogCount. \n
00124  * Returns zero if failed.
00125  *
00126  * \verbatim vc:ShowDialog(dialog: number, parent: userdata) -> error: boolean [in Lua 5] \endverbatim
00127  * \ingroup capture */
00128 int IM_DECL imVideoCaptureShowDialog(imVideoCapture* vc, int dialog, void* parent);
00129
00130 /** Allows to control the input and output of devices that have multiple input and outputs.
00131  * The cross index controls in which stage the input/output will be set. Usually use 1, but some capture boards
00132  * has a second stage. In Direct X it controls the crossbars.
00133  *
00134  * \verbatim vc:SetInOut(input, output, cross: number) -> error: boolean [in Lua 5] \endverbatim
00135  * \ingroup capture */
00136 int IM_DECL imVideoCaptureSetInOut(imVideoCapture* vc, int input, int output, int cross);
00137
00138 /** Returns the description of a configuration dialog.
00139  * dialog can be from 0 to \ref imVideoCaptureDialogCount. \n
00140  *
00141  * \verbatim vc:DialogDesc(dialog: number) -> desc: string [in Lua 5] \endverbatim
00142  * \ingroup capture */
00143 const char* IM_DECL imVideoCaptureDialogDesc(imVideoCapture* vc, int dialog);
00144
00145 /** Returns the number of available video formats. \n
00146  * Returns zero if failed.
00147  *
00148  * \verbatim vc:FormatCount() -> count: number [in Lua 5] \endverbatim
00149  * \ingroup capture */
00150 int IM_DECL imVideoCaptureFormatCount(imVideoCapture* vc);
00151
00152 /** Returns information about the video format. \n
00153  * format can be from 0 to \ref imVideoCaptureFormatCount. \n
00154  * desc should be of size 10. \n
00155  * The image size is usually the maximum size for that format.
00156  * Other sizes can be available using \ref imVideoCaptureSetImageSize. \n
00157  * Returns zero if failed.
00158  *
00159  * \verbatim vc:GetFormat(format: number) -> error: boolean, width: number, height: number, desc: string [in Lua 5] \endverbatim
00160  * \ingroup capture */
00161 int IM_DECL imVideoCaptureGetFormat(imVideoCapture* vc, int format, int *width, int *height, char* desc);
00162
00163 /** Changes the video format of the connected device. \n
00164  * Should NOT work for DV devices. Use \ref imVideoCaptureSetImageSize only. \n
00165  * Use -1 to return the current format, in this case returns -1 if failed. \n
00166  * When the format is changed in the dialog, for some formats
00167  * the returned format is the preferred format, not the current format. \n
00168  * This will not affect color_mode of the capture image. \n
00169  * Returns zero if failed.
00170  *
00171  * \verbatim vc:SetFormat([format: number]) -> error: boolean | format: number [in Lua 5] \endverbatim
00172  * \ingroup capture */
00173 int IM_DECL imVideoCaptureSetFormat(imVideoCapture* vc, int format);
00174
00175 /** Returns the current image size of the connected device. \n
00176  *  width and height returns 0 if not connected.
00177  *
00178  * \verbatim vc:GetImageSize() -> width: number, height: number [in Lua 5] \endverbatim
00179  * \ingroup capture */
00180 void IM_DECL imVideoCaptureGetImageSize(imVideoCapture* vc, int *width, int *height);
00181
00182 /** Changes the image size of the connected device. \n
00183  * Similar to \ref imVideoCaptureSetFormat, but changes only the size. \n
00184  * Valid sizes can be obtained with  \ref imVideoCaptureGetFormat. \n
00185  * Returns zero if failed.
00186  *
00187  * \verbatim vc:SetImageSize(width: number, height: number) -> error: boolean [in Lua 5] \endverbatim
00188  * \ingroup capture */
00189 int IM_DECL imVideoCaptureSetImageSize(imVideoCapture* vc, int width, int height);
00190
00191 /** Returns a new captured frame. Use -1 for infinite timeout. \n
00192  * Color space can be IM_RGB or IM_GRAY, and mode can be packed (IM_PACKED) or not. \n
00193  * Data type is always IM_BYTE. \n
00194  * It can not have an alpha channel and orientation is always bottom up. \n
00195  * Returns zero if failed or timeout expired, the buffer is not changed.
00196  *
00197  * \verbatim vc:Frame(image: imImage, timeout: number) -> error: boolean [in Lua 5] \endverbatim
00198  * \ingroup capture */
00199 int IM_DECL imVideoCaptureFrame(imVideoCapture* vc, unsigned char* data, int color_mode, int timeout);
00200
00201 /** Start capturing, returns the new captured frame and stop capturing.  \n
00202  * This is more usefull if you are switching between devices. \n
00203  * Data format is the same as imVideoCaptureFrame. \n
00204  * Returns zero if failed.
00205  *
00206  * \verbatim vc:OneFrame(image: imImage) -> error: boolean [in Lua 5] \endverbatim
00207  * \ingroup capture */
00208 int IM_DECL imVideoCaptureOneFrame(imVideoCapture* vc, unsigned char* data, int color_mode);
00209
00210 /** Start capturing. \n
00211  * Use -1 to return the current state. \n
00212  * Returns zero if failed.
00213  *
00214  * \verbatim vc:Live([live: number]) -> error: boolean | live: number [in Lua 5] \endverbatim
00215  * \ingroup capture */
00216 int IM_DECL imVideoCaptureLive(imVideoCapture* vc, int live);
00217
00218 /** Resets a camera or video attribute to the default value or
00219  * to the automatic setting. \n
00220  * Not all attributes support automatic modes. \n
00221  * Returns zero if failed.
00222  *
00223  * \verbatim vc:ResetAttribute(attrib: string, fauto: boolean) -> error: boolean [in Lua 5] \endverbatim
00224  * \ingroup capture */
00225 int IM_DECL imVideoCaptureResetAttribute(imVideoCapture* vc, const char* attrib, int fauto);
00226
00227 /** Returns a camera or video attribute in percentage of the valid range value. \n
00228  * Returns zero if failed or attribute not supported.
00229  *
00230  * \verbatim vc:GetAttribute(attrib: string) -> error: boolean, percent: number [in Lua 5] \endverbatim
00231  * \ingroup capture */
00232 int IM_DECL imVideoCaptureGetAttribute(imVideoCapture* vc, const char* attrib, float *percent);
00233
00234 /** Changes a camera or video attribute in percentage of the valid range value. \n
00235  * Returns zero if failed or attribute not supported.
00236  *
00237  * \verbatim vc:SetAttribute(attrib: string, percent: number) -> error: boolean [in Lua 5] \endverbatim
00238  * \ingroup capture */
00239 int IM_DECL imVideoCaptureSetAttribute(imVideoCapture* vc, const char* attrib, float percent);
00240
00241 /** Returns a list of the description of the valid attributes for the device class. \n
00242  * But each device may still not support some of the returned attributes. \n
00243  * Use the return value of \ref imVideoCaptureGetAttribute to check if the attribute is supported.
00244  *
00245  * \verbatim vc:GetAttributeList() -> attrib_list: table of strings [in Lua 5] \endverbatim
00246  * \ingroup capture */
00247 const char** IM_DECL imVideoCaptureGetAttributeList(imVideoCapture* vc, int *num_attrib);
00248
00249
00250 /** \defgroup winattrib Windows Attributes Names
00251  * Not all attributes are supported by each device.
00252  * Use the return value of \ref imVideoCaptureGetAttribute to check if the attribute is supported.
00253 \verbatim
00254   VideoBrightness - Specifies the brightness, also called the black level.
00255   VideoContrast - Specifies the contrast, expressed as gain factor.
00256   VideoHue - Specifies the hue angle.
00257   VideoSaturation - Specifies the saturation.
00258   VideoSharpness - Specifies the sharpness.
00259   VideoGamma - Specifies the gamma.
00260   VideoColorEnable - Specifies the color enable setting. (0/100)
00261   VideoWhiteBalance - Specifies the white balance, as a color temperature in degrees Kelvin.
00262   VideoBacklightCompensation - Specifies the backlight compensation setting. (0/100)
00263   VideoGain - Specifies the gain adjustment.
00264   CameraPanAngle - Specifies the camera's pan angle. To 100 rotate right, To 0 rotate left (view from above).
00265   CameraTiltAngle - Specifies the camera's tilt angle.  To 100 rotate up, To 0 rotate down.
00266   CameraRollAngle - Specifies the camera's roll angle. To 100 rotate right, To 0 rotate left.
00267   CameraLensZoom - Specifies the camera's zoom setting.
00268   CameraExposure - Specifies the exposure setting.
00269   CameraIris - Specifies the camera's iris setting.
00270   CameraFocus - Specifies the camera's focus setting, as the distance to the optimally focused target.
00271   FlipHorizontal - Specifies the video will be flipped in the horizontal direction.
00272   FlipVertical - Specifies the video will be flipped in the vertical direction.
00273   AnalogFormat - Specifies the video format standard NTSC, PAL, etc. Valid values:
00274       NTSC_M     = 0
00275       NTSC_M_J   = 1
00276       NTSC_433   = 2
00277       PAL_B      = 3
00278       PAL_D      = 4
00279       PAL_H      = 5
00280       PAL_I      = 6
00281       PAL_M      = 7
00282       PAL_N      = 8
00283       PAL_60     = 9
00284       SECAM_B    = 10
00285       SECAM_D    = 11
00286       SECAM_G    = 12
00287       SECAM_H    = 13
00288       SECAM_K    = 14
00289       SECAM_K1   = 15
00290       SECAM_L    = 16
00291       SECAM_L1   = 17
00292       PAL_N_COMBO = 18
00293 \endverbatim
00294  * \ingroup capture */
00295
00296
00297 #if defined(__cplusplus)
00298 }
00299
00300 /** A C++ Wrapper for the imVideoCapture structure functions.
00301  * \ingroup capture */
00302 class imCapture
00303 {
00304 public:
00305   imCapture()
00306     { vc = imVideoCaptureCreate(); }
00307
00308   ~imCapture()
00309     { if (vc) imVideoCaptureDestroy(vc); }
00310
00311   int Failed()
00312     { if (!vc) return 0; else return 1; }
00313
00314   int Connect(int device)
00315     { return imVideoCaptureConnect(vc, device); }
00316
00317   void Disconnect()
00318     { imVideoCaptureDisconnect(vc); }
00319
00320   int DialogCount()
00321     { return imVideoCaptureDialogCount(vc); }
00322
00323   int ShowDialog(int dialog, void* parent)
00324     { return imVideoCaptureShowDialog(vc, dialog, parent); }
00325
00326   const char* DialogDescription(int dialog)
00327     { return imVideoCaptureDialogDesc(vc, dialog); }
00328
00329   int FormatCount()
00330     { return imVideoCaptureFormatCount(vc); }
00331
00332   int GetFormat(int format, int *width, int *height, char* desc)
00333     { return imVideoCaptureGetFormat(vc, format, width, height, desc); }
00334
00335   int SetFormat(int format)
00336     { return imVideoCaptureSetFormat(vc, format); }
00337
00338   void GetImageSize(int *width, int *height)
00339     { imVideoCaptureGetImageSize(vc, width, height); }
00340
00341   int SetImageSize(int width, int height)
00342     { return imVideoCaptureSetImageSize(vc, width, height); }
00343
00344   int GetFrame(unsigned char* data, int color_mode, int timeout)
00345     { return imVideoCaptureFrame(vc, data, color_mode, timeout); }
00346
00347   int GetOneFrame(unsigned char* data, int color_mode)
00348     { return imVideoCaptureOneFrame(vc, data, color_mode); }
00349
00350   int Live(int live)
00351     { return imVideoCaptureLive(vc, live); }
00352
00353   int ResetAttribute(const char* attrib, int fauto)
00354     { return imVideoCaptureResetAttribute(vc, attrib, fauto); }
00355
00356   int GetAttribute(const char* attrib, float *percent)
00357     { return imVideoCaptureGetAttribute(vc, attrib, percent); }
00358
00359   int SetAttribute(const char* attrib, float percent)
00360     { return imVideoCaptureSetAttribute(vc, attrib, percent); }
00361
00362   const char** GetAttributeList(int *num_attrib)
00363     { return imVideoCaptureGetAttributeList(vc, num_attrib); }
00364
00365 protected:
00366   imVideoCapture* vc;
00367 };
00368
00369 #endif
00370
00371 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_color.h Source File

im_color.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Color Manipulation
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_COLOR_H
00008 #define __IM_COLOR_H
00009
00010 #include "im_math.h"
00011
00012 /** \defgroup color Color Manipulation
00013  *
00014  * \par
00015  * Functions to convert from one color space to another,
00016  * and color gammut utilities.
00017  * \par
00018  * See \ref im_color.h
00019  *
00020  * \section s1 Some Color Science
00021  * \par
00022  * Y is luminance, a linear-light quantity.
00023  * It is directly proportional to physical intensity
00024  * weighted by the spectral sensitivity of human vision.
00025  * \par
00026  * L* is lightness, a nonlinear luminance
00027  * that aproximates the perception of brightness.
00028  * It is nearly perceptual uniform.
00029  * It has a range of 0 to 100.
00030  * \par
00031  * Y' is luma, a nonlinear luminance that aproximates lightness.
00032  * \par
00033  * Brightness is a visual sensation according to which an area
00034  * apears to exhibit more or less light.
00035  * It is a subjective quantity and can not be measured.
00036  * \par
00037  * One unit of euclidian distante in CIE L*u*v* or CIE L*a*b* corresponds
00038  * roughly to a just-noticeable difference (JND) of color.
00039  * \par
00040 \verbatim
00041  ChromaUV = sqrt(u*u + v*v)
00042  HueUV = atan2(v, u)
00043  SaturationUV = ChromaUV / L      (called psychometric saturation)
00044  (the same can be calculated for Lab)
00045 \endverbatim
00046  * \par
00047  * IEC 61966-2.1 Default RGB colour space - sRGB
00048  * \li ITU-R Recommendation BT.709 (D65 white point).
00049  * \li D65 White Point (X,Y,Z) = (0.9505 1.0000 1.0890)
00050  * \par
00051  * Documentation extracted from  Charles Poynton - Digital Video and HDTV - Morgan Kaufmann - 2003.
00052  *
00053  * \section Links
00054  * \li www.color.org - ICC
00055  * \li www.srgb.com - sRGB
00056  * \li www.poynton.com - Charles Poynton
00057  * \li www.littlecms.com - A free Color Management System (use this if you need precise color conversions)
00058  *
00059  * \section cci Color Component Intervals
00060  * \par
00061  * All the color components are stored in the 0-max interval, even the signed ones. \n
00062  * Here are the pre-defined intervals for each data type. These values are used for standard color conversion.
00063  * You should normalize data before converting betwwen color spaces.
00064  * \par
00065 \verbatim
00066  byte   [0,255]      or [-128,+127]          (1 byte)
00067  ushort [0,65535]    or [-32768,+32767]      (2 bytes)
00068  int    [0,16777215] or [-8388608,+8388607]  (3 bytes)
00069  float  [0,1]        or [-0.5,+0.5]          (4 bytes)
00070 \endverbatim
00071  * \ingroup util */
00072
00073 /** Returns the zero value for color conversion porpouses. \n
00074  * This is a value to be compensated when the data_type is unsigned and component is signed. \n
00075  * \ingroup color */
00076 inline float imColorZero(int data_type)
00077 {
00078   float zero[] = {128.0f, 32768.0f, 8388608.0f, 0.5f};
00079   return zero[data_type];
00080 }
00081
00082 /** Returns the maximum value for color conversion porpouses. \n
00083  * \ingroup color */
00084 inline int imColorMax(int data_type)
00085 {
00086   int max[] = {255, 65535, 16777215, 1};
00087   return max[data_type];
00088 }
00089
00090 /** Quantize r=0-1 values into q=0-max.
00091  * max is the maximum value.
00092  * max and the returned value are usually integers,
00093  * but the dummy quantizer uses real values.
00094  * See also \ref math.
00095  * \ingroup color */
00096 template <class T>
00097 inline T imColorQuantize(const float& value, const T& max)
00098 {
00099   if (max == 1) return (T)value; // to allow a dummy quantizer
00100   if (value >= 1) return max;
00101   if (value <= 0) return 0;
00102   /* return (T)imRound(value*(max + 1) - 0.5f);  not necessary since all values are positive */
00103   return (T)(value*(max + 1));
00104 }
00105
00106 /** Reconstruct 0-max values into 0-1. \n
00107  * max is the maximum value.
00108  * max and the given value are usually integers,
00109  * but the dummy reconstructor uses real values.
00110  * See also \ref math.
00111  * \ingroup color */
00112 template <class T>
00113 inline float imColorReconstruct(const T& value, const T& max)
00114 {
00115   if (max == 1) return (float)value;  // to allow a dummy reconstructor
00116   if (value <= 0) return 0;
00117   if (value >= max) return 1;
00118   return (((float)value + 0.5f)/((float)max + 1.0f));
00119 }
00120
00121 /** Converts Y'CbCr to R'G'B' (all nonlinear). \n
00122  * ITU-R Recommendation 601-1 with no headroom/footroom.
00123 \verbatim
00124  0 <= Y <= 1 ; -0.5 <= CbCr <= 0.5 ; 0 <= RGB <= 1
00125
00126  R'= Y' + 0.000 *Cb + 1.402 *Cr
00127  G'= Y' - 0.344 *Cb - 0.714 *Cr
00128  B'= Y' + 1.772 *Cb + 0.000 *Cr
00129 \endverbatim
00130  * \ingroup color */
00131 template <class T>
00132 inline void imColorYCbCr2RGB(const T Y, const T Cb, const T Cr,
00133                              T& R, T& G, T& B,
00134                              const T& zero, const T& max)
00135 {
00136   float r = float(Y                        + 1.402f * (Cr - zero));
00137   float g = float(Y - 0.344f * (Cb - zero) - 0.714f * (Cr - zero));
00138   float b = float(Y + 1.772f * (Cb - zero));
00139
00140   // now we should enforce 0<= rgb <= max
00141
00142   R = (T)IM_CROPMAX(r, max);
00143   G = (T)IM_CROPMAX(g, max);
00144   B = (T)IM_CROPMAX(b, max);
00145 }
00146
00147 /** Converts R'G'B' to Y'CbCr (all nonlinear). \n
00148  * ITU-R Recommendation 601-1 with no headroom/footroom.
00149 \verbatim
00150  0 <= Y <= 1 ; -0.5 <= CbCr <= 0.5 ; 0 <= RGB <= 1
00151
00152  Y' =  0.299 *R' + 0.587 *G' + 0.114 *B'
00153  Cb = -0.169 *R' - 0.331 *G' + 0.500 *B'
00154  Cr =  0.500 *R' - 0.419 *G' - 0.081 *B'
00155 \endverbatim
00156  * \ingroup color */
00157 template <class T>
00158 inline void imColorRGB2YCbCr(const T R, const T G, const T B,
00159                              T& Y, T& Cb, T& Cr,
00160                              const T& zero)
00161 {
00162   Y  = (T)( 0.299f *R + 0.587f *G + 0.114f *B);
00163   Cb = (T)(-0.169f *R - 0.331f *G + 0.500f *B + (float)zero);
00164   Cr = (T)( 0.500f *R - 0.419f *G - 0.081f *B + (float)zero);
00165
00166   // there is no need for cropping here, YCrCr is already at the limits
00167 }
00168
00169 /** Converts C'M'Y'K' to R'G'B' (all nonlinear). \n
00170  * This is a poor conversion that works for a simple visualization.
00171 \verbatim
00172   0 <= CMYK <= 1 ; 0 <= RGB <= 1
00173
00174   R = (1 - K) * (1 - C)
00175   G = (1 - K) * (1 - M)
00176   B = (1 - K) * (1 - Y)
00177 \endverbatim
00178  * \ingroup color */
00179 template <class T>
00180 inline void imColorCMYK2RGB(const T C, const T M, const T Y, const T K,
00181                             T& R, T& G, T& B, const T& max)
00182 {
00183   T W = max - K;
00184   R = (T)((W * (max - C)) / max);
00185   G = (T)((W * (max - M)) / max);
00186   B = (T)((W * (max - Y)) / max);
00187
00188   // there is no need for cropping here, RGB is already at the limits
00189 }
00190
00191 /** Converts CIE XYZ to Rec 709 RGB (all linear). \n
00192  * ITU-R Recommendation BT.709 (D65 white point). \n
00193 \verbatim
00194   0 <= XYZ <= 1 ; 0 <= RGB <= 1
00195
00196   R =  3.2406 *X - 1.5372 *Y - 0.4986 *Z
00197   G = -0.9689 *X + 1.8758 *Y + 0.0415 *Z
00198   B =  0.0557 *X - 0.2040 *Y + 1.0570 *Z
00199 \endverbatim
00200  * \ingroup color */
00201 template <class T>
00202 inline void imColorXYZ2RGB(const T X, const T Y, const T Z,
00203                            T& R, T& G, T& B, const T& max)
00204 {
00205   float r =  3.2406f *X - 1.5372f *Y - 0.4986f *Z;
00206   float g = -0.9689f *X + 1.8758f *Y + 0.0415f *Z;
00207   float b =  0.0557f *X - 0.2040f *Y + 1.0570f *Z;
00208
00209   // we need to crop because not all XYZ colors are visible
00210
00211   R = (T)IM_CROPMAX(r, max);
00212   G = (T)IM_CROPMAX(g, max);
00213   B = (T)IM_CROPMAX(b, max);
00214 }
00215
00216 /** Converts Rec 709 RGB to CIE XYZ (all linear). \n
00217  * ITU-R Recommendation BT.709 (D65 white point). \n
00218 \verbatim
00219   0 <= XYZ <= 1 ; 0 <= RGB <= 1
00220
00221   X = 0.4124 *R + 0.3576 *G + 0.1805 *B
00222   Y = 0.2126 *R + 0.7152 *G + 0.0722 *B
00223   Z = 0.0193 *R + 0.1192 *G + 0.9505 *B
00224 \endverbatim
00225  * \ingroup color */
00226 template <class T>
00227 inline void imColorRGB2XYZ(const T R, const T G, const T B,
00228                            T& X, T& Y, T& Z)
00229 {
00230   X = (T)(0.4124f *R + 0.3576f *G + 0.1805f *B);
00231   Y = (T)(0.2126f *R + 0.7152f *G + 0.0722f *B);
00232   Z = (T)(0.0193f *R + 0.1192f *G + 0.9505f *B);
00233
00234   // there is no need for cropping here, XYZ is already at the limits
00235 }
00236
00237 #define IM_FWLAB(_w) (_w > 0.008856f?               \
00238                         powf(_w, 1.0f/3.0f):        \
00239                         7.787f * _w + 0.16f/1.16f)
00240
00241 /** Converts CIE XYZ (linear) to CIE L*a*b* (nonlinear). \n
00242  * The white point is D65. \n
00243 \verbatim
00244   0 <= L <= 1 ; -0.5 <= ab <= +0.5 ; 0 <= XYZ <= 1
00245
00246   if (t > 0.008856)
00247     f(t) = pow(t, 1/3)
00248   else
00249     f(t) = 7.787*t + 16/116
00250
00251   fX = f(X / Xn)      fY = f(Y / Yn)      fZ = f(Z / Zn)
00252
00253   L = 1.16 * fY - 0.16
00254   a = 2.5 * (fX - fY)
00255   b = (fY - fZ)
00256
00257 \endverbatim
00258  * \ingroup color */
00259 inline void imColorXYZ2Lab(const float X, const float Y, const float Z,
00260                            float& L, float& a, float& b)
00261 {
00262   float fX = X / 0.9505f;  // white point D65
00263   float fY = Y / 1.0f;
00264   float fZ = Z / 1.0890f;
00265
00266   fX = IM_FWLAB(fX);
00267   fY = IM_FWLAB(fY);
00268   fZ = IM_FWLAB(fZ);
00269
00270   L = 1.16f * fY - 0.16f;
00271   a = 2.5f * (fX - fY);
00272   b = (fY - fZ);
00273 }
00274
00275 #define IM_GWLAB(_w)  (_w > 0.20689f?                     \
00276                          powf(_w, 3.0f):                  \
00277                          0.1284f * (_w - 0.16f/1.16f))
00278
00279 /** Converts CIE L*a*b* (nonlinear) to CIE XYZ (linear). \n
00280  * The white point is D65. \n
00281  * 0 <= L <= 1 ; -0.5 <= ab <= +0.5 ; 0 <= XYZ <= 1
00282  * \ingroup color */
00283 inline void imColorLab2XYZ(const float L, const float a, const float b,
00284                            float& X, float& Y, float& Z)
00285
00286 {
00287   float fY = (L + 0.16f) / 1.16f;
00288   float gY = IM_GWLAB(fY);
00289
00290   float fgY = IM_FWLAB(gY);
00291   float gX = fgY + a / 2.5f;
00292   float gZ = fgY - b;
00293   gX = IM_GWLAB(gX);
00294   gZ = IM_GWLAB(gZ);
00295
00296   X = gX * 0.9505f;     // white point D65
00297   Y = gY * 1.0f;
00298   Z = gZ * 1.0890f;
00299 }
00300
00301 /** Converts CIE XYZ (linear) to CIE L*u*v* (nonlinear). \n
00302  * The white point is D65. \n
00303 \verbatim
00304   0 <= L <= 1 ; -1 <= uv <= +1 ; 0 <= XYZ <= 1
00305
00306   Y = Y / 1.0      (for D65)
00307   if (Y > 0.008856)
00308     fY = pow(Y, 1/3)
00309   else
00310     fY = 7.787 * Y + 0.16/1.16
00311   L = 1.16 * fY - 0.16
00312
00313   U(x, y, z) = (4 * x)/(x + 15 * y + 3 * z)
00314   V(x, y, z) = (9 * x)/(x + 15 * y + 3 * z)
00315   un = U(Xn, Yn, Zn) = 0.1978      (for D65)
00316   vn = V(Xn, Yn, Zn) = 0.4683      (for D65)
00317   fu = U(X, Y, Z)
00318   fv = V(X, Y, Z)
00319
00320   u = 13 * L * (fu - un)
00321   v = 13 * L * (fv - vn)
00322 \endverbatim
00323  * \ingroup color */
00324 inline void imColorXYZ2Luv(const float X, const float Y, const float Z,
00325                            float& L, float& u, float& v)
00326 {
00327   float XYZ = (float)(X + 15 * Y + 3 * Z);
00328   float fY = Y / 1.0f;
00329
00330   if (XYZ != 0)
00331   {
00332     L = 1.16f * IM_FWLAB(fY) - 0.16f;
00333     u = 6.5f * L * ((4 * X)/XYZ - 0.1978f);
00334     v = 6.5f * L * ((9 * Y)/XYZ - 0.4683f);
00335   }
00336   else
00337   {
00338     L = u = v = 0;
00339   }
00340 }
00341
00342 /** Converts CIE L*u*v* (nonlinear) to CIE XYZ (linear). \n
00343  * The white point is D65.
00344  * 0 <= L <= 1 ; -0.5 <= uv <= +0.5 ; 0 <= XYZ <= 1 \n
00345  * \ingroup color */
00346 inline void imColorLuv2XYZ(const float L, const float u, const float v,
00347                            float& X, float& Y, float& Z)
00348
00349 {
00350   float fY = (L + 0.16f) / 1.16f;
00351   Y = IM_GWLAB(fY) * 1.0f;
00352
00353   float ul = 0.1978f, vl = 0.4683f;
00354   if (L != 0)
00355   {
00356     ul = u / (6.5f * L) + 0.1978f;
00357     vl = v / (6.5f * L) + 0.4683f;
00358   }
00359
00360   X = ((9 * ul) / (4 * vl)) * Y;
00361   Z = ((12 - 3 * ul - 20 * vl) / (4 * vl)) * Y;
00362 }
00363
00364 /** Converts nonlinear values to linear values. \n
00365  * We use the sRGB transfer function. sRGB uses ITU-R 709 primaries and D65 white point. \n
00366 \verbatim
00367   0 <= l <= 1 ; 0 <= v <= 1
00368
00369   if (v < 0.03928)
00370     l = v / 12.92
00371   else
00372     l = pow((v + 0.055) / 1.055, 2.4)
00373 \endverbatim
00374  * \ingroup color */
00375 inline float imColorTransfer2Linear(const float& nonlinear_value)
00376 {
00377   if (nonlinear_value < 0.03928f)
00378     return nonlinear_value / 12.92f;
00379   else
00380     return powf((nonlinear_value + 0.055f) / 1.055f, 2.4f);
00381 }
00382
00383 /** Converts linear values to nonlinear values. \n
00384  * We use the sRGB transfer function. sRGB uses ITU-R 709 primaries and D65 white point. \n
00385 \verbatim
00386   0 <= l <= 1 ; 0 <= v <= 1
00387
00388   if (l < 0.0031308)
00389     v = 12.92 * l
00390   else
00391     v = 1.055 * pow(l, 1/2.4) - 0.055
00392 \endverbatim
00393  * \ingroup color */
00394 inline float imColorTransfer2Nonlinear(const float& value)
00395 {
00396   if (value < 0.0031308f)
00397     return 12.92f * value;
00398   else
00399     return 1.055f * powf(value, 1.0f/2.4f) - 0.055f;
00400 }
00401
00402 /** Converts RGB (linear) to R'G'B' (nonlinear).
00403  * \ingroup color */
00404 inline void imColorRGB2RGBNonlinear(const float RL, const float GL, const float BL,
00405                                     float& R, float& G, float& B)
00406 {
00407   R = imColorTransfer2Nonlinear(RL);
00408   G = imColorTransfer2Nonlinear(GL);
00409   B = imColorTransfer2Nonlinear(BL);
00410 }
00411
00412 /** Converts R'G'B' to Y' (all nonlinear). \n
00413 \verbatim
00414  Y'  =  0.299 *R' + 0.587 *G' + 0.114 *B'
00415 \endverbatim
00416  * \ingroup color */
00417 template <class T>
00418 inline T imColorRGB2Luma(const T R, const T G, const T B)
00419 {
00420   return (T)((299 * R + 587 * G + 114 * B) / 1000);
00421 }
00422
00423 /** Converts Luminance (CIE Y) to Lightness (CIE L*) (all linear). \n
00424  * The white point is D65.
00425 \verbatim
00426   0 <= Y <= 1 ; 0 <= L* <= 1
00427
00428   Y = Y / 1.0      (for D65)
00429   if (Y > 0.008856)
00430     fY = pow(Y, 1/3)
00431   else
00432     fY = 7.787 * Y + 0.16/1.16
00433   L = 1.16 * fY - 0.16
00434 \endverbatim
00435  * \ingroup color */
00436 inline float imColorLuminance2Lightness(const float& Y)
00437 {
00438   return 1.16f * IM_FWLAB(Y) - 0.16f;
00439 }
00440
00441 /** Converts Lightness (CIE L*) to Luminance (CIE Y) (all linear). \n
00442  * The white point is D65.
00443 \verbatim
00444   0 <= Y <= 1 ; 0 <= L* <= 1
00445
00446   fY = (L + 0.16)/1.16
00447   if (fY > 0.20689)
00448     Y = pow(fY, 3)
00449   else
00450     Y = 0.1284 * (fY - 0.16/1.16)
00451   Y = Y * 1.0      (for D65)
00452 \endverbatim
00453  * \ingroup color */
00454 inline float imColorLightness2Luminance(const float& L)
00455 {
00456   float fY = (L + 0.16f) / 1.16f;
00457   return IM_GWLAB(fY);
00458 }
00459
00460 #undef IM_FWLAB
00461 #undef IM_GWLAB
00462 #undef IM_CROPL
00463 #undef IM_CROPC
00464
00465 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_colorhsi.h Source File

im_colorhsi.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief HSI Color Manipulation
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_COLORHSI_H
00008 #define __IM_COLORHSI_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014
00015 /** \defgroup hsi HSI Color Coordinate System Conversions
00016  *
00017  * \par
00018  * HSI is just the RGB color space written in a different coordinate system.
00019  * \par
00020  * "I" is defined along the cube diagonal. It ranges from 0 (black) to 1 (white). \n
00021  * HS are the polar coordinates of a plane normal to "I". \n
00022  * "S" is the normal distance from the diagonal of the RGB cube. It ranges from 0 to 1. \n
00023  * "H" is the angle starting from the red vector, given in degrees.
00024  * \par
00025  * This is not a new color space, this is exactly the same gammut as RGB. \n
00026  * \par
00027  * See \ref im_colorhsi.h
00028  * \ingroup color */
00029
00030
00031 /** Returns I where S is maximum given H (here in radians).
00032  * \ingroup hsi */
00033 float imColorHSI_ImaxS(float h, double cosh, double sinh);
00034
00035 /** Converts from RGB to HSI.
00036  * \ingroup hsi */
00037 void imColorRGB2HSI(float r, float g, float b, float *h, float *s, float *i);
00038
00039 /** Converts from RGB (byte) to HSI.
00040  * \ingroup hsi */
00041 void imColorRGB2HSIbyte(unsigned char r, unsigned char g, unsigned char b, float *h, float *s, float *i);
00042
00043 /** Converts from HSI to RGB.
00044  * \ingroup hsi */
00045 void imColorHSI2RGB(float h, float s, float i, float *r, float *g, float *b);
00046
00047 /** Converts from HSI to RGB (byte).
00048  * \ingroup hsi */
00049 void imColorHSI2RGBbyte(float h, float s, float i, unsigned char *r, unsigned char *g, unsigned char *b);
00050
00051
00052 #if defined(__cplusplus)
00053 }
00054 #endif
00055
00056 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_complex.h Source File

im_complex.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Complex Data Type.
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_COMPLEX_H
00008 #define __IM_COMPLEX_H
00009
00010 #include "im_math.h"
00011
00012 /** \defgroup cpx Complex Numbers
00013  * \par
00014  * See \ref im_complex.h
00015  * \ingroup util
00016  */
00017
00018 /** \brief Complex Float Data Type
00019  *
00020  * \par
00021  * Complex class using two floats, one for real part, one for the imaginary part.
00022  * \par
00023  * It is not a complete complex class, we just implement constructors inside the class.
00024  * All the other operators and functions are external to the class.
00025  * \ingroup cpx */
00026 class imcfloat
00027 {
00028 public:
00029         float real;  ///< Real part.
00030         float imag;  ///< Imaginary part.
00031
00032   ///   Default Constructor (0,0).
00033         imcfloat():real(0), imag(0) {}
00034
00035   ///   Constructor from (real, imag)
00036         imcfloat(const float& r, const float& i):real(r),imag(i) {}
00037
00038   ///   Constructor from (real)
00039         imcfloat(const float& r):real(r),imag(0) {}
00040 };
00041
00042 /** \addtogroup cpx
00043  * Complex numbers operators.
00044  * @{
00045  */
00046
00047 inline int operator <= (const imcfloat& C1, const imcfloat& C2)
00048 {
00049   return ((C1.real <= C2.real) && (C1.imag <= C2.imag));
00050 }
00051
00052 inline int operator <= (const imcfloat& C, const float& F)
00053 {
00054   return ((F <= C.real) && (0 <= C.imag));
00055 }
00056
00057 inline int operator < (const imcfloat& C1, const imcfloat& C2)
00058 {
00059   return ((C1.real < C2.real) && (C1.imag < C2.imag));
00060 }
00061
00062 inline int operator < (const imcfloat& C, const float& F)
00063 {
00064   return ((F < C.real) && (0 < C.imag));
00065 }
00066
00067 inline int operator > (const imcfloat& C1, const imcfloat& C2)
00068 {
00069   return ((C1.real > C2.real) && (C1.imag > C2.imag));
00070 }
00071
00072 inline int operator > (const imcfloat& C, const float& F)
00073 {
00074   return ((F > C.real) && (0 > C.imag));
00075 }
00076
00077 inline imcfloat operator + (const imcfloat& C1, const imcfloat& C2)
00078 {
00079   return imcfloat(C1.real + C2.real, C1.imag + C2.imag);
00080 }
00081
00082 inline imcfloat operator += (const imcfloat& C1, const imcfloat& C2)
00083 {
00084   return imcfloat(C1.real + C2.real, C1.imag + C2.imag);
00085 }
00086
00087 inline imcfloat operator - (const imcfloat& C1, const imcfloat& C2)
00088 {
00089   return imcfloat(C1.real - C2.real, C1.imag - C2.imag);
00090 }
00091
00092 inline imcfloat operator * (const imcfloat& C1, const imcfloat& C2)
00093 {
00094   return imcfloat(C1.real * C2.real - C1.imag * C2.imag,
00095                         C1.imag * C2.real + C1.real * C2.imag);
00096 }
00097
00098 inline imcfloat operator / (const imcfloat& C1, const imcfloat& C2)
00099 {
00100   float den = C2.real * C2.real - C2.imag * C2.imag;
00101   return imcfloat((C1.real * C2.real + C1.imag * C2.imag) / den,
00102                         (C1.imag * C2.real - C1.real * C2.imag) / den);
00103 }
00104
00105 inline imcfloat operator / (const imcfloat& C, const float& R)
00106 {
00107   return imcfloat(C.real / R, C.imag / R);
00108 }
00109
00110 inline imcfloat operator /= (const imcfloat& C, const float& R)
00111 {
00112   return imcfloat(C.real / R, C.imag / R);
00113 }
00114
00115 inline imcfloat operator * (const imcfloat& C, const float& R)
00116 {
00117   return imcfloat(C.real * R, C.imag * R);
00118 }
00119
00120 inline int operator == (const imcfloat& C1, const imcfloat& C2)
00121 {
00122   return ((C1.real == C2.real) && (C1.imag == C2.imag));
00123 }
00124
00125 inline float cpxreal(const imcfloat& C)
00126 {
00127   return C.real;
00128 }
00129
00130 inline float cpximag(const imcfloat& C)
00131 {
00132   return C.imag;
00133 }
00134
00135 inline float cpxmag(const imcfloat& C)
00136 {
00137   return sqrtf(C.real*C.real + C.imag*C.imag);
00138 }
00139
00140 inline float cpxphase(const imcfloat& C)
00141 {
00142   return atan2f(C.real, C.imag);
00143 }
00144
00145 inline imcfloat cpxconj(const imcfloat& C)
00146 {
00147   return imcfloat(C.real, -C.imag);
00148 }
00149
00150 inline imcfloat log(const imcfloat& C)
00151 {
00152   return imcfloat(logf(cpxmag(C)), atan2f(C.real, C.imag));
00153 }
00154
00155 inline imcfloat exp(const imcfloat& C)
00156 {
00157   float mag = expf(C.real);
00158   return imcfloat(mag * cosf(C.imag), mag * sinf(C.imag));
00159 }
00160
00161 inline imcfloat pow(const imcfloat& C1, const imcfloat& C2)
00162 {
00163   return exp(C1 * log(C2));
00164 }
00165
00166 inline imcfloat sqrt(const imcfloat& C)
00167 {
00168   float mag = sqrtf(sqrtf(C.real*C.real + C.imag*C.imag));
00169   float phase = atan2f(C.real, C.imag) / 2;
00170   return imcfloat(mag * cosf(phase), mag * sinf(phase));
00171 }
00172
00173 inline imcfloat cpxpolar(const float& mag, const float& phase)
00174 {
00175   return imcfloat(mag * cosf(phase), mag * sinf(phase));
00176 }
00177
00178 /** @} */
00179
00180 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_convert.h Source File

im_convert.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Image Conversion
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_CONVERT_H
00008 #define __IM_CONVERT_H
00009
00010 #include "im_image.h"
00011
00012 #if     defined(__cplusplus)
00013 extern "C" {
00014 #endif
00015
00016
00017 /** \defgroup convert Image Conversion
00018  * \par
00019  * Converts one type of image into another. Can convert between color modes
00020  * and between data types.
00021  * \par
00022  * See \ref im_convert.h
00023  * \ingroup imgclass */
00024
00025
00026 /** Complex to real conversions
00027  * \ingroup convert */
00028 enum imComplex2Real
00029 {
00030   IM_CPX_REAL,
00031   IM_CPX_IMAG,
00032   IM_CPX_MAG,
00033   IM_CPX_PHASE
00034 };
00035
00036 /** Predefined Gamma factors. Gamma can be any real number.
00037  * When gamma<0 use logarithmic, when gamma>0 use exponential.
00038  * gamma(x,g) = ((e^(g*x))-1)/(exp(g)-1)
00039  * gamma(x,g) = (log((g*x)+1))/(log(g+1))
00040  * \ingroup convert */
00041 enum imGammaFactor
00042 {
00043   IM_GAMMA_LINEAR   = 0,
00044   IM_GAMMA_LOGLITE  = -10,
00045   IM_GAMMA_LOGHEAVY = -1000,
00046   IM_GAMMA_EXPLITE  = 2,
00047   IM_GAMMA_EXPHEAVY = 7
00048 };
00049
00050 /** Predefined Cast Modes
00051  * \ingroup convert */
00052 enum imCastMode
00053 {
00054   IM_CAST_MINMAX, /**< scan for min and max values */
00055   IM_CAST_FIXED,  /**< use predefied 0-max values, see \ref color Color Manipulation. */
00056   IM_CAST_DIRECT  /**< direct type cast the value. Only byte and ushort will be cropped. */
00057 };
00058
00059 /** Changes the image data type, using a complex2real conversion,
00060  * a gamma factor, and an abssolute mode (modulus). \n
00061  * When demoting the data type the function will scan for min/max values or use fixed values (cast_mode)
00062  * to scale the result according to the destiny range. \n
00063  * Except complex to real that will use only the complex2real conversion. \n
00064  * Images must be of the same size and color mode. \n
00065  * Returns IM_ERR_NONE, IM_ERR_DATA or IM_ERR_COUNTER, see also \ref imErrorCodes.
00066  * See also \ref imComplex2Real, \ref imGammaFactor and \ref imCastMode.
00067  *
00068  * \verbatim im.ConvertDataType(src_image: imImage, dst_image: imImage, cpx2real: number, gamma: number, abssolute: boolean, cast_mode: number) -> error: number [in Lua 5] \endverbatim
00069  * \verbatim im.ConvertDataTypeNew(image: imImage, data_type: number, cpx2real: number, gamma: number, abssolute: boolean, cast_mode: number) -> error: number, new_image: imImage  [in Lua 5] \endverbatim
00070  * \ingroup convert */
00071 int imConvertDataType(const imImage* src_image, imImage* dst_image, int cpx2real, float gamma, int abssolute, int cast_mode);
00072
00073 /** Converts one color space to another. Images must be of the same size and data type. \n
00074  * CMYK can be converted to RGB only, and it is a very simple conversion. \n
00075  * All colors can be converted to Binary, the non zero gray values are converted to 1. \n
00076  * RGB to Map uses the median cut implementation from the free IJG JPEG software, copyright Thomas G. Lane. \n
00077  * Alpha channel is considered and Transparency* attributes are converted to alpha channel. \n
00078  * All other color space conversions assume sRGB and CIE definitions. \n
00079  * Returns IM_ERR_NONE, IM_ERR_DATA or IM_ERR_COUNTER, see also \ref imErrorCodes.
00080  *
00081  * \verbatim im.ConvertColorSpace(src_image: imImage, dst_image: imImage) -> error: number [in Lua 5] \endverbatim
00082  * \verbatim im.ConvertColorSpaceNew(image: imImage, color_space: number, has_alpha: boolean) -> error: number, new_image: imImage [in Lua 5] \endverbatim
00083  * \ingroup convert */
00084 int imConvertColorSpace(const imImage* src_image, imImage* dst_image);
00085
00086 /** Converts the image to its bitmap equivalent,
00087  * uses \ref imConvertColorSpace and \ref imConvertDataType. \n
00088  * Returns IM_ERR_NONE, IM_ERR_DATA or IM_ERR_COUNTER, see also \ref imErrorCodes.
00089  * See also \ref imComplex2Real, \ref imGammaFactor and \ref imCastMode. \n
00090  * The function im.ConvertToBitmapNew uses the default convertion result from \ref imColorModeToBitmap if color_space is nil.
00091  *
00092  * \verbatim im.ConvertToBitmap(src_image: imImage, dst_image: imImage, cpx2real: number, gamma: number, abssolute: boolean, cast_mode: number) -> error: number [in Lua 5] \endverbatim
00093  * \verbatim im.ConvertToBitmapNew(image: imImage, color_space: number, has_alpha: boolean, cpx2real: number, gamma: number, abssolute: boolean, cast_mode: number) -> error: number, new_image: imImage [in Lua 5] \endverbatim
00094  * \ingroup convert */
00095 int imConvertToBitmap(const imImage* src_image, imImage* dst_image, int cpx2real, float gamma, int abssolute, int cast_mode);
00096
00097 /** Returns an OpenGL compatible data buffer. Also returns the correspondant pixel format. \n
00098  * The memory allocated is stored in the attribute "GLDATA" with BYTE type. And it will exists while the image exists. \n
00099  * It can be cleared by setting the attribute to NULL. \n
00100  * MAP images are converted to RGB, and BINARY images are converted to GRAY.
00101  * Alpha channel is considered and Transparency* attributes are converted to alpha channel.
00102  * So calculate depth from glformat, not from image depth.
00103  *
00104  * \verbatim image:GetOpenGLData() -> gldata: userdata, glformat: number [in Lua 5] \endverbatim
00105  * \ingroup convert */
00106 void* imImageGetOpenGLData(const imImage* image, int *glformat);
00107
00108 /** Creates an image from an OpenGL data.
00109  *
00110  * \verbatim im.ImageCreateFromOpenGLData(width, height, glformat: number, gldata: userdata) -> image: imImage [in Lua 5] \endverbatim
00111  * \ingroup convert */
00112 imImage* imImageCreateFromOpenGLData(int width, int height, int glformat, const void* gldata);
00113
00114
00115 /** \defgroup cnvutil Raw Data Conversion Utilities
00116  * \par
00117  * Utilities for raw data buffers.
00118  * \par
00119  * See \ref im_convert.h
00120  * \ingroup imagerep */
00121
00122
00123 /** Changes the packing of the data buffer. Both must have the same width, height and data_type. \n
00124  * It can be used to copy data even if depth=1.
00125  * \ingroup cnvutil */
00126 void imConvertPacking(const void* src_data, void* dst_data, int width, int height, int src_depth, int dst_depth, int data_type, int src_is_packed);
00127
00128 /** Changes in-place a MAP data into a RGB data. The data must have room for the RGB image. \n
00129  * depth can be 3 or 4. count=width*height. \n
00130  * \ingroup cnvutil */
00131 void imConvertMapToRGB(unsigned char* data, int count, int depth, int packed, long* palette, int palette_count);
00132
00133
00134
00135 /* Converts a RGB bitmap into a map bitmap using the median cut algorithm.
00136  * Used only "im_convertcolor.cpp" implemented in "im_rgb2map.cpp".
00137  * Internal function kept here because of the compatibility module.
00138  * Will not be at the documentation. */
00139 int imConvertRGB2Map(int width, int height,
00140               unsigned char *red, unsigned char *green, unsigned char *blue,
00141               unsigned char *map, long *palette, int *palette_count);
00142
00143
00144 #if defined(__cplusplus)
00145 }
00146 #endif
00147
00148 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_counter.h Source File

im_counter.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Processing Counter
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_COUNTER_H
00008 #define __IM_COUNTER_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014
00015 /** \defgroup counter Counter
00016  * \par
00017  * Used to notify the application that a step in the loading, saving or processing operation has been performed.
00018  * \par
00019  * See \ref im_counter.h
00020  * \ingroup util */
00021
00022 /** Counter callback, informs the progress of the operation to the client. \n
00023  * Text contains a constant string that is NULL during normal counting, a title in the begining of a sequence
00024  * and a message in the begining of a count.
00025  * Counter id identifies diferrent counters. \n
00026  * Progress in a count reports a value from 0 to 1000. If -1 indicates the start of a sequence of operations, 1001 ends the sequence. \n
00027  * If returns 0 the client should abort the operation. \n
00028  * If the counter is aborted, the callback will be called one last time at 1001.
00029  * \ingroup counter */
00030 typedef int (*imCounterCallback)(int counter, void* user_data, const char* text, int progress);
00031
00032 /** Changes the counter callback. Returns old callback. \n
00033  * User data is changed only if not NULL.
00034  * \ingroup counter */
00035 imCounterCallback imCounterSetCallback(void* user_data, imCounterCallback counter_func);
00036
00037 /** Begins a new count, or a partial-count in a sequence. \n
00038  * Calls the callback with "-1" and text=title, if it is at the top level. \n
00039  * This is to be used by the operations. Returns a counter Id.
00040  * \ingroup counter */
00041 int imCounterBegin(const char* title);
00042
00043 /** Ends a count, or a partial-count in a sequence. \n
00044  * Calls the callback with "1001", text=null, and releases the counter if it is at top level count. \n
00045  * \ingroup counter */
00046 void imCounterEnd(int counter);
00047
00048 /** Increments a count. Must set the total first. \n
00049  * Calls the callback, text=message if it is the first increment for the count. \n
00050  * Returns 0 if the callback aborted, 1 if returns normally.
00051  * \ingroup counter */
00052 int imCounterInc(int counter);
00053
00054 /** Set a specific count. Must set the total first. \n
00055  * Calls the callback, text=message if it is the first increment for the count. \n
00056  * Returns 0 if the callback aborted, 1 if returns normally.
00057  * \ingroup counter */
00058 int imCounterIncTo(int counter, int count);
00059
00060 /** Sets the total increments of a count.
00061  * \ingroup counter */
00062 void imCounterTotal(int counter, int total, const char* message);
00063
00064
00065 #if defined(__cplusplus)
00066 }
00067 #endif
00068
00069 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_dib.h Source File

im_dib.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Windows DIB (Device Independent Bitmap)
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_DIB_H
00008 #define __IM_DIB_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014
00015 /** \defgroup dib Windows DIB
00016  *
00017  * \par
00018  * Windows DIBs in memory are handled just like a BMP file without the file header. \n
00019  * These functions will work only in Windows. They are usefull for interchanging data
00020  * with the clipboard, with capture drivers, with the AVI and WMF file formats and others.
00021  * \par
00022  * Supported DIB aspects:
00023  * \li bpp must be 1, 4, 8, 16, 24, or 32.
00024  * \li BITMAPV4HEADER or BITMAPV5HEADER are handled but ignored. \n
00025  * \li BITMAPCOREHEADER is not handled .
00026  * \li BI_JPEG and BI_PNG compressions are not handled.
00027  * \li biHeight can be negative, compression can be RLE only if created
00028  *   from imDibCreateReference, imDibPasteClipboard, imDibLoadFile.
00029  * \li can not encode/decode Images to/from RLE compressed Dibs.
00030  * \li if working with RLE Dibs bits_size is greatter than used.
00031  * \li the resolution of a new Dib is taken from the screen.
00032  * \li SetDIBitsToDevice(start_scan is 0, scan_lines is dib->bmih->biHeight).
00033  * \li StretchDIBits(use always DIB_RGB_COLORS).
00034  * \li CreateDIBPatternBrushPt(packed_dib is dib->dib).
00035  * \par
00036  * Must include <windows.h> before using these functions. \n
00037  * Check <wingdi.h> for structures and definitions.
00038  * \par
00039  * See \ref im_dib.h
00040  * \ingroup util */
00041
00042
00043 /** \brief Windows DIB Structure
00044  *
00045  * \par
00046  * Handles a DIB in memory. \n
00047  * The DIB is stored in only one buffer.
00048  * The secondary members are pointers to the main buffer.
00049  * \ingroup dib */
00050 typedef struct _imDib
00051 {
00052   HGLOBAL           handle;        /**< The windows memory handle */
00053   BYTE*             dib;           /**< The DIB as it is defined in memory */
00054   int               size;          /**< Full size in memory */
00055
00056   BITMAPINFO*       bmi;           /**< Bitmap Info = Bitmap Info Header + Palette */
00057   BITMAPINFOHEADER* bmih;          /**< Bitmap Info Header */
00058   RGBQUAD*          bmic;          /**< Bitmap Info Colors = Palette */
00059   BYTE*             bits;                /**< Bitmap Bits */
00060
00061   int               palette_count; /**< number of colors in the palette */
00062   int               bits_size;     /**< size in bytes of the Bitmap Bits */
00063   int               line_size;     /**< size in bytes of one line, includes padding */
00064   int               pad_size;      /**< number of bytes remaining in the line, lines are in a word boundary */
00065
00066   int               is_reference;  /**< only a reference, do not free pointer */
00067 } imDib;
00068
00069 /** Creates a new DIB. \n
00070  * use bpp=-16/-32 to allocate space for BITFLIEDS.
00071  * \ingroup dib */
00072 imDib* imDibCreate(int width, int height, int bpp);
00073
00074 /** Duplicates the DIB contents in a new DIB.
00075  * \ingroup dib */
00076 imDib* imDibCreateCopy(const imDib* dib);
00077
00078 /** Creates a DIB using an already allocated memory. \n
00079  * "bmi" must be a pointer to BITMAPINFOHEADER. \n
00080  * "bits" can be NULL if it is inside "bmi" after the palette.
00081  * \ingroup dib */
00082 imDib* imDibCreateReference(BYTE* bmi, BYTE* bits);
00083
00084 /** Creates a DIB section for drawing porposes. \n
00085  * Returns the image handle also created.
00086  * \ingroup dib */
00087 imDib* imDibCreateSection(HDC hDC, HBITMAP *image, int width, int height, int bpp);
00088
00089 /** Destroy the DIB
00090  * \ingroup dib */
00091 void imDibDestroy(imDib* dib);
00092
00093 /** DIB GetPixel function definition. \n
00094  * the DWORD is a raw copy of the bits, use (unsigned char*)&pixel
00095  * \ingroup dib */
00096 typedef unsigned int (*imDibLineGetPixel)(unsigned char* line, int col);
00097
00098 /** Returns a function to read pixels from a DIB line.
00099  * \ingroup dib */
00100 imDibLineGetPixel imDibLineGetPixelFunc(int bpp);
00101
00102 /** DIB SetPixel function definition
00103  * \ingroup dib */
00104 typedef void (*imDibLineSetPixel)(unsigned char* line, int col, unsigned int pixel);
00105
00106 /** Returns a function to write pixels into a DIB line.
00107  * \ingroup dib */
00108 imDibLineSetPixel imDibLineSetPixelFunc(int bpp);
00109
00110 /** Creates a DIB from a image handle and a palette handle.
00111  * \ingroup dib */
00112 imDib* imDibFromHBitmap(const HBITMAP image, const HPALETTE hPalette);
00113
00114 /** Creates a image handle from a DIB.
00115  * \ingroup dib */
00116 HBITMAP imDibToHBitmap(const imDib* dib);
00117
00118 /** Returns a Logical palette from the DIB palette. \n
00119  * DIB bpp must be <=8.
00120  * \ingroup dib */
00121 HPALETTE imDibLogicalPalette(const imDib* dib);
00122
00123 /** Captures the screen into a DIB.
00124  * \ingroup dib */
00125 imDib* imDibCaptureScreen(int x, int y, int width, int height);
00126
00127 /** Transfer the DIB to the clipboard. \n
00128  * "dib" pointer can not be used after, or use imDibCopyClipboard(imDibCreateCopy(dib)).
00129  * Warning: Clipboard functions in C++ can fail with Visual C++ /EHsc (Enable C++ Exceptions)
00130 * \ingroup dib */
00131 void imDibCopyClipboard(imDib* dib);
00132
00133 /** Creates a reference for the DIB in the clipboard if any. Returns NULL otherwise.
00134  * Warning: Clipboard functions in C++ can fail with Visual C++ /EHsc (Enable C++ Exceptions)
00135  * \ingroup dib */
00136 imDib* imDibPasteClipboard(void);
00137
00138 /** Checks if there is a dib at the clipboard.
00139  * \ingroup dib */
00140 int imDibIsClipboardAvailable(void);
00141
00142 /** Saves the DIB into a file ".bmp".
00143  * \ingroup dib */
00144 int imDibSaveFile(const imDib* dib, const char* filename);
00145
00146 /** Creates a DIB from a file ".bmp".
00147  * \ingroup dib */
00148 imDib* imDibLoadFile(const char* filename);
00149
00150 /** Converts a DIB into an RGBA image. alpha is optional. bpp must be >8. \n
00151  * alpha is used only when bpp=32.
00152  * \ingroup dib */
00153 void imDibDecodeToRGBA(const imDib* dib, unsigned char* red, unsigned char* green, unsigned char* blue, unsigned char* alpha);
00154
00155 /** Converts a DIB into an indexed image. bpp must be <=8. colors must have room for at least 256 colors.
00156  * colors is rgb packed (RGBRGBRGB...)
00157  * \ingroup dib */
00158 void imDibDecodeToMap(const imDib* dib, unsigned char* map, long* palette);
00159
00160 /** Converts an RGBA image into a DIB. alpha is optional. bpp must be >8. \n
00161  * alpha is used only when bpp=32.
00162  * \ingroup dib */
00163 void imDibEncodeFromRGBA(imDib* dib, const unsigned char* red, const unsigned char* green, const unsigned char* blue, const unsigned char* alpha);
00164
00165 /** Converts an indexed image into a DIB. bpp must be <=8. \n
00166  * colors is rgb packed (RGBRGBRGB...)
00167  * \ingroup dib */
00168 void imDibEncodeFromMap(imDib* dib, const unsigned char* map, const long* palette, int palette_count);
00169
00170 /** Converts a IM_RGB packed image, with or without alpha, into a DIB.
00171  * \ingroup dib */
00172 void imDibEncodeFromBitmap(imDib* dib, const unsigned char* data);
00173
00174 /** Converts a DIB into IM_RGB packed image, with or without alpha.
00175  * \ingroup dib */
00176 void imDibDecodeToBitmap(const imDib* dib, unsigned char* data);
00177
00178 #ifdef __IM_IMAGE_H
00179 /* You must include "im_image.h" before this header to enable these declarations. */
00180
00181 /** Creates a imImage from the dib data.
00182  * \ingroup dib */
00183 imImage* imDibToImage(const imDib* dib);
00184
00185 /** Creates a Dib from the image. It must be a bitmap image.
00186  * \ingroup dib */
00187 imDib* imDibFromImage(const imImage* image);
00188
00189 #endif
00190
00191 #if defined(__cplusplus)
00192 }
00193 #endif
00194
00195 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_file.h Source File

im_file.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief File Access
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_FILE_H
00008 #define __IM_FILE_H
00009
00010 #include "im.h"
00011
00012 #if     defined(__cplusplus)
00013 extern "C" {
00014 #endif
00015
00016
00017 /** \defgroup filesdk File Format SDK
00018  * \par
00019  * All the file formats are based on theses structures. Use them to create new file formats. \n
00020  * The LineBuffer functions will help transfer image from format buffer to application buffer and vice-versa.
00021  * \par
00022  * See \ref im_file.h
00023  * \ingroup file */
00024
00025
00026 /** \brief Image File Format Base Class (SDK Use Only)
00027  *
00028  * \par
00029  * Base container to hold format independent state variables.
00030  * \ingroup filesdk */
00031 struct _imFile
00032 {
00033   int is_new;
00034   void* attrib_table;    /**< in fact is a imAttribTable, but we hide this here */
00035
00036   void* line_buffer;     /**< used for line convertion, contains all components if packed, or only one if not */
00037   int line_buffer_size;
00038   int line_buffer_extra; /**< extra bytes to be allocated */
00039   int line_buffer_alloc; /**< total allocated so far */
00040   int counter;
00041
00042   int convert_bpp;       /**< number of bpp to unpack/pack to/from 1 byte.
00043                               When reading converts n packed bits to 1 byte (unpack). If n>1 will also expand to 0-255.
00044                               When writing converts 1 byte to 1 bit (pack).
00045                               If negative will only expand to 0-255 (no unpack or pack). */
00046   int switch_type;       /**< flag to switch the original data type: char-byte, short-ushort, uint-int, double-float */
00047
00048   long palette[256];
00049   int palette_count;
00050
00051   int user_color_mode,
00052       user_data_type,
00053       file_color_mode,   /* these two must be filled by te driver always. */
00054       file_data_type;
00055
00056   /* these must be filled by the driver when reading,
00057      and given by the user when writing. */
00058
00059   char compression[10];
00060   int image_count,
00061       image_index,
00062       width,
00063       height;
00064 };
00065
00066
00067 /* Internal Use only */
00068
00069 /* Initializes the imFile structure.
00070  * Used by the special format RAW. */
00071 void imFileClear(imFile* ifile);
00072
00073 /* Initializes the line buffer.
00074  * Used by "im_file.cpp" only. */
00075 void imFileLineBufferInit(imFile* ifile);
00076
00077 /* Check if the conversion is valid.
00078  * Used by "im_file.cpp" only. */
00079 int imFileCheckConversion(imFile* ifile);
00080
00081
00082 /* File Format SDK */
00083
00084 /** Number of lines to be accessed.
00085  * \ingroup filesdk */
00086 int imFileLineBufferCount(imFile* ifile);
00087
00088 /** Increments the row and plane counters.
00089  * \ingroup filesdk */
00090 void imFileLineBufferInc(imFile* ifile, int *row, int *plane);
00091
00092 /** Converts from FILE color mode to USER color mode.
00093  * \ingroup filesdk */
00094 void imFileLineBufferRead(imFile* ifile, void* data, int line, int plane);
00095
00096 /** Converts from USER color mode to FILE color mode.
00097  * \ingroup filesdk */
00098 void imFileLineBufferWrite(imFile* ifile, const void* data, int line, int plane);
00099
00100 /** Utility to calculate the line size in byte with a specified alignment. \n
00101  * "align" can be 1, 2 or 4.
00102  * \ingroup filesdk */
00103 int imFileLineSizeAligned(int width, int bpp, int align);
00104
00105 /** Set the attributes FileFormat, FileCompression and FileImageCount. \n
00106  * Used in imFileOpen and imFileOpenAs, and after the attribute list cleared with RemoveAll.
00107  * \ingroup filesdk */
00108 void imFileSetBaseAttributes(imFile* ifile);
00109
00110
00111 #if defined(__cplusplus)
00112 }
00113 #endif
00114
00115 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format.h Source File

im_format.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief File Format Access
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #include "im_file.h"
00008 #include "im_attrib.h"
00009
00010 #ifndef __IM_FORMAT_H
00011 #define __IM_FORMAT_H
00012
00013
00014 class imFormat;
00015
00016 /** \brief Image File Format Virtual Class (SDK Use Only)
00017  *
00018  * \par
00019  * Virtual Base class for file formats. All file formats inherit from this class.
00020  * \ingroup filesdk */
00021 class imFileFormatBase: public _imFile
00022 {
00023 public:
00024   const imFormat* iformat;
00025
00026   imFileFormatBase(const imFormat* _iformat): iformat(_iformat) {}
00027   virtual ~imFileFormatBase() {}
00028
00029   imAttribTable* AttribTable() {return (imAttribTable*)this->attrib_table;}
00030
00031   /* Pure Virtual Methods. Every driver must implement all the following methods. */
00032
00033   virtual int Open(const char* file_name) = 0; // Must initialize compression and image_count
00034   virtual int New(const char* file_name) = 0;
00035   virtual void Close() = 0;
00036   virtual void* Handle(int index) = 0;
00037   virtual int ReadImageInfo(int index) = 0;    // Should update compression
00038   virtual int ReadImageData(void* data) = 0;
00039   virtual int WriteImageInfo() = 0;            // Should update compression
00040   virtual int WriteImageData(void* data) = 0;  // Must update image_count
00041 };
00042
00043 /** \brief Image File Format Descriptor (SDK Use Only)
00044  *
00045  * \par
00046  * All file formats must define these informations. They are stored by \ref imFormatRegister.
00047  * \ingroup filesdk */
00048 class imFormat
00049 {
00050 public:
00051   const char* format;
00052   const char* desc;
00053   const char* ext;
00054   const char** comp;
00055   int comp_count,
00056       can_sequence;
00057
00058   virtual imFileFormatBase* Create() const = 0;
00059   virtual int CanWrite(const char* compression, int color_mode, int data_type) const = 0;
00060
00061   imFormat(const char* _format, const char* _desc, const char* _ext,
00062            const char** _comp, int _comp_count, int _can_sequence)
00063     :format(_format), desc(_desc), ext(_ext), comp(_comp),
00064      comp_count(_comp_count), can_sequence(_can_sequence)
00065     {}
00066   virtual ~imFormat() {}
00067 };
00068
00069 extern "C"
00070 {
00071
00072 /* Internal Use only */
00073
00074 /* Opens a file with the respective format driver
00075  * Uses the file extension to speed up the search for the format driver.
00076  * Used by "im_file.cpp" only. */
00077 imFileFormatBase* imFileFormatBaseOpen(const char* file_name, int *error);
00078
00079 /* Opens a file with the given format
00080  * Used by "im_file.cpp" only. */
00081 imFileFormatBase* imFileFormatBaseOpenAs(const char* file_name, const char* format, int *error);
00082
00083 /* Creates a file using the given format driver.
00084  * Used by "im_file.cpp" only. */
00085 imFileFormatBase* imFileFormatBaseNew(const char* file_name, const char* format, int *error);
00086
00087
00088 /* File Format SDK */
00089
00090 /** Register a format driver.
00091  * \ingroup filesdk */
00092 void imFormatRegister(imFormat* iformat);
00093
00094
00095 }
00096
00097 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_all.h Source File

im_format_all.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief All the Internal File Formats.
00003  * They are all automatically registered by the library.
00004  * The signatures are in C, but the functions are C++.
00005  * Header for internal use only.
00006  *
00007  * See Copyright Notice in im_lib.h
00008  */
00009
00010 #ifndef __IM_FORMAT_ALL_H
00011 #define __IM_FORMAT_ALL_H
00012
00013 #if     defined(__cplusplus)
00014 extern "C" {
00015 #endif
00016
00017 /** \defgroup tiff TIFF - Tagged Image File Format
00018  * \section Description
00019  *
00020  * \par
00021  * Copyright (c) 1986-1988, 1992 by Adobe Systems Incorporated. \n
00022  * Originally created by a group of companies,
00023  * the Aldus Corporation keeped the copyright until Aldus was aquired by Adobe. \n
00024  * TIFF Revision 6.0 Final — June 3, 1992 \n
00025  * http://www.adobe.com/Support/TechNotes.html
00026  * \par
00027  * Access to the TIFF file format uses libTIFF version 3.9.2 \n
00028  * http://www.remotesensing.org/libtiff/                     \n
00029  * Copyright (c) 1988-1997 Sam Leffler                      \n
00030  * Copyright (c) 1991-1997 Silicon Graphics, Inc.           \n
00031  *
00032  * \section Features
00033  *
00034 \verbatim
00035     Data Types: <all>
00036     Color Spaces: Gray, RGB, CMYK, YCbCr, Lab, XYZ, Map and Binary.
00037     Compressions:
00038       NONE - no compression  [default for IEEE Floating Point Data]
00039       CCITTRLE - CCITT modified Huffman RLE (binary only) [default for Binary]
00040       CCITTFAX3 - CCITT Group 3 fax         (binary only)
00041       CCITTFAX4 - CCITT Group 4 fax         (binary only)
00042       LZW - Lempel-Ziv & Welch  [default]
00043       JPEG - ISO JPEG    [default for YCBCR]
00044       NEXT - NeXT 2-bit RLE (2 bpp only)
00045       CCITTRLEW - CCITT modified Huffman RLE with word alignment (binary only)
00046       RLE - Packbits (Macintosh RLE) [default for MAP]
00047       THUNDERSCAN - ThunderScan 4-bit RLE (only for 2 or 4 bpp)
00048       PIXARLOG - Pixar companded 11-bit ZIP (only byte, ushort and float)
00049       DEFLATE - LZ77 variation (ZIP)
00050       ADOBE_DEFLATE - Adobe LZ77 variation
00051       SGILOG - SGI Log Luminance RLE for L and Luv (only byte, ushort and float) [default for XYZ]
00052       SGILOG24 - SGI Log 24-bit packed for Luv (only byte, ushort and float)
00053     Can have more than one image.
00054     Can have an alpha channel.
00055     Components can be packed or not.
00056     Lines arranged from top down to bottom or bottom up to top.
00057     Handle(1) returns a TIFF* libTIFF structure.
00058
00059     Attributes:
00060       Photometric IM_USHORT (1) (when writing this will complement the color_mode information, for Mask, MinIsWhite, ITULab and ICCLab)
00061       ExtraSampleInfo IM_USHORT (1) (description of alpha channel: 0- uknown, 1- pre-multiplied, 2-normal)
00062       JPEGQuality IM_INT (1) [0-100, default 75] (write only)
00063       ZIPQuality IM_INT (1) [1-9, default 6] (write only)
00064       ResolutionUnit (string) ["DPC", "DPI"]
00065       XResolution, YResolution IM_FLOAT (1)
00066       Description, Author, Copyright, DateTime, DocumentName,
00067       PageName, TargetPrinter, Make, Model, Software, HostComputer (string)
00068       InkNames (strings separated by '0's)
00069       InkSet IM_USHORT (1)
00070       NumberOfInks IM_USHORT (1)
00071       DotRange IM_USHORT (2)
00072       TransferFunction0, TransferFunction1, TransferFunction3 IM_USHORT [gray=0, rgb=012]
00073       ReferenceBlackWhite IMFLOAT (6)
00074       WhitePoint IMFLOAT (2)
00075       PrimaryChromaticities  IMFLOAT (6)
00076       YCbCrCoefficients IM_FLOAT (3)
00077       YCbCrSubSampling IM_USHORT (2)
00078       YCbCrPositioning IM_USHORT (1)
00079       PageNumber IM_USHORT (2)
00080       StoNits IM_FLOAT (1)
00081       XPosition, YPosition IM_FLOAT (1)
00082       SMinSampleValue, SMaxSampleValue IM_FLOAT (1)
00083       HalftoneHints IM_USHORT (2)
00084       SubfileType IM_INT (1)
00085       ICCProfile IM_BYTE (N)
00086       MultiBandCount IM_USHORT (1)    [Number of bands in a multiband gray image.]
00087       MultiBandSelect IM_USHORT (1)   [Band number to read one band of a multiband gray image. Must be set before reading image info.]
00088       and other TIFF tags as they are described in the TIFF documentation.
00089       GeoTIFF tags:
00090         GeoTiePoints, GeoTransMatrix, IntergraphMatrix, GeoPixelScale, GeoDoubleParams IM_FLOAT (N)
00091         GeoASCIIParams (string)
00092       Read-only support for EXIF tags as they are described in the EXIF 2.2 documentation. See http://www.exif.org/
00093       DNG tags as they are described in the DNG documentation. See http://www.adobe.com/br/products/dng/
00094         Tags BlackLevel, DefaultCropOrigin and DefaultCropSize are incorrectly interpreted by libTIFF so they are ignored.
00095         Raw image is loaded in place of the thumbnail image in the main IFD.
00096         SubIFDCount IM_USHORT (1)    [Number of subifds of the current image.]
00097         SubIFDSelect IM_USHORT (1)   [Subifd number to be read. Must be set before reading image info.]
00098       (other attributes can be obtained by using libTIFF directly using the Handle(1) function)
00099
00100     Comments:
00101       LogLuv is in fact Y'+CIE(u,v), so we choose to always convert it to XYZ.
00102       SubIFD is handled only for DNG.
00103       Since LZW patent expired, LZW compression is enabled. LZW Copyright Unisys.
00104       libGeoTIFF can be used without XTIFF initialization. Use Handle(1) to obtain a TIFF*.
00105
00106     Changes:
00107       "tiff_jpeg.c" - commented "downsampled_output = TRUE" in 2 places.
00108       A few fixes in some files, search for "IMLIB" to see the changes.
00109       New file "tif_config.h" to match our needs.
00110       New file "tiff_binfile.c" that implement I/O rotines using imBinFile.
00111 \endverbatim
00112  * \ingroup format */
00113 void imFormatRegisterTIFF(void);
00114
00115 /** \defgroup jpeg JPEG - JPEG File Interchange Format
00116  * \section Description
00117  *
00118  * \par
00119  * ISO/IEC 10918 (1994, 1995, 1997, 1999)\n
00120  * http://www.jpeg.org/
00121  * \par
00122  * Access to the JPEG file format uses libJPEG version 7. \n
00123  * http://www.ijg.org                                      \n
00124  * Copyright (C) 1994-2009, Thomas G. Lane, Guido Vollbeding  \n
00125  *   from the Independent JPEG Group.
00126  * \par
00127  * Access to the EXIF attributes uses libEXIF version 0.6.17. \n
00128  * http://sourceforge.net/projects/libexif                    \n
00129  * Copyright (C) 2001-2003, Lutz Müller
00130  *
00131  * \section Features
00132  *
00133 \verbatim
00134     Data Types: Byte
00135     Color Spaces: Gray, RGB, CMYK and YCbCr (Binary Saved as Gray)
00136     Compressions:
00137       JPEG - ISO JPEG  [default]
00138     Only one image.
00139     No alpha channel.
00140     Internally the components are always packed.
00141     Internally the lines are arranged from top down to bottom.
00142     Handle(1) returns jpeg_decompress_struct* when reading, and
00143                       jpeg_compress_struct* when writing (libJPEG structures).
00144
00145     Attributes:
00146       AutoYCbCr IM_INT (1) (controls YCbCr auto conversion) default 1
00147       JPEGQuality IM_INT (1) [0-100, default 75] (write only)
00148       ResolutionUnit (string) ["DPC", "DPI"]
00149       XResolution, YResolution IM_FLOAT (1)
00150       Interlaced (same as Progressive) IM_INT (1 | 0) default 0
00151       Description (string)
00152       (lots of Exif tags)
00153
00154     Changes to libJPEG:
00155       jdatadst.c - fflush and ferror replaced by macros JFFLUSH and JFERROR.
00156       jinclude.h - standard JFFLUSH and JFERROR definitions, and new macro HAVE_JFIO.
00157       jdhuf.c - added support for OJPEG_SUPPORT in libTIFF.
00158       new file created: jconfig.h
00159
00160     Changes to libEXIF:
00161       new files config.h and _stdint.h
00162       changed "exif-tag.c" to add new function
00163       changed "exif-entry.c" to improve exif_entry_initialize
00164
00165     Comments:
00166       Other APPx markers are ignored.
00167       No thumbnail support.
00168       RGB images are automatically converted to YCbCr when saved.
00169       Also YcbCr are converted to RGB when loaded. Use AutoYCbCr=0 to disable this behavior.
00170 \endverbatim
00171  * \ingroup format */
00172 void imFormatRegisterJPEG(void);
00173
00174 /** \defgroup png PNG - Portable Network Graphic Format
00175  * \section Description
00176  *
00177  * \par
00178  * Access to the PNG file format uses libPNG version 1.2.39. \n
00179  * http://www.libpng.org                                    \n
00180  * Copyright (C) 1998-2009 Glenn Randers-Pehrson
00181  *
00182  * \section Features
00183  *
00184 \verbatim
00185     Data Types: Byte and UShort
00186     Color Spaces: Gray, RGB, MAP and Binary
00187     Compressions:
00188       DEFLATE - LZ77 variation (ZIP) [default]
00189     Only one image.
00190     Can have an alpha channel.
00191     Internally the components are always packed.
00192     Internally the lines are arranged from top down to bottom.
00193     Handle(1) returns png_structp libPNG structure.
00194
00195     Attributes:
00196       ZIPQuality IM_INT (1) [1-9, default 6] (write only)
00197       ResolutionUnit (string) ["DPC", "DPI"]
00198       XResolution, YResolution IM_FLOAT (1)
00199       Interlaced (same as Progressive) IM_INT (1 | 0) default 0
00200       Gamma IM_FLOAT (1)
00201       WhitePoint IMFLOAT (2)
00202       PrimaryChromaticities  IMFLOAT (6)
00203       XPosition, YPosition IM_FLOAT (1)
00204       sRGBIntent IM_INT (1) [0: Perceptual, 1: Relative colorimetric, 2: Saturation, 3: Absolute colorimetric]
00205       TransparencyMap IM_BYTE (N) (for MAP images is the alpha value of the corresponding palette index)
00206       TransparencyIndex IM_BYTE (1) (for MAP images is the first index that has minimum alpha in TransparencyMap, for GRAY images is the index that it is fully transparent)
00207       TransparencyColor IM_BYTE (3) (for RGB images is the color that is full transparent)
00208       CalibrationName, CalibrationUnits (string)
00209       CalibrationLimits IM_INT (2)
00210       CalibrationEquation IM_BYTE (1) [0-Linear,1-Exponential,2-Arbitrary,3-HyperbolicSine)]
00211       CalibrationParam (string) [params separated by '\\n']
00212       Title, Author, Description, Copyright, DateTime (string)
00213       Software, Disclaimer, Warning, Source, Comment, ...       (string)
00214       DateTimeModified (string) [when writing uses the current system time]
00215       ICCProfile IM_BYTE (N)
00216       ScaleUnit (string) ["meters", "radians"]
00217       XScale, YScale IM_FLOAT (1)
00218
00219     Comments:
00220       When saving PNG image with TransparencyIndex or TransparencyMap, TransparencyMap has precedence, so set it to NULL if you changed TransparencyIndex.
00221       Attributes after the image are ignored.
00222       Define PNG_NO_CONSOLE_IO to avoid printfs. We also define PNG_TIME_RFC1123_SUPPORTED.
00223       Added the following files to the makefile to optimize the library:
00224       pngvcrd.c  - PNG_USE_PNGVCRD
00225                    For Intel x86 CPU and Microsoft Visual C++ compiler
00226       pnggccrd.c - PNG_USE_PNGGCCRD
00227                    For Intel x86 CPU (Pentium-MMX or later) and GNU C compiler.
00228 \endverbatim
00229  * \ingroup format */
00230 void imFormatRegisterPNG(void);
00231
00232 /** \defgroup gif GIF - Graphics Interchange Format
00233  * \section Description
00234  *
00235  * \par
00236  * Copyright (c) 1987,1988,1989,1990 CompuServe Incorporated. \n
00237  * GIF is a Service Mark property of CompuServe Incorporated. \n
00238  * Graphics Interchange Format Programming Reference, 1990. \n
00239  * LZW Copyright Unisys.
00240  * \par
00241  * Patial Internal Implementation. \n
00242  * Decoding and encoding code were extracted from GIFLib 1.0. \n
00243  * Copyright (c) 1989 Gershon Elber.
00244  *
00245  * \section Features
00246  *
00247 \verbatim
00248     Data Types: Byte
00249     Color Spaces: MAP only, (Gray and Binary saved as MAP)
00250     Compressions:
00251       LZW - Lempel-Ziv & Welch      [default]
00252     Can have more than one image.
00253     No alpha channel.
00254     Internally the lines are arranged from top down to bottom.
00255
00256     Attributes:
00257       ScreenHeight, ScreenWidth IM_USHORT (1) screen size [default to the first image size]
00258       Interlaced IM_INT (1 | 0) default 0
00259       Description (string)
00260       TransparencyIndex IM_BYTE (1)
00261       XScreen, YScreen IM_USHORT (1) screen position
00262       UserInput IM_BYTE (1) [1, 0]
00263       Disposal (string) [UNDEF, LEAVE, RBACK, RPREV]
00264       Delay IM_USHORT (1) [time to wait betweed frames in 1/100 of a second]
00265       Iterations IM_USHORT (1) (NETSCAPE2.0 Application Extension) [The number of times to repeat the animation. 0 means to repeat forever. ]
00266
00267     Comments:
00268       Attributes after the last image are ignored.
00269       Reads GIF87 and GIF89, but writes GIF89 always.
00270       Ignored attributes: Background Color Index, Pixel Aspect Ratio,
00271                           Plain Text Extensions, Application Extensions...
00272 \endverbatim
00273  * \ingroup format */
00274 void imFormatRegisterGIF(void);
00275
00276 /** \defgroup bmp BMP - Windows Device Independent Bitmap
00277  * \section Description
00278  *
00279  * \par
00280  * Windows Copyright Microsoft Corporation.
00281  * \par
00282  * Internal Implementation.
00283  *
00284  * \section Features
00285  *
00286 \verbatim
00287     Data Types: Byte
00288     Color Spaces: RGB, MAP and Binary (Gray saved as MAP)
00289     Compressions:
00290       NONE - no compression [default]
00291       RLE  - Run Lenght Encoding (only for MAP and Gray)
00292     Only one image.
00293     Can have an alpha channel (only for RGB)
00294     Internally the components are always packed.
00295     Lines arranged from top down to bottom or bottom up to top. But are saved always as bottom up.
00296
00297     Attributes:
00298       ResolutionUnit (string) ["DPC", "DPI"]
00299       XResolution, YResolution IM_FLOAT (1)
00300
00301     Comments:
00302       Reads OS2 1.x and Windows 3, but writes Windows 3 always.
00303       Version 4 and 5 BMPs are not supported.
00304 \endverbatim
00305  * \ingroup format */
00306 void imFormatRegisterBMP(void);
00307
00308 /** \defgroup ras RAS - Sun Raster File
00309  * \section Description
00310  *
00311  * \par
00312  * Copyright Sun Corporation.
00313  * \par
00314  * Internal Implementation.
00315  *
00316  * \section Features
00317  *
00318 \verbatim
00319     Data Types: Byte
00320     Color Spaces: Gray, RGB, MAP and Binary
00321     Compressions:
00322       NONE - no compression   [default]
00323       RLE  - Run Lenght Encoding
00324     Only one image.
00325     Can have an alpha channel (only for IM_RGB)
00326     Internally the components are always packed.
00327     Internally the lines are arranged from top down to bottom.
00328
00329     Attributes:
00330       none
00331 \endverbatim
00332  * \ingroup format */
00333 void imFormatRegisterRAS(void);
00334
00335 /** \defgroup led LED - IUP image in LED
00336  * \section Description
00337  *
00338  * \par
00339  * Copyright Tecgraf/PUC-Rio and PETROBRAS/CENPES.
00340  * \par
00341  * Internal Implementation.
00342  *
00343  * \section Features
00344  *
00345 \verbatim
00346     Data Types: Byte
00347     Color Spaces: MAP only (Gray and Binary saved as MAP)
00348     Compressions:
00349       NONE - no compression  [default]
00350     Only one image.
00351     No alpha channel.
00352     Internally the lines are arranged from top down to bottom.
00353
00354     Attributes:
00355       none
00356
00357     Comments:
00358       LED file must start with "LEDImage = IMAGE[".
00359 \endverbatim
00360  * \ingroup format */
00361 void imFormatRegisterLED(void);
00362
00363 /** \defgroup sgi SGI - Silicon Graphics Image File Format
00364  * \section Description
00365  *
00366  * \par
00367  * SGI is a trademark of Silicon Graphics, Inc.
00368  * \par
00369  * Internal Implementation.
00370  *
00371  * \section Features
00372  *
00373 \verbatim
00374     Data Types: Byte and UShort
00375     Color Spaces: Gray and RGB (Binary saved as Gray, MAP with fixed palette when reading only)
00376     Compressions:
00377       NONE - no compression  [default]
00378       RLE  - Run Lenght Encoding
00379     Only one image.
00380     Can have an alpha channel (only for IM_RGB)
00381     Internally the components are always packed.
00382     Internally the lines are arranged from bottom up to top.
00383
00384     Attributes:
00385       Description (string)
00386 \endverbatim
00387  * \ingroup format */
00388 void imFormatRegisterSGI(void);
00389
00390 /** \defgroup pcx PCX - ZSoft Picture
00391  * \section Description
00392  *
00393  * \par
00394  * Copyright ZSoft Corporation. \n
00395  * ZSoft (1988) PCX Technical Reference Manual.
00396  * \par
00397  * Internal Implementation.
00398  *
00399  * \section Features
00400  *
00401 \verbatim
00402     Data Types: Byte
00403     Color Spaces: RGB, MAP and Binary (Gray saved as MAP)
00404     Compressions:
00405       NONE - no compression
00406       RLE  - Run Lenght Encoding [default - since uncompressed PCX is not well supported]
00407     Only one image.
00408     No alpha channel.
00409     Internally the components are always packed.
00410     Internally the lines are arranged from top down to bottom.
00411
00412     Attributes:
00413       ResolutionUnit (string) ["DPC", "DPI"]
00414       XResolution, YResolution IM_FLOAT (1)
00415       XScreen, YScreen IM_USHORT (1) screen position
00416
00417     Comments:
00418       Reads Versions 0-5, but writes Version 5 always.
00419 \endverbatim
00420  * \ingroup format */
00421 void imFormatRegisterPCX(void);
00422
00423 /** \defgroup tga TGA - Truevision Graphics Adapter File
00424  * \section Description
00425  *
00426  * \par
00427  * Truevision TGA File Format Specification Version 2.0 \n
00428  * Technical Manual Version 2.2 January, 1991           \n
00429  * Copyright 1989, 1990, 1991 Truevision, Inc.
00430  * \par
00431  * Internal Implementation.
00432  *
00433  * \section Features
00434  *
00435 \verbatim
00436     Supports 8 bits per component only. Data type is always Byte.
00437     Color Spaces: Gray, RGB and MAP (Binary saved as Gray)
00438     Compressions:
00439       NONE - no compression [default]
00440       RLE  - Run Lenght Encoding
00441     Only one image.
00442     Can have an alpha channel (only for RGB)
00443     Internally the components are always packed.
00444     Internally the lines are arranged from bottom up to top or from top down to bottom.
00445
00446     Attributes:
00447       XScreen, YScreen IM_USHORT (1) screen position
00448       Title, Author, Description, JobName, Software (string)
00449       SoftwareVersion (read only) (string)
00450       DateTimeModified (string) [when writing uses the current system time]
00451       Gamma IM_FLOAT (1)
00452 \endverbatim
00453  * \ingroup format */
00454 void imFormatRegisterTGA(void);
00455
00456 /** \defgroup pnm PNM - Netpbm Portable Image Map
00457  * \section Description
00458  *
00459  * \par
00460  * PNM formats Copyright Jef Poskanzer
00461  * \par
00462  * Internal Implementation.
00463  *
00464  * \section Features
00465  *
00466 \verbatim
00467     Data Types: Byte and UShort
00468     Color Spaces: Gray, RGB and Binary
00469     Compressions:
00470       NONE - no compression [default]
00471       ASCII (textual data)
00472     Can have more than one image, but sequencial access only.
00473     No alpha channel.
00474     Internally the components are always packed.
00475     Internally the lines are arranged from top down to bottom.
00476
00477     Attributes:
00478       Description (string)
00479
00480     Comments:
00481       In fact ASCII is an expansion, not a compression, because the file will be larger than binary data.
00482 \endverbatim
00483  * \ingroup format */
00484 void imFormatRegisterPNM(void);
00485
00486 /** \defgroup ico ICO - Windows Icon
00487  * \section Description
00488  *
00489  * \par
00490  * Windows Copyright Microsoft Corporation.
00491  * \par
00492  * Internal Implementation.
00493  *
00494  * \section Features
00495  *
00496 \verbatim
00497     Data Types: Byte
00498     Color Spaces: RGB, MAP and Binary (Gray saved as MAP)
00499     Compressions:
00500       NONE - no compression [default]
00501     Can have more than one image. But reading and writing is limited to 10 images max,
00502       and all images must have different sizes and bpp.
00503     Can have an alpha channel (only for RGB)
00504     Internally the components are always packed.
00505     Internally the lines are arranged from bottom up to top.
00506
00507     Attributes:
00508       TransparencyIndex IM_BYTE (1)
00509
00510     Comments:
00511       If the user specifies an alpha channel, the AND mask is loaded as alpha if
00512         the file color mode does not contain the IM_ALPHA flag.
00513       For MAP imagens, if the user does not specifies an alpha channel
00514         the TransparencyIndex is used to initialize the AND mask when writing,
00515         and if the user does specifies an alpha channel
00516         the most repeated index with transparency will be the transparent index.
00517       Although any size and common bpp can be used is recomended to use the typical configurations:
00518         16x16, 32x32, 48x48, 64x64 or 96x96
00519         2 colors, 16 colors, 256 colors, 24bpp or 32bpp
00520 \endverbatim
00521  * \ingroup format */
00522 void imFormatRegisterICO(void);
00523
00524 /** \defgroup krn KRN - IM Kernel File Format
00525  * \section Description
00526  *
00527  * \par
00528  * Textual format to provied a simple way to create kernel convolution images.
00529  * \par
00530  * Internal Implementation.
00531  *
00532  * \section Features
00533  *
00534 \verbatim
00535     Data Types: Byte, Int
00536     Color Spaces: Gray
00537     Compressions:
00538       NONE - no compression [default]
00539     Only one image.
00540     No alpha channel.
00541     Internally the lines are arranged from top down to bottom.
00542
00543     Attributes:
00544       Description (string)
00545
00546     Comments:
00547       The format is very simple, inspired by PNM.
00548       It was developed because PNM does not have support for INT and FLOAT.
00549       Remeber that usually convolution operations use kernel size an odd number.
00550
00551     Format Model:
00552       IMKERNEL
00553       Description up to 512 characters
00554       width height
00555       type (0 - IM_INT, 1 - IM_FLOAT)
00556       data...
00557
00558     Example:
00559       IMKERNEL
00560       Gradian
00561       3 3
00562       0
00563       0 -1 0
00564       0  1 0
00565       0  0 0
00566 \endverbatim
00567  * \ingroup format */
00568 void imFormatRegisterKRN(void);
00569
00570
00571 #if defined(__cplusplus)
00572 }
00573 #endif
00574
00575 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_avi.h Source File

im_format_avi.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Register the AVI Format
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_FORMAT_AVI_H
00008 #define __IM_FORMAT_AVI_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014 /** \defgroup avi AVI - Windows Audio-Video Interleaved RIFF
00015  * \section Description
00016  *
00017  * \par
00018  * Windows Copyright Microsoft Corporation.
00019  * \par
00020  * Access to the AVI format uses Windows AVIFile library. Available in Windows Only. \n
00021  * When writing a new file you must use an ".avi" extension, or the Windows API will fail. \n
00022  * You must link the application with "im_avi.lib"
00023  * and you must call the function \ref imFormatRegisterAVI once
00024  * to register the format into the IM core library.
00025  * In Lua call require"imlua_avi". \n
00026  * Depends also on the VFW library (vfw32.lib).
00027  * When using the "im_avi.dll" this extra library is not necessary. \n
00028  * If using Cygwin or MingW must link with "-lvfw32".
00029  * Old versions of Cygwin and MingW use the "-lvfw_ms32" and "-lvfw_avi32".
00030  * \par
00031  * See \ref im_format_avi.h
00032  *
00033  * \section Features
00034  *
00035 \verbatim
00036     Data Types: Byte
00037     Color Spaces: RGB, MAP and Binary (Gray saved as MAP)
00038     Compressions (installed in Windows XP by default):
00039       NONE     - no compression [default]
00040       RLE      - Microsoft RLE (8bpp only)
00041       CINEPACK - Cinepak Codec by Radius
00042       MSVC     - Microsoft Video 1 (old)
00043       M261     - Microsoft H.261 Video Codec
00044       M263     - Microsoft H.263 Video Codec
00045       I420     - Intel 4:2:0 Video Codec (same as M263)
00046       IV32     - Intel Indeo Video Codec 3.2 (old)
00047       IV41     - Intel Indeo Video Codec 4.5 (old)
00048       IV50     - Intel Indeo Video 5.1
00049       IYUV     - Intel IYUV Codec
00050       MPG4     - Microsoft MPEG-4 Video Codec V1 (not MPEG-4 compliant) (old)
00051       MP42     - Microsoft MPEG-4 Video Codec V2 (not MPEG-4 compliant)
00052       CUSTOM   - (show compression dialog)
00053       DIVX     - DivX 5.0.4 Codec (DivX must be installed)
00054       (others, must be the 4 charaters of the fourfcc code)
00055     Can have more than one image.
00056     Can have an alpha channel (only for RGB)
00057     Internally the components are always packed.
00058     Lines arranged from top down to bottom or bottom up to top. But are saved always as bottom up.
00059     Handle(0) returns NULL. imBinFile is not supported.
00060     Handle(1) returns PAVIFILE.
00061     Handle(2) returns PAVISTREAM.
00062
00063     Attributes:
00064       FPS IM_FLOAT (1) (should set when writing, default 15)
00065       AVIQuality IM_INT (1) [1-10000, default -1] (write only) [unsed if compression=CUSTOM]
00066       KeyFrameRate IM_INT (1) (write only) [key frame frequency, if 0 not using key frames, default 15, unsed if compression=CUSTOM]
00067       DataRate IM_INT (1) (write only) [kilobits/second, default 2400, unsed if compression=CUSTOM]
00068
00069     Comments:
00070       Reads only the first video stream. Other streams are ignored.
00071       All the images have the same size, you must call imFileReadImageInfo/imFileWriteImageInfo
00072         at least once.
00073       For codecs comparsion and download go to:
00074         http://graphics.lcs.mit.edu/~tbuehler/video/codecs/
00075         http://www.fourcc.org
00076 \endverbatim
00077  * \ingroup format */
00078
00079 /** Register the AVI Format. \n
00080  * In Lua, when using require"imlua_avi" this function will be automatically called.
00081  * \ingroup avi */
00082 void imFormatRegisterAVI(void);
00083
00084 #if defined(__cplusplus)
00085 }
00086 #endif
00087
00088 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_ecw.h File Reference

Functions

im_format_ecw.h File Reference

Register the ECW Format. More...

Go to the source code of this file.

Functions

void imFormatRegisterECW (void)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_ecw.h Source File

im_format_ecw.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Register the ECW Format
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_FORMAT_ECW_H
00008 #define __IM_FORMAT_ECW_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014 /** \defgroup ecw ECW - ECW JPEG 2000
00015  * \section Description
00016  *
00017  * \par
00018  * ECW JPEG 2000 Copyright 1998 Earth Resource Mapping Ltd.
00019  * Two formats are supported with this module. The ECW (Enhanced Compression Wavelet) format and the ISO JPEG 2000 format.
00020  * \par
00021  * Access to the ECW format uses the ECW JPEG 2000 SDK version 3.3.
00022  * Available in Windows, Linux and Solaris Only. But source code is also available. \n
00023  * You must link the application with "im_ecw.lib"
00024  * and you must call the function \ref imFormatRegisterECW once
00025  * to register the format into the IM core library. \n
00026  * Depends also on the ECW JPEG 2000 SDK libraries (NCSEcw.lib).
00027  * \par
00028  * When using other JPEG 2000 libraries the first registered library will be used to guess the file format.
00029  * Use the extension *.ecw to shortcut to this implementation of the JPEG 2000 format.
00030  * \par
00031  * See \ref im_format_ecw.h
00032  * \par
00033  * \par
00034  * http://www.ermapper.com/ecw/ \n
00035  * The three types of licenses available for the ECW JPEG 2000 SDK are as follows:
00036 \verbatim
00037    - ECW JPEG 2000 SDK Free Use License Agreement - This license governs the free use of
00038      the ECW JPEG 2000 SDK with Unlimited Decompression and Limited Compression (Less
00039      than 500MB).
00040    - ECW JPEG 2000 SDK Public Use License Agreement - This license governs the use of the
00041      ECW SDK with Unlimited Decompression and Unlimited Compression for applications
00042      licensed under a GNU General Public style license.
00043    - ECW JPEG 2000 SDK Commercial Use License Agreement - This license governs the use
00044      of the ECW JPEG 2000 SDK with Unlimited Decompression and Unlimited Compression
00045      for commercial applications.
00046 \endverbatim
00047  *
00048  * \section Features
00049  *
00050 \verbatim
00051     Data Types: Byte, UShort, Float
00052     Color Spaces: BINARY, GRAY, RGB, YCBCR
00053     Compressions:
00054       ECW - Enhanced Compression Wavelet
00055       JPEG-2000 - ISO JPEG 2000
00056     Only one image.
00057     Can have an alpha channel
00058     Internally the components are always packed.
00059     Lines arranged from top down to bottom.
00060     Handle() returns NCSFileView* when reading, NCSEcwCompressClient* when writing.
00061
00062     Attributes:
00063       CompressionRatio   IM_FLOAT (1) [example: Ratio=7 just like 7:1]
00064       OriginX, OriginY   IM_FLOAT (1)
00065       Rotation           IM_FLOAT (1)
00066       CellIncrementX, CellIncrementY    IM_FLOAT (1)
00067       CellUnits (string)
00068       Datum (string)
00069       Projection (string)
00070       ViewWidth, ViewHeight                    IM_INT (1)    [view zoom]
00071       ViewXmin, ViewYmin, ViewXmax, ViewYmax   IM_INT (1)    [view limits]
00072       MultiBandCount IM_USHORT (1)    [Number of bands in a multiband gray image.]
00073       MultiBandSelect IM_USHORT (1)   [Band number to read one band of a multiband gray image. Must be set before reading image info.]
00074
00075     Comments:
00076       Only read support is implemented.
00077       To read a region of the image you must set the View* attributes before reading the image data.
00078       After reading a partial image the width and height returned in ReadImageInfo is the view size.
00079       The view limits define the region to be read.
00080       The view size is the actual size of the image, so the result can be zoomed.
00081 \endverbatim
00082  * \ingroup format */
00083
00084 /** Register the ECW Format
00085  * \ingroup ecw */
00086 void imFormatRegisterECW(void);
00087
00088
00089 #if defined(__cplusplus)
00090 }
00091 #endif
00092
00093 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_jp2.h Source File

im_format_jp2.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Register the JP2 Format
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_FORMAT_JP2_H
00008 #define __IM_FORMAT_JP2_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014
00015 /** \defgroup jp2 JP2 - JPEG-2000 JP2 File Format
00016  * \section Description
00017  *
00018  * \par
00019  * ISO/IEC 15444 (2000, 2003)\n
00020  * http://www.jpeg.org/
00021  * \par
00022  * You must link the application with "im_jp2.lib"
00023  * and you must call the function \ref imFormatRegisterJP2 once
00024  * to register the format into the IM core library.
00025  * In Lua call require"imlua_jp2". \n
00026  * \par
00027  * Access to the JPEG2000 file format uses libJasper version 1.900.1 \n
00028  * http://www.ece.uvic.ca/~mdadams/jasper                             \n
00029  * Copyright (c) 2001-2006 Michael David Adams.                       \n
00030  * and GeoJasPer 1.4.0                                                \n
00031  * Copyright (c) 2003-2007 Dmitry V. Fedorov.                         \n
00032  * http://www.dimin.net/software/geojasper/                           \n
00033  *
00034  * \par
00035  * See \ref im_format_jp2.h
00036  *
00037  * \section Features
00038  *
00039 \verbatim
00040     Data Types: Byte and UShort
00041     Color Spaces: Binary, Gray, RGB, YCbCr, Lab and XYZ
00042     Compressions:
00043       JPEG-2000 - ISO JPEG 2000  [default]
00044     Only one image.
00045     Can have an alpha channel.
00046     Internally the components are always unpacked.
00047     Internally the lines are arranged from top down to bottom.
00048     Handle(1) returns jas_image_t*
00049     Handle(2) returns jas_stream_t*
00050
00051     Attributes:
00052       CompressionRatio IM_FLOAT (1) [write only, example: Ratio=7 just like 7:1]
00053       GeoTIFFBox IM_BYTE (n)
00054       XMLPacket IM_BYTE (n)
00055
00056     Comments:
00057       We read code stream syntax and JP2, but we write always as JP2.
00058       Used definitions EXCLUDE_JPG_SUPPORT,EXCLUDE_MIF_SUPPORT,
00059                        EXCLUDE_PNM_SUPPORT,EXCLUDE_RAS_SUPPORT,
00060                        EXCLUDE_BMP_SUPPORT,EXCLUDE_PGX_SUPPORT
00061       Changed jas_config.h to match our needs.
00062       New file jas_binfile.c
00063       Changed base/jas_stream.c to export jas_stream_create and jas_stream_initbuf.
00064       Changed jp2/jp2_dec.c and jpc/jpc_cs.c to remove "uint" and "ulong" usage.
00065       The counter is restarted many times, because it has many phases.
00066 \endverbatim
00067  * \ingroup format */
00068
00069 /** Register the JP2 Format. \n
00070  * In Lua, when using require"imlua_jp2" this function will be automatically called.
00071  * \ingroup jp2 */
00072 void imFormatRegisterJP2(void);
00073
00074
00075 #if defined(__cplusplus)
00076 }
00077 #endif
00078
00079 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_raw.h Source File

im_format_raw.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Initialize the RAW Format Driver
00003  * Header for internal use only.
00004  *
00005  * See Copyright Notice in im_lib.h
00006  */
00007
00008 #ifndef __IM_FORMAT_RAW_H
00009 #define __IM_FORMAT_RAW_H
00010
00011 #if     defined(__cplusplus)
00012 extern "C" {
00013 #endif
00014
00015 /** \defgroup raw RAW - RAW File
00016  *
00017  * \par
00018  * The file must be open/created with the functions \ref imFileOpenRaw and \ref imFileNewRaw.
00019  *
00020  * \section Description
00021  *
00022  * \par
00023  * Internal Implementation.
00024  * \par
00025  * Supports RAW binary images. This is an unstructured and uncompressed binary data.
00026  * It is NOT a Camera RAW file generated in many professional digital cameras. \n
00027  * You must know image parameters a priori and must set the IM_INT attributes "Width", "Height", "ColorMode", "DataType"
00028  * before the imFileReadImageInfo/imFileWriteImageInfo functions.
00029  * \par
00030  * The data must be in binary form, but can start in an arbitrary offset from the begining of the file, use attribute "StartOffset".
00031  * The default is at 0 offset.
00032  * \par
00033  * Integer sign and double precision can be converted using attribute "SwitchType". \n
00034  * The conversions will be BYTE<->CHAR, USHORT<->SHORT, INT<->UINT, FLOAT<->DOUBLE.
00035  * \par
00036  * Byte Order can be Little Endian (Intel=1) or Big Endian (Motorola=0), use the attribute "ByteOrder", the default is the current CPU.
00037  * \par
00038  * The lines can be aligned to a BYTE (1), WORD (2) or DWORD (4) boundaries, ue attribute "Padding" with the respective value.
00039  * \par
00040  * If the compression is ASCII the data is stored in textual format, instead of binary.
00041  * In this case SwitchType and ByteOrder are ignored, and Padding should be 0.
00042  * \par
00043  * See \ref im_raw.h
00044  *
00045  * \section Features
00046  *
00047 \verbatim
00048     Data Types: <all>
00049     Color Spaces: all, except MAP.
00050     Compressions:
00051       NONE - no compression [default]
00052       ASCII (textual data)
00053     Can have more than one image, depends on "StartOffset" attribute.
00054     Can have an alpha channel.
00055     Components can be packed or not.
00056     Lines arranged from top down to bottom or bottom up to top.
00057
00058     Attributes:
00059       Width, Height, ColorMode, DataType IM_INT (1)
00060       ImageCount[1], StartOffset[0], SwitchType[FALSE], ByteOrder[IM_LITTLEENDIAN], Padding[0]  IM_INT (1)
00061
00062     Comments:
00063       In fact ASCII is an expansion, not a compression, because the file will be larger than binary data.
00064 \endverbatim
00065  * \ingroup format */
00066 imFormat* imFormatInitRAW(void);
00067
00068 void imFormatFinishRAW(void);
00069
00070 #if defined(__cplusplus)
00071 }
00072 #endif
00073
00074 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_format_wmv.h Source File

im_format_wmv.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Register the WMF Format
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_FORMAT_WMV_H
00008 #define __IM_FORMAT_WMV_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014 /** \defgroup wmv WMV - Windows Media Video Format
00015  * \section Description
00016  *
00017  * \par
00018  * Advanced Systems Format (ASF) \n
00019  * Windows Copyright Microsoft Corporation.
00020  * \par
00021  * Access to the WMV format uses Windows Media SDK. Available in Windows Only. \n
00022  * You must link the application with "im_wmv.lib"
00023  * and you must call the function \ref imFormatRegisterWMV once
00024  * to register the format into the IM core library.
00025  * In Lua call require"imlua_wmv". \n
00026  * Depends also on the WMF SDK (wmvcore.lib).
00027  * When using the "im_wmv.dll" this extra library is not necessary.
00028  * \par
00029  * The application users should have the WMV codec 9 installed:
00030  * http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx
00031  * \par
00032  * You must agree with the WMF SDK EULA to use the SDK. \n
00033  * http://wmlicense.smdisp.net/v9sdk/
00034  * \par
00035  * For more information: \n
00036  * http://www.microsoft.com/windows/windowsmedia/9series/sdk.aspx \n
00037  * http://msdn.microsoft.com/library/en-us/wmform/htm/introducingwindowsmediaformat.asp
00038  * \par
00039  * See \ref im_format_wmv.h
00040  *
00041  * \section Features
00042  *
00043 \verbatim
00044     Data Types: Byte
00045     Color Spaces: RGB and MAP (Gray and Binary saved as MAP)
00046     Compressions (installed in Windows XP by default):
00047       NONE       - no compression
00048       MPEG-4v3   - Windows Media MPEG-4 Video V3
00049       MPEG-4v1   - ISO MPEG-4 Video V1
00050       WMV7       - Windows Media Video  V7
00051       WMV7Screen - Windows Media Screen V7
00052       WMV8       - Windows Media Video  V8
00053       WMV9Screen - Windows Media Video 9 Screen
00054       WMV9       - Windows Media Video 9 [default]
00055       Unknown    - Others
00056     Can have more than one image.
00057     Can have an alpha channel (only for RGB) ?
00058     Internally the components are always packed.
00059     Lines arranged from top down to bottom or bottom up to top.
00060     Handle(0) return NULL. imBinFile is not supported.
00061     Handle(1) returns IWMSyncReader* when reading, IWMWriter* when writing.
00062
00063     Attributes:
00064       FPS IM_FLOAT (1) (should set when writing, default 15)
00065       WMFQuality IM_INT (1) [0-100, default 50] (write only)
00066       MaxKeyFrameTime IM_INT (1) (write only) [maximum key frame interval in miliseconds, default 5 seconds]
00067       DataRate IM_INT (1) (write only) [kilobits/second, default 2400]
00068       VBR IM_INT (1) [0, 1] (write only) [0 - Constant Bit Rate (default), 1 - Variable Bit Rate (Quality-Based)]
00069       (and several others from the file-level attributes) For ex:
00070         Title, Author, Copyright, Description (string)
00071         Duration IM_INT [100-nanosecond units]
00072         Seekable, HasAudio, HasVideo, Is_Protected, Is_Trusted, IsVBR IM_INT (1) [0, 1]
00073         NumberOfFrames IM_INT (1)
00074
00075     Comments:
00076       IMPORTANT - The "image_count" and the "FPS" attribute may not be available from the file,
00077         we try to estimate from the duration and from the average time between frames, or using the default value.
00078       We do not handle DRM protected files (Digital Rights Management).
00079       Reads only the first video stream. Other streams are ignored.
00080       All the images have the same size, you must call imFileReadImageInfo/imFileWriteImageInfo
00081         at least once.
00082       For optimal random reading, the file should be indexed previously.
00083       If not indexed by frame, random positioning may not be precise.
00084       Sequencial reading will always be precise.
00085       When writing we use a custom profile and time indexing only.
00086       We do not support multipass encoding.
00087       Since the driver uses COM, CoInitialize(NULL) and CoUninitialize() are called every Open/Close.
00088 \endverbatim
00089  * \ingroup format */
00090
00091 /** Register the WMF Format. \n
00092  * In Lua, when using require"imlua_wmv" this function will be automatically called.
00093  * \ingroup wmv */
00094 void imFormatRegisterWMV(void);
00095
00096
00097 #if defined(__cplusplus)
00098 }
00099 #endif
00100
00101 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_image.h Source File

im_image.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Image Manipulation
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_IMAGE_H
00008 #define __IM_IMAGE_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014
00015 /** \defgroup imgclass imImage
00016  *
00017  * \par
00018  *  Base definitions and functions for image representation. \n
00019  * Only the image processing operations depends on these definitions,
00020  * Image Storage and Image Capture are completely independent.
00021  * \par
00022  * You can also initialize a structure with your own memory buffer, see \ref imImageInit.
00023  * To release the structure without releasing the buffer,
00024  * set "data[0]" to NULL before calling imImageDestroy.
00025  * \par
00026  * See \ref im_image.h
00027  * \ingroup imagerep */
00028
00029
00030
00031 /** \brief imImage Structure Definition.
00032  *
00033  * \par
00034  * An image representation than supports all the color spaces,
00035  * but planes are always unpacked and the orientation is always bottom up.
00036  * \ingroup imgclass */
00037 typedef struct _imImage
00038 {
00039   /* main parameters */
00040   int width;          /**< Number of columns. image:Width() -> width: number [in Lua 5]. */
00041   int height;         /**< Number of lines. image:Height() -> height: number [in Lua 5]. */
00042   int color_space;    /**< Color space descriptor. See also \ref imColorSpace. image:ColorSpace() -> color_space: number [in Lua 5]. */
00043   int data_type;      /**< Data type descriptor. See also \ref imDataType. image:DataType() -> data_type: number [in Lua 5]. */
00044   int has_alpha;      /**< Indicates that there is an extra channel with alpha. image:HasAlpha() -> has_alpha: boolean [in Lua 5]. \n
00045                            It will not affect the secondary parameters, i.e. the number of planes will be in fact depth+1. \n
00046                            It is always 0 unless imImageAddAlpha is called, this is done in image load functions. */
00047
00048   /* secondary parameters */
00049   int depth;          /**< Number of planes                      (ColorSpaceDepth)   image:Depth() -> depth: number [in Lua 5].       */
00050   int line_size;      /**< Number of bytes per line in one plane (width * DataTypeSize)    */
00051   int plane_size;     /**< Number of bytes per plane.            (line_size * height)      */
00052   int size;           /**< Number of bytes occupied by the image (plane_size * depth)      */
00053   int count;          /**< Number of pixels                      (width * height)          */
00054
00055   /* image data */
00056   void** data;        /**< Image data organized as a 2D matrix with several planes.   \n
00057                            But plane 0 is also a pointer to the full data.            \n
00058                            The remaining planes are: data[i] = data[0] + i*plane_size \n
00059                            In Lua, data indexing is possible using: image[plane][row][column] */
00060
00061   /* image attributes */
00062   long *palette;      /**< Color palette. image:GetPalette() -> palette: imPalette [in Lua 5]. \n
00063                            Used when depth=1. Otherwise is NULL. */
00064   int palette_count;  /**< The palette is always 256 colors allocated, but can have less colors used. */
00065
00066   void* attrib_table; /**< in fact is an imAttribTable, but we hide this here */
00067 } imImage;
00068
00069
00070 /** Creates a new image.
00071  * See also \ref imDataType and \ref imColorSpace. Image data is cleared as \ref imImageClear. \n
00072  * In Lua the IM image metatable name is "imImage".
00073  * When converted to a string will return "imImage(%p) [width=%d,height=%d,color_space=%s,data_type=%s,depth=%d]" where %p is replaced by the userdata address,
00074  * and other values are replaced by the respective attributes.
00075  * If the image is already destroyed by im.ImageDestroy, then it will return also the suffix "-destroyed".
00076  *
00077  * \verbatim im.ImageCreate(width: number, height: number, color_space: number, data_type: number) -> image: imImage [in Lua 5] \endverbatim
00078  * \ingroup imgclass */
00079 imImage* imImageCreate(int width, int height, int color_space, int data_type);
00080
00081 /** Initializes the image structure but does not allocates image data.
00082  * See also \ref imDataType and \ref imColorSpace.
00083  * \ingroup imgclass */
00084 imImage* imImageInit(int width, int height, int color_space, int data_type, void* data_buffer, long* palette, int palette_count);
00085
00086 /** Creates a new image based on an existing one. \n
00087  * If the addicional parameters are -1, the given image parameters are used. \n
00088  * The image atributes always are copied. HasAlpha is copied.
00089  * See also \ref imDataType and \ref imColorSpace.
00090  *
00091  * \verbatim im.ImageCreateBased(image: imImage, [width: number], [height: number], [color_space: number], [data_type: number]) -> image: imImage [in Lua 5] \endverbatim
00092  * The addicional parameters in Lua can be nil,
00093  * and they can also be functions with the based image as a parameter to return the respective value.
00094  * \ingroup imgclass */
00095 imImage* imImageCreateBased(const imImage* image, int width, int height, int color_space, int data_type);
00096
00097 /** Destroys the image and frees the memory used.
00098  * image data is destroyed only if its data[0] is not NULL. \n
00099  * In Lua if this function is not called, the image is destroyed by the garbage collector.
00100  *
00101  * \verbatim im.ImageDestroy(image: imImage) [in Lua 5] \endverbatim
00102  * \verbatim image:Destroy() [in Lua 5] \endverbatim
00103  * \ingroup imgclass */
00104 void imImageDestroy(imImage* image);
00105
00106 /** Adds an alpha channel plane and sets its value to 0 (transparent).
00107  *
00108  * \verbatim image:AddAlpha() [in Lua 5] \endverbatim
00109  * \ingroup imgclass */
00110 void imImageAddAlpha(imImage* image);
00111
00112 /** Sets the alpha channel plane to a constant.
00113  *
00114  * \verbatim image:SetAlpha() [in Lua 5] \endverbatim
00115  * \ingroup imgclass */
00116 void imImageSetAlpha(imImage* image, float alpha);
00117
00118 /** Changes the buffer size. Reallocate internal buffers if the new size is larger than the original.
00119  *
00120  * \verbatim image:Reshape(width: number, height: number) [in Lua 5] \endverbatim
00121  * \ingroup imgclass */
00122 void imImageReshape(imImage* image, int width, int height);
00123
00124 /** Copy image data and attributes from one image to another. \n
00125  * Images must have the same size and type.
00126  *
00127  * \verbatim image:Copy(dst_image: imImage) [in Lua 5] \endverbatim
00128  * \ingroup imgclass */
00129 void imImageCopy(const imImage* src_image, imImage* dst_image);
00130
00131 /** Copy image data only fom one image to another. \n
00132  * Images must have the same size and type.
00133  *
00134  * \verbatim image:CopyData(dst_image: imImage) [in Lua 5] \endverbatim
00135  * \ingroup imgclass */
00136 void imImageCopyData(const imImage* src_image, imImage* dst_image);
00137
00138 /** Copies the image attributes from src to dst.
00139  * Includes the pallete when a MAP or GRAY image.
00140  *
00141  * \verbatim image:CopyAttributes(dst_image: imImage) [in Lua 5] \endverbatim
00142  * \ingroup imgclass */
00143 void imImageCopyAttributes(const imImage* src_image, imImage* dst_image);
00144
00145 /** Copy one image plane fom one image to another. \n
00146  * Images must have the same size and type.
00147  *
00148  * \verbatim image:CopyPlane(src_plane: number, dst_image: imImage, dst_plane: number) [in Lua 5] \endverbatim
00149  * \ingroup imgclass */
00150 void imImageCopyPlane(const imImage* src_image, int src_plane, imImage* dst_image, int dst_plane);
00151
00152 /** Creates a copy of the image.
00153  *
00154  * \verbatim image:Duplicate() -> new_image: imImage [in Lua 5] \endverbatim
00155  * \ingroup imgclass */
00156 imImage* imImageDuplicate(const imImage* image);
00157
00158 /** Creates a clone of the image. i.e. same attributes but ignore contents.
00159  *
00160  * \verbatim image:Clone() -> new_image: imImage [in Lua 5] \endverbatim
00161  * \ingroup imgclass */
00162 imImage* imImageClone(const imImage* image);
00163
00164 /** Changes an extended attribute. \n
00165  * The data will be internally duplicated. \n
00166  * If data is NULL and count==0 the attribute is removed. \n
00167  * If count is -1 and data_type is IM_BYTE then data is zero terminated.
00168  * See also \ref imDataType.
00169  *
00170  * \verbatim image:SetAttribute(attrib: string, data_type: number, data: table of numbers or string) [in Lua 5] \endverbatim
00171  * If data_type is IM_BYTE, as_string can be used as data.
00172  * \ingroup imgclass */
00173 void imImageSetAttribute(const imImage* image, const char* attrib, int data_type, int count, const void* data);
00174
00175 /** Returns an extended attribute. \n
00176  * Returns NULL if not found.
00177  * See also \ref imDataType.
00178  *
00179  * \verbatim image:GetAttribute(attrib: string, [as_string: boolean]) -> data: table of numbers or string, data_type: number [in Lua 5] \endverbatim
00180  * If data_type is IM_BYTE, as_string can be used to return a string instead of a table.
00181  * \ingroup imgclass */
00182 const void* imImageGetAttribute(const imImage* image, const char* attrib, int *data_type, int *count);
00183
00184 /** Returns a list of the attribute names. \n
00185  * "attrib" must contain room enough for "attrib_count" names. Use "attrib=NULL" to return only the count.
00186  *
00187  * \verbatim image:GetAttributeList() -> data: table of strings [in Lua 5] \endverbatim
00188  * \ingroup imgclass */
00189 void imImageGetAttributeList(const imImage* image, char** attrib, int *attrib_count);
00190
00191 /** Sets all image data to zero. But if color space is YCBCR, LAB or LUV, and data type is BYTE or USHORT, then
00192  * data is initialized with 128 or 32768 accordingly. Alpha is initialized as transparent (0).
00193  *
00194  * \verbatim image:Clear() [in Lua 5] \endverbatim
00195  * \ingroup imgclass */
00196 void imImageClear(imImage* image);
00197
00198 /** Indicates that the image can be viewed in common graphic devices.
00199  * Data type must be IM_BYTE. Color mode can be IM_RGB, IM_MAP, IM_GRAY or IM_BINARY.
00200  *
00201  * \verbatim image:IsBitmap() -> is_bitmap: boolean [in Lua 5] \endverbatim
00202  * \ingroup imgclass */
00203 int imImageIsBitmap(const imImage* image);
00204
00205 /** Changes the image palette.
00206  * This will destroy the existing palette and replace it with the given palette pointer.
00207  * Only the pointer is stored, so the palette should be a new palette and it can not be a static array.
00208  *
00209  * \verbatim image:SetPalette(palette: imPalette) [in Lua 5] \endverbatim
00210  * \ingroup imgclass */
00211 void imImageSetPalette(imImage* image, long* palette, int palette_count);
00212
00213 /** Returns 1 if the images match width and height. Returns 0 otherwise.
00214  *
00215  * \verbatim image:MatchSize(image2: imImage) -> match: boolean [in Lua 5] \endverbatim
00216  * \ingroup imgclass */
00217 int imImageMatchSize(const imImage* image1, const imImage* image2);
00218
00219 /** Returns 1 if the images match color mode and data type. Returns 0 otherwise.
00220  *
00221  * \verbatim image:MatchColor(image2: imImage) -> match: boolean [in Lua 5] \endverbatim
00222  * \ingroup imgclass */
00223 int imImageMatchColor(const imImage* image1, const imImage* image2);
00224
00225 /** Returns 1 if the images match width, height and data type. Returns 0 otherwise.
00226  *
00227  * \verbatim image:MatchDataType(image2: imImage) -> match: boolean [in Lua 5] \endverbatim
00228  * \ingroup imgclass */
00229 int imImageMatchDataType(const imImage* image1, const imImage* image2);
00230
00231 /** Returns 1 if the images match width, height and color space. Returns 0 otherwise.
00232  *
00233  * \verbatim image:MatchColorSpace(image2: imImage) -> match: boolean [in Lua 5] \endverbatim
00234  * \ingroup imgclass */
00235 int imImageMatchColorSpace(const imImage* image1, const imImage* image2);
00236
00237 /** Returns 1 if the images match in width, height, data type and color space. Returns 0 otherwise.
00238  *
00239  * \verbatim image:Match(image2: imImage) -> match: boolean [in Lua 5] \endverbatim
00240  * \ingroup imgclass */
00241 int imImageMatch(const imImage* image1, const imImage* image2);
00242
00243 /** Changes the image color space from gray to binary by just changing color_space and the palette.
00244  *
00245  * \verbatim image:SetBinary() [in Lua 5] \endverbatim
00246  * \ingroup imgclass */
00247 void imImageSetBinary(imImage* image);
00248
00249 /** Changes a gray BYTE data (0,255) into a binary data (0,1), done in-place. Color space is not changed.
00250  *
00251  * \verbatim image:MakeBinary() [in Lua 5] \endverbatim
00252  * \ingroup imgclass */
00253 void imImageMakeBinary(imImage *image);
00254
00255 /** Changes a binary data (0,1) into a gray BYTE data (0,255), done in-place. Color space is not changed.
00256  *
00257  * \verbatim image:MakeGray() [in Lua 5] \endverbatim
00258  * \ingroup imgclass */
00259 void imImageMakeGray(imImage *image);
00260
00261
00262
00263 /** \defgroup imgfile imImage Storage
00264  *
00265  * \par
00266  *  Functions to simplify the process of reading and writting imImage structures.
00267  *  Will also load and save the alpha planes when possible.
00268  * \par
00269  * See \ref im_image.h
00270  * \ingroup file */
00271
00272
00273 /** Loads an image from an already open file. Returns NULL if failed. \n
00274  * This will call \ref imFileReadImageInfo and \ref imFileReadImageData. \n
00275  * index specifies the image number between 0 and image_count-1. \n
00276  * The returned image will be of the same color_space and data_type of the image in the file. \n
00277  * Attributes from the file will be stored at the image.
00278  * See also \ref imErrorCodes.
00279  *
00280  * \verbatim ifile:LoadImage([index: number]) -> image: imImage, error: number [in Lua 5] \endverbatim
00281  * Default index is 0.
00282  * \ingroup imgfile */
00283 imImage* imFileLoadImage(imFile* ifile, int index, int *error);
00284
00285 /** Loads an image from an already open file. Returns NULL if failed. \n
00286  * This function assumes that the image in the file has the same parameters as the given image. \n
00287  * This will call \ref imFileReadImageInfo and \ref imFileReadImageData. \n
00288  * index specifies the image number between 0 and image_count-1. \n
00289  * The returned image will be of the same color_space and data_type of the image in the file. \n
00290  * Attributes from the file will be stored at the image.
00291  * See also \ref imErrorCodes.
00292  *
00293  * \verbatim ifile:LoadImageFrame(index: number, image: imImage) -> error: number [in Lua 5] \endverbatim
00294  * Default index is 0.
00295  * \ingroup imgfile */
00296 void imFileLoadImageFrame(imFile* ifile, int index, imImage* image, int *error);
00297
00298 /** Loads an image from an already open file, but forces the image to be a bitmap.\n
00299  * The returned imagem will be always a Bitmap image, with color_space RGB, MAP, GRAY or BINARY, and data_type IM_BYTE. \n
00300  * index specifies the image number between 0 and image_count-1. \n
00301  * Returns NULL if failed.
00302  * Attributes from the file will be stored at the image.
00303  * See also \ref imErrorCodes.
00304  *
00305  * \verbatim ifile:LoadBitmap([index: number]) -> image: imImage, error: number [in Lua 5] \endverbatim
00306  * Default index is 0.
00307  * \ingroup imgfile */
00308 imImage* imFileLoadBitmap(imFile* ifile, int index, int *error);
00309
00310 /** Loads an image region from an already open file. Returns NULL if failed. \n
00311  * This will call \ref imFileReadImageInfo and \ref imFileReadImageData. \n
00312  * index specifies the image number between 0 and image_count-1. \n
00313  * The returned image will be of the same color_space and data_type of the image in the file,
00314  * or will be a Bitmap image. \n
00315  * Attributes from the file will be stored at the image.
00316  * See also \ref imErrorCodes. \n
00317  * For now, it works only for the ECW file format.
00318  *
00319  * \verbatim ifile:LoadRegion(index, bitmap, xmin, xmax, ymin, ymax, width, height: number) -> image: imImage, error: number [in Lua 5] \endverbatim
00320  * Default index is 0.
00321  * \ingroup imgfile */
00322 imImage* imFileLoadImageRegion(imFile* ifile, int index, int bitmap, int *error,
00323                                int xmin, int xmax, int ymin, int ymax, int width, int height);
00324
00325 /** Loads an image from an already open file, but forces the image to be a bitmap.\n
00326  * This function assumes that the image in the file has the same parameters as the given image. \n
00327  * The imagem must be a Bitmap image, with color_space RGB, MAP, GRAY or BINARY, and data_type IM_BYTE. \n
00328  * index specifies the image number between 0 and image_count-1. \n
00329  * Returns NULL if failed.
00330  * Attributes from the file will be stored at the image.
00331  * See also \ref imErrorCodes.
00332  *
00333  * \verbatim ifile:LoadBitmapFrame(index: number, image: imImage) -> error: number [in Lua 5] \endverbatim
00334  * Default index is 0.
00335  * \ingroup imgfile */
00336 void imFileLoadBitmapFrame(imFile* ifile, int index, imImage* image, int *error);
00337
00338 /** Saves the image to an already open file. \n
00339  * This will call \ref imFileWriteImageInfo and \ref imFileWriteImageData. \n
00340  * Attributes from the image will be stored at the file.
00341  * Returns error code.
00342  *
00343  * \verbatim ifile:SaveImage(image: imImage) -> error: number [in Lua 5] \endverbatim
00344  * \ingroup imgfile */
00345 int imFileSaveImage(imFile* ifile, const imImage* image);
00346
00347 /** Loads an image from file. Open, loads and closes the file. \n
00348  * index specifies the image number between 0 and image_count-1. \n
00349  * Returns NULL if failed.
00350  * Attributes from the file will be stored at the image.
00351  * See also \ref imErrorCodes.
00352  *
00353  * \verbatim im.FileImageLoad(file_name: string, [index: number]) -> image: imImage, error: number [in Lua 5] \endverbatim
00354  * Default index is 0.
00355  * \ingroup imgfile */
00356 imImage* imFileImageLoad(const char* file_name, int index, int *error);
00357
00358 /** Loads an image from file, but forces the image to be a bitmap. Open, loads and closes the file. \n
00359  * index specifies the image number between 0 and image_count-1. \n
00360  * Returns NULL if failed.
00361  * Attributes from the file will be stored at the image.
00362  * See also \ref imErrorCodes.
00363  *
00364  * \verbatim im.FileImageLoadBitmap(file_name: string, [index: number]) -> image: imImage, error: number [in Lua 5] \endverbatim
00365  * Default index is 0.
00366  * \ingroup imgfile */
00367 imImage* imFileImageLoadBitmap(const char* file_name, int index, int *error);
00368
00369 /** Loads an image region from file. Open, loads and closes the file. \n
00370  * index specifies the image number between 0 and image_count-1. \n
00371  * Returns NULL if failed.
00372  * Attributes from the file will be stored at the image.
00373  * See also \ref imErrorCodes. \n
00374  * For now, it works only for the ECW file format.
00375  *
00376  * \verbatim im.FileImageLoadRegion(file_name: string, index, bitmap, xmin, xmax, ymin, ymax, width, height: number, ) -> image: imImage, error: number [in Lua 5] \endverbatim
00377  * Default index is 0.
00378  * \ingroup imgfile */
00379 imImage* imFileImageLoadRegion(const char* file_name, int index, int bitmap, int *error,
00380                                int xmin, int xmax, int ymin, int ymax, int width, int height);
00381
00382 /** Saves the image to file. Open, saves and closes the file. \n
00383  * Returns error code. \n
00384  * Attributes from the image will be stored at the file.
00385  *
00386  * \verbatim im.FileImageSave(file_name: string, format: string, image: imImage) -> error: number [in Lua 5] \endverbatim
00387  * \verbatim image:Save(file_name: string, format: string) -> error: number [in Lua 5] \endverbatim
00388  * \ingroup imgfile */
00389 int imFileImageSave(const char* file_name, const char* format, const imImage* image);
00390
00391
00392
00393 /** Utility macro to draw the image in a CD library canvas.
00394  * Works only for data_type IM_BYTE, and color spaces: IM_RGB, IM_MAP, IMGRAY and IM_BINARY.
00395  * \ingroup imgclass */
00396 #define imcdCanvasPutImage(_canvas, _image, _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax)     \
00397   {                                                                         \
00398     if (_image->color_space == IM_RGB)                                      \
00399     {                                                                       \
00400       if (_image->has_alpha)                                                \
00401         cdCanvasPutImageRectRGBA(_canvas, _image->width, _image->height,    \
00402                           (unsigned char*)_image->data[0],                  \
00403                           (unsigned char*)_image->data[1],                  \
00404                           (unsigned char*)_image->data[2],                  \
00405                           (unsigned char*)_image->data[3],                  \
00406                           _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax);      \
00407       else                                                                  \
00408         cdCanvasPutImageRectRGB(_canvas, _image->width, _image->height,     \
00409                           (unsigned char*)_image->data[0],                  \
00410                           (unsigned char*)_image->data[1],                  \
00411                           (unsigned char*)_image->data[2],                  \
00412                           _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax);      \
00413     }                                                                       \
00414     else                                                                    \
00415       cdCanvasPutImageRectMap(_canvas, _image->width, _image->height,       \
00416                         (unsigned char*)_image->data[0], _image->palette,   \
00417                         _x, _y, _w, _h, _xmin, _xmax, _ymin, _ymax);        \
00418   }
00419
00420
00421 #if     defined(__cplusplus)
00422 }
00423 #endif
00424
00425 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_kernel.h File Reference

Functions

im_kernel.h File Reference

Kernel Generators Creates several known kernels. More...

Go to the source code of this file.

Functions

imImage * | imKernelSobel (void)
imImage * | imKernelPrewitt (void)
imImage * | imKernelKirsh (void)
imImage * | imKernelLaplacian4 (void)
imImage * | imKernelLaplacian8 (void)
imImage * | imKernelLaplacian5x5 (void)
imImage * | imKernelLaplacian7x7 (void)
imImage * | imKernelGradian3x3 (void)
imImage * | imKernelGradian7x7 (void)
imImage * | imKernelSculpt (void)
imImage * | imKernelMean3x3 (void)
imImage * | imKernelMean5x5 (void)
imImage * | imKernelCircularMean5x5 (void)
imImage * | imKernelMean7x7 (void)
imImage * | imKernelCircularMean7x7 (void)
imImage * | imKernelGaussian3x3 (void)
imImage * | imKernelGaussian5x5 (void)
imImage * | imKernelBarlett5x5 (void)
imImage * | imKernelTopHat5x5 (void)
imImage * | imKernelTopHat7x7 (void)
imImage * | imKernelEnhance (void)

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_kernel.h Source File

im_kernel.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Kernel Generators
00003  * Creates several known kernels
00004  *
00005  * See Copyright Notice in im_lib.h
00006  */
00007
00008 #ifndef __IM_KERNEL_H
00009 #define __IM_KERNEL_H
00010
00011 #if     defined(__cplusplus)
00012 extern "C" {
00013 #endif
00014
00015
00016 /** \defgroup kernel Kernel Generators
00017  * \par
00018  * Creates several known kernels
00019  * \par
00020  * See \ref im_kernel.h
00021  * \ingroup convolve */
00022
00023
00024 /** Creates a kernel with the following values:
00025  *
00026 \verbatim
00027    1  2  1
00028    0  0  0
00029   -1 -2 -1
00030 \endverbatim
00031  *
00032  * \verbatim im.KernelSobel() -> kernel: imImage [in Lua 5] \endverbatim
00033  * \ingroup kernel */
00034 imImage* imKernelSobel(void);
00035
00036 /** Creates a kernel with the following values:
00037  *
00038 \verbatim
00039    1  1  1
00040    0  0  0
00041   -1 -1 -1
00042 \endverbatim
00043  *
00044  * \verbatim im.KernelPrewitt() -> kernel: imImage [in Lua 5] \endverbatim
00045  * \ingroup kernel */
00046 imImage* imKernelPrewitt(void);
00047
00048 /** Creates a kernel with the following values:
00049  *
00050 \verbatim
00051    5  5  5
00052   -3  0 -3
00053   -3 -3 -3
00054 \endverbatim
00055  *
00056  * \verbatim im.KernelKirsh() -> kernel: imImage [in Lua 5] \endverbatim
00057  * \ingroup kernel */
00058 imImage* imKernelKirsh(void);
00059
00060 /** Creates a kernel with the following values:
00061  *
00062 \verbatim
00063    0 -1  0
00064   -1  4 -1
00065    0 -1  0
00066 \endverbatim
00067  *
00068  * \verbatim im.KernelLaplacian4() -> kernel: imImage [in Lua 5] \endverbatim
00069  * \ingroup kernel */
00070 imImage* imKernelLaplacian4(void);
00071
00072 /** Creates a kernel with the following values:
00073  *
00074 \verbatim
00075   -1 -1 -1
00076   -1  8 -1
00077   -1 -1 -1
00078 \endverbatim
00079  *
00080  * \verbatim im.KernelLaplacian8() -> kernel: imImage [in Lua 5] \endverbatim
00081  * \ingroup kernel */
00082 imImage* imKernelLaplacian8(void);
00083
00084 /** Creates a kernel with the following values:
00085  *
00086 \verbatim
00087    0 -1 -1 -1  0
00088   -1  0  1  0 -1
00089   -1  1  8  1 -1
00090   -1  0  1  0 -1
00091    0 -1 -1 -1  0
00092 \endverbatim
00093  *
00094  * \verbatim im.KernelLaplacian5x5() -> kernel: imImage [in Lua 5] \endverbatim
00095  * \ingroup kernel */
00096 imImage* imKernelLaplacian5x5(void);
00097
00098 /** Creates a kernel with the following values:
00099  *
00100 \verbatim
00101   -1 -1 -1 -1 -1 -1 -1
00102   -1 -1 -1 -1 -1 -1 -1
00103   -1 -1 -1 -1 -1 -1 -1
00104   -1 -1 -1 48 -1 -1 -1
00105   -1 -1 -1 -1 -1 -1 -1
00106   -1 -1 -1 -1 -1 -1 -1
00107   -1 -1 -1 -1 -1 -1 -1
00108 \endverbatim
00109  *
00110  * \verbatim im.KernelLaplacian7x7() -> kernel: imImage [in Lua 5] \endverbatim
00111  * \ingroup kernel */
00112 imImage* imKernelLaplacian7x7(void);
00113
00114 /** Creates a kernel with the following values:
00115  *
00116 \verbatim
00117   0 -1 0
00118   0  1 0
00119   0  0 0
00120 \endverbatim
00121  *
00122  * \verbatim im.KernelGradian3x3() -> kernel: imImage [in Lua 5] \endverbatim
00123  * \ingroup kernel */
00124 imImage* imKernelGradian3x3(void);
00125
00126 /** Creates a kernel with the following values:
00127  *
00128 \verbatim
00129    0 -1 -1  0  1  1  0
00130   -1 -2 -2  0  2  2  1
00131   -1 -2 -3  0  3  2  1
00132   -1 -2 -3  0  3  2  1
00133   -1 -2 -3  0  3  2  1
00134   -1 -2 -2  0  2  2  1
00135    0 -1 -1  0  1  1  0
00136 \endverbatim
00137  *
00138  * \verbatim im.KernelGradian7x7() -> kernel: imImage [in Lua 5] \endverbatim
00139  * \ingroup kernel */
00140 imImage* imKernelGradian7x7(void);
00141
00142 /** Creates a kernel with the following values:
00143  *
00144 \verbatim
00145   -1 0 0
00146    0 0 0
00147    0 0 1
00148 \endverbatim
00149  *
00150  * \verbatim im.KernelSculpt() -> kernel: imImage [in Lua 5] \endverbatim
00151  * \ingroup kernel */
00152 imImage* imKernelSculpt(void);
00153
00154 /** Creates a kernel with the following values:
00155  *
00156 \verbatim
00157   1 1 1
00158   1 1 1
00159   1 1 1
00160 \endverbatim
00161  *
00162  * \verbatim im.KernelMean3x3() -> kernel: imImage [in Lua 5] \endverbatim
00163  * \ingroup kernel */
00164 imImage* imKernelMean3x3(void);
00165
00166 /** Creates a kernel with the following values:
00167  *
00168 \verbatim
00169   1 1 1 1 1
00170   1 1 1 1 1
00171   1 1 1 1 1
00172   1 1 1 1 1
00173   1 1 1 1 1
00174 \endverbatim
00175  *
00176  * \verbatim im.KernelMean5x5() -> kernel: imImage [in Lua 5] \endverbatim
00177  * \ingroup kernel */
00178 imImage* imKernelMean5x5(void);
00179
00180 /** Creates a kernel with the following values:
00181  *
00182 \verbatim
00183   0 1 1 1 0
00184   1 1 1 1 1
00185   1 1 1 1 1
00186   1 1 1 1 1
00187   0 1 1 1 0
00188 \endverbatim
00189  *
00190  * \verbatim im.KernelMean5x5() -> kernel: imImage [in Lua 5] \endverbatim
00191  * \ingroup kernel */
00192 imImage* imKernelCircularMean5x5(void);
00193
00194 /** Creates a kernel with the following values:
00195  *
00196 \verbatim
00197   1 1 1 1 1 1 1
00198   1 1 1 1 1 1 1
00199   1 1 1 1 1 1 1
00200   1 1 1 1 1 1 1
00201   1 1 1 1 1 1 1
00202   1 1 1 1 1 1 1
00203   1 1 1 1 1 1 1
00204 \endverbatim
00205  *
00206  * \verbatim im.KernelMean7x7() -> kernel: imImage [in Lua 5] \endverbatim
00207  * \ingroup kernel */
00208 imImage* imKernelMean7x7(void);
00209
00210 /** Creates a kernel with the following values:
00211  *
00212 \verbatim
00213   0 0 1 1 1 0 0
00214   0 1 1 1 1 1 0
00215   1 1 1 1 1 1 1
00216   1 1 1 1 1 1 1
00217   1 1 1 1 1 1 1
00218   0 1 1 1 1 1 0
00219   0 0 1 1 1 0 0
00220 \endverbatim
00221  *
00222  * \verbatim im.KernelCircularMean7x7() -> kernel: imImage [in Lua 5] \endverbatim
00223  * \ingroup kernel */
00224 imImage* imKernelCircularMean7x7(void);
00225
00226 /** Creates a kernel with the following values:
00227  *
00228 \verbatim
00229   1 2 1
00230   2 4 2
00231   1 2 1
00232 \endverbatim
00233  *
00234  * \verbatim im.KernelGaussian3x3() -> kernel: imImage [in Lua 5] \endverbatim
00235  * \ingroup kernel */
00236 imImage* imKernelGaussian3x3(void);
00237
00238 /** Creates a kernel with the following values:
00239  *
00240 \verbatim
00241   1  4  6  4 1
00242   4 16 24 16 4
00243   6 24 36 24 6
00244   4 16 24 16 4
00245   1  4  6  4 1
00246 \endverbatim
00247  *
00248  * \verbatim im.KernelGaussian5x5() -> kernel: imImage [in Lua 5] \endverbatim
00249  * \ingroup kernel */
00250 imImage* imKernelGaussian5x5(void);
00251
00252 /** Creates a kernel with the following values:
00253  *
00254 \verbatim
00255   1 2 3 2 1
00256   2 4 6 4 2
00257   3 6 9 6 3
00258   2 4 6 4 2
00259   1 2 3 2 1
00260 \endverbatim
00261  *
00262  * \verbatim im.KernelBarlett5x5() -> kernel: imImage [in Lua 5] \endverbatim
00263  * \ingroup kernel */
00264 imImage* imKernelBarlett5x5(void);
00265
00266 /** Creates a kernel with the following values:
00267  *
00268 \verbatim
00269    0 -1 -1 -1  0
00270   -1 -1  3 -1 -1
00271   -1  3  4  3 -1
00272   -1 -1  3 -1 -1
00273    0 -1 -1 -1  0
00274 \endverbatim
00275  *
00276  * \verbatim im.KernelTopHat5x5() -> kernel: imImage [in Lua 5] \endverbatim
00277  * \ingroup kernel */
00278 imImage* imKernelTopHat5x5(void);
00279
00280 /** Creates a kernel with the following values:
00281  *
00282 \verbatim
00283    0  0 -1 -1 -1  0  0
00284    0 -1 -1 -1 -1 -1  0
00285   -1 -1  3  3  3 -1 -1
00286   -1 -1  3  4  3 -1 -1
00287   -1 -1  3  3  3 -1 -1
00288    0 -1 -1 -1 -1 -1  0
00289    0  0 -1 -1 -1  0  0
00290 \endverbatim
00291  *
00292  * \verbatim im.KernelTopHat7x7() -> kernel: imImage [in Lua 5] \endverbatim
00293  * \ingroup kernel */
00294 imImage* imKernelTopHat7x7(void);
00295
00296 /** Creates a kernel with the following values:
00297  *
00298 \verbatim
00299    0 -1 -2 -1  0
00300   -1 -4  0 -4 -1
00301   -2  0 40  0 -2
00302   -1 -4  0 -4 -1
00303    0 -1 -2 -1  0
00304 \endverbatim
00305  *
00306  * \verbatim im.KernelEnhance() -> kernel: imImage [in Lua 5] \endverbatim
00307  * \ingroup kernel */
00308 imImage* imKernelEnhance(void);
00309
00310 #if defined(__cplusplus)
00311 }
00312 #endif
00313
00314 #endif
00315


IM: im_lib.h Source File

im_lib.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Library Management and Main Documentation
00003  *
00004  * See Copyright Notice in this file.
00005  */
00006
00007 #ifndef __IM_LIB_H
00008 #define __IM_LIB_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014
00015 /** \defgroup lib Library Management
00016  * \ingroup util
00017  * \par
00018  * Usefull definitions for about dialogs and
00019  * for comparing the compiled version with the linked version of the library.
00020  * \par
00021  * \verbatim im._AUTHOR [in Lua 5] \endverbatim
00022  * \verbatim im._COPYRIGHT [in Lua 5] \endverbatim
00023  * \verbatim im._VERSION [in Lua 5] \endverbatim
00024  * \verbatim im._VERSION_DATE [in Lua 5] \endverbatim
00025  * \verbatim im._VERSION_NUMBER [in Lua 5] \endverbatim
00026  * \verbatim im._DESCRIPTION [in Lua 5] \endverbatim
00027  * \verbatim im._NAME [in Lua 5] \endverbatim
00028  * \par
00029  * See \ref im_lib.h
00030  * @{
00031  */
00032 #define IM_AUTHOR "Antonio Scuri"
00033 #define IM_COPYRIGHT "Copyright (C) 1994-2010 Tecgraf, PUC-Rio."
00034 #define IM_VERSION "3.6"      /* bug fixes are reported only by imVersion functions */
00035 #define IM_VERSION_NUMBER 306000
00036 #define IM_VERSION_DATE "2010/01/26"  /* does not include bug fix releases */
00037 #define IM_DESCRIPTION "Image Representation, Storage, Capture and Processing"
00038 #define IM_NAME "IM - An Imaging Toolkit"
00039 /** @} */
00040
00041
00042 /** Returns the library current version. Returns the definition IM_VERSION plus the bug fix number.
00043  *
00044  * \verbatim im.Version() -> version: string [in Lua 5] \endverbatim
00045  * \ingroup lib */
00046 const char* imVersion(void);
00047
00048 /** Returns the library current version release date. Returns the definition IM_VERSION_DATE.
00049  *
00050  * \verbatim im.VersionDate() -> date: string [in Lua 5] \endverbatim
00051  * \ingroup lib */
00052 const char* imVersionDate(void);
00053
00054 /** Returns the library current version number. Returns the definition IM_VERSION_NUMBER plus the bug fix number. \n
00055  * Can be compared in run time with IM_VERSION_NUMBER to compare compiled and linked versions of the library.
00056  *
00057  * \verbatim im.VersionNumber() -> version: number [in Lua 5] \endverbatim
00058  * \ingroup lib */
00059 int imVersionNumber(void);
00060
00061
00062 #if defined(__cplusplus)
00063 }
00064 #endif
00065
00066
00067 /*! \mainpage IM
00068  * <CENTER>
00069  * <H3> Image Representation, Storage, Capture and Processing </H3>
00070  * Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil \n
00071  * http://www.tecgraf.puc-rio.br/im \n
00072  * mailto:im@tecgraf.puc-rio.br
00073  * </CENTER>
00074  *
00075  * \section over Overview
00076  * \par
00077  * IM is a toolkit for Digital Imaging.
00078  * \par
00079  * It provides support for image capture, several image file formats and many image processing operations.
00080  * \par
00081  * Image representation includes scientific data types (like IEEE floating point data)
00082  * and attributes (or metadata like GeoTIFF and Exif tags).
00083  * Animation, video and volumes are supported as image sequences,
00084  * but there is no digital audio support.
00085  * \par
00086  * The main goal of the library is to provide a simple API and abstraction
00087  * of images for scientific applications.
00088  * \par
00089  * The toolkit API is written in C.
00090  * The core library source code is implemented in C++ and it is very portable,
00091  * it can be compiled in Windows and UNIX with no modifications.
00092  * New image processing operations can be implemented in C or in C++.
00093  * \par
00094  * IM is free software, can be used for public and commercial applications.
00095  * \par
00096  * This work was developed at Tecgraf/PUC-Rio
00097  * by means of the partnership with PETROBRAS/CENPES.
00098  *
00099  * \section author Author
00100  * \par
00101  * Basic Software Group @ Tecgraf/PUC-Rio
00102  * - Antonio Scuri scuri@tecgraf.puc-rio.br
00103  *
00104  * \section copyright Copyright Notice
00105 \verbatim
00106
00107 ****************************************************************************
00108 Copyright (C) 1994-2010 Tecgraf, PUC-Rio.
00109
00110 Permission is hereby granted, free of charge, to any person obtaining
00111 a copy of this software and associated documentation files (the
00112 "Software"), to deal in the Software without restriction, including
00113 without limitation the rights to use, copy, modify, merge, publish,
00114 distribute, sublicense, and/or sell copies of the Software, and to
00115 permit persons to whom the Software is furnished to do so, subject to
00116 the following conditions:
00117
00118 The above copyright notice and this permission notice shall be
00119 included in all copies or substantial portions of the Software.
00120
00121 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00122 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00123 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00124 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00125 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00126 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00127 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00128 ****************************************************************************
00129 \endverbatim
00130  */
00131
00132
00133 /** \defgroup imagerep Image Representation
00134  * \par
00135  * See \ref im.h
00136  */
00137
00138
00139 /** \defgroup file Image Storage
00140  * \par
00141  * See \ref im.h
00142  */
00143
00144
00145 /** \defgroup format File Formats
00146  * \par
00147  * See \ref im.h
00148  *
00149  * Internal Predefined File Formats:
00150  * \li "BMP" - Windows Device Independent Bitmap
00151  * \li "PCX" - ZSoft Picture
00152  * \li "GIF" - Graphics Interchange Format
00153  * \li "TIFF" - Tagged Image File Format
00154  * \li "RAS" - Sun Raster File
00155  * \li "SGI" - Silicon Graphics Image File Format
00156  * \li "JPEG" - JPEG File Interchange Format
00157  * \li "LED" - IUP image in LED
00158  * \li "TGA" - Truevision Targa
00159  * \li "RAW" - RAW File
00160  * \li "PNM" - Netpbm Portable Image Map
00161  * \li "ICO" - Windows Icon
00162  * \li "PNG" - Portable Network Graphic Format
00163  *
00164  * Other Supported File Formats:
00165  * \li "JP2" - JPEG-2000 JP2 File Format
00166  * \li "AVI" - Windows Audio-Video Interleaved RIFF
00167  * \li "WMV" -  Windows Media Video Format
00168  *
00169  * Some Known Compressions:
00170  * \li "NONE" - No Compression.
00171  * \li "RLE"  - Run Lenght Encoding.
00172  * \li "LZW"  - Lempel, Ziff and Welsh.
00173  * \li "JPEG" - Join Photographics Experts Group.
00174  * \li "DEFLATE" - LZ77 variation (ZIP)
00175  *
00176  * \ingroup file */
00177
00178
00179 /* Library Names Convention
00180  *
00181  *   Global Functions and Types - "im[Object][Action]"  using first capitals (imFileOpen)
00182  *   Local Functions and Types  -  "i[Object][Action]"  using first capitals (iTIFFGetCompIndex)
00183  *   Local Static Variables - same as local functions and types (iFormatCount)
00184  *   Local Static Tables - same as local functions and types with "Table" suffix (iTIFFCompTable)
00185  *   Variables and Members - no prefix, all lower case (width)
00186  *   Defines and Enumerations - all capitals (IM_ERR_NONE)
00187  *
00188  */
00189
00190
00191 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_math.h Source File

im_math.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Math Utilities
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_MATH_H
00008 #define __IM_MATH_H
00009
00010 #include <math.h>
00011 #include "im_util.h"
00012
00013 #ifdef IM_DEFMATHFLOAT
00014 inline float acosf(float _X) {return ((float)acos((double)_X)); }
00015 inline float asinf(float _X) {return ((float)asin((double)_X)); }
00016 inline float atanf(float _X) {return ((float)atan((double)_X)); }
00017 inline float atan2f(float _X, float _Y) {return ((float)atan2((double)_X, (double)_Y)); }
00018 inline float ceilf(float _X) {return ((float)ceil((double)_X)); }
00019 inline float cosf(float _X)  {return ((float)cos((double)_X)); }
00020 inline float coshf(float _X) {return ((float)cosh((double)_X)); }
00021 inline float expf(float _X) {return ((float)exp((double)_X)); }
00022 inline float fabsf(float _X) {return ((float)fabs((double)_X)); }
00023 inline float floorf(float _X) {return ((float)floor((double)_X)); }
00024 inline float fmodf(float _X, float _Y) {return ((float)fmod((double)_X, (double)_Y)); }
00025 inline float logf(float _X) {return ((float)log((double)_X)); }
00026 inline float log10f(float _X) {return ((float)log10((double)_X)); }
00027 inline float powf(float _X, float _Y) {return ((float)pow((double)_X, (double)_Y)); }
00028 inline float sinf(float _X) {return ((float)sin((double)_X)); }
00029 inline float sinhf(float _X) {return ((float)sinh((double)_X)); }
00030 inline float sqrtf(float _X) {return ((float)sqrt((double)_X)); }
00031 inline float tanf(float _X) {return ((float)tan((double)_X)); }
00032 inline float tanhf(float _X) {return ((float)tanh((double)_X)); }
00033 #endif
00034
00035 /** \defgroup math Math Utilities
00036  * \par
00037  * When converting between continuous and discrete use: \n
00038  * Continuous = Discrete + 0.5         [Reconstruction/Interpolation] \n
00039  * Discrete = Round(Continuous - 0.5)  [Sampling/Quantization] \n
00040  * \par
00041  * Notice that must check 0-max limits when converting from Continuous to Discrete.
00042  * \par
00043  * When converting between discrete and discrete use: \n
00044  * integer src_size, dst_len, src_i, dst_i            \n
00045  * real factor = (real)(dst_size)/(real)(src_size)    \n
00046  * dst_i = Round(factor*(src_i + 0.5) - 0.5)
00047  * \par
00048  * See \ref im_math.h
00049  * \ingroup util */
00050
00051
00052 /** Round a real to the nearest integer.
00053  * \ingroup math */
00054 inline int imRound(float x)
00055 {
00056   return (int)(x < 0? x-0.5f: x+0.5f);
00057 }
00058 inline int imRound(double x)
00059 {
00060   return (int)(x < 0? x-0.5: x+0.5);
00061 }
00062
00063 /** Converts between two discrete grids.
00064  * factor is "dst_size/src_size".
00065  * \ingroup math */
00066 inline int imResample(int x, float factor)
00067 {
00068   float xr = factor*(x + 0.5f) - 0.5f;
00069   return (int)(xr < 0? xr-0.5f: xr+0.5f);  /* Round */
00070 }
00071
00072 /** Does Zero Order Decimation (Mean).
00073  * \ingroup math */
00074 template <class T, class TU>
00075 inline T imZeroOrderDecimation(int width, int height, T *map, float xl, float yl, float box_width, float box_height, TU Dummy)
00076 {
00077   int x0,x1,y0,y1;
00078   (void)Dummy;
00079
00080   x0 = (int)floor(xl - box_width/2.0 - 0.5) + 1;
00081   y0 = (int)floor(yl - box_height/2.0 - 0.5) + 1;
00082   x1 = (int)floor(xl + box_width/2.0 - 0.5);
00083   y1 = (int)floor(yl + box_height/2.0 - 0.5);
00084
00085   if (x0 == x1) x1++;
00086   if (y0 == y1) y1++;
00087
00088   x0 = x0<0? 0: x0>width-1? width-1: x0;
00089   y0 = y0<0? 0: y0>height-1? height-1: y0;
00090   x1 = x1<0? 0: x1>width-1? width-1: x1;
00091   y1 = y1<0? 0: y1>height-1? height-1: y1;
00092
00093   TU Value;
00094   int Count = 0;
00095
00096   Value = 0;
00097
00098   for (int y = y0; y <= y1; y++)
00099   {
00100     for (int x = x0; x <= x1; x++)
00101     {
00102       Value += map[y*width+x];
00103       Count++;
00104     }
00105   }
00106
00107   if (Count == 0)
00108   {
00109     Value = 0;
00110     return (T)Value;
00111   }
00112
00113   return (T)(Value/(float)Count);
00114 }
00115
00116 /** Does Bilinear Decimation.
00117  * \ingroup math */
00118 template <class T, class TU>
00119 inline T imBilinearDecimation(int width, int height, T *map, float xl, float yl, float box_width, float box_height, TU Dummy)
00120 {
00121   int x0,x1,y0,y1;
00122   (void)Dummy;
00123
00124   x0 = (int)floor(xl - box_width/2.0 - 0.5) + 1;
00125   y0 = (int)floor(yl - box_height/2.0 - 0.5) + 1;
00126   x1 = (int)floor(xl + box_width/2.0 - 0.5);
00127   y1 = (int)floor(yl + box_height/2.0 - 0.5);
00128
00129   if (x0 == x1) x1++;
00130   if (y0 == y1) y1++;
00131
00132   x0 = x0<0? 0: x0>width-1? width-1: x0;
00133   y0 = y0<0? 0: y0>height-1? height-1: y0;
00134   x1 = x1<0? 0: x1>width-1? width-1: x1;
00135   y1 = y1<0? 0: y1>height-1? height-1: y1;
00136
00137   TU Value, LineValue;
00138   float LineNorm, Norm, dxr, dyr;
00139
00140   Value = 0;
00141   Norm = 0;
00142
00143   for (int y = y0; y <= y1; y++)
00144   {
00145     dyr = yl - (y+0.5f);
00146     if (dyr < 0) dyr *= -1;
00147
00148     LineValue = 0;
00149     LineNorm = 0;
00150
00151     for (int x = x0; x <= x1; x++)
00152     {
00153       dxr = xl - (x+0.5f);
00154       if (dxr < 0) dxr *= -1;
00155
00156       LineValue += map[y*width+x] * dxr;
00157       LineNorm += dxr;
00158     }
00159
00160     Value += LineValue * dyr;
00161     Norm += dyr * LineNorm;
00162   }
00163
00164   if (Norm == 0)
00165   {
00166     Value = 0;
00167     return (T)Value;
00168   }
00169
00170   return (T)(Value/Norm);
00171 }
00172
00173 /** Does Zero Order Interpolation (Nearest Neighborhood).
00174  * \ingroup math */
00175 template <class T>
00176 inline T imZeroOrderInterpolation(int width, int height, T *map, float xl, float yl)
00177 {
00178   int x0 = imRound(xl-0.5f);
00179   int y0 = imRound(yl-0.5f);
00180   x0 = x0<0? 0: x0>width-1? width-1: x0;
00181   y0 = y0<0? 0: y0>height-1? height-1: y0;
00182   return map[y0*width + x0];
00183 }
00184
00185 /** Does Bilinear Interpolation.
00186  * \ingroup math */
00187 template <class T>
00188 inline T imBilinearInterpolation(int width, int height, T *map, float xl, float yl)
00189 {
00190   int x0, y0, x1, y1;
00191   float t, u;
00192
00193   if (xl < 0.5)
00194   {
00195     x1 = x0 = 0;
00196     t = 0;
00197   }
00198   else if (xl >= width-0.5)
00199   {
00200     x1 = x0 = width-1;
00201     t = 0;
00202   }
00203   else
00204   {
00205     x0 = (int)(xl-0.5f);
00206     x1 = x0+1;
00207     t = xl - (x0+0.5f);
00208   }
00209
00210   if (yl < 0.5)
00211   {
00212     y1 = y0 = 0;
00213     u = 0;
00214   }
00215   else if (yl >= height-0.5)
00216   {
00217     y1 = y0 = height-1;
00218     u = 0;
00219   }
00220   else
00221   {
00222     y0 = (int)(yl-0.5f);
00223     y1 = y0+1;
00224     u = yl - (y0+0.5f);
00225   }
00226
00227   T fll = map[y0*width + x0];
00228   T fhl = map[y0*width + x1];
00229   T flh = map[y1*width + x0];
00230   T fhh = map[y1*width + x1];
00231
00232   return (T)((fhh - flh - fhl + fll) * u * t +
00233                          (fhl - fll) * t +
00234                          (flh - fll) * u +
00235                                 fll);
00236 }
00237
00238 /** Does Bicubic Interpolation.
00239  * \ingroup math */
00240 template <class T, class TU>
00241 inline T imBicubicInterpolation(int width, int height, T *map, float xl, float yl, TU Dummy)
00242 {
00243   int X[4], Y[4];
00244   float t, u;
00245   (void)Dummy;
00246
00247   if (xl >= width-0.5)
00248   {
00249     X[3] = X[2] = X[1] = width-1;
00250     X[0] = X[1]-1;
00251     t = 0;
00252   }
00253   else
00254   {
00255     X[1] = (int)(xl-0.5f);
00256     if (X[1] < 0) X[1] = 0;
00257
00258     X[0] = X[1]-1;
00259     X[2] = X[1]+1;
00260     X[3] = X[1]+2;
00261
00262     if (X[0] < 0) X[0] = 0;
00263     if (X[3] > width-1) X[3] = width-1;
00264
00265     t = xl - (X[1]+0.5f);
00266   }
00267
00268   if (yl >= height-0.5)
00269   {
00270     Y[3] = Y[2] = Y[1] = height-1;
00271     Y[0] = Y[1]-1;
00272     u = 0;
00273   }
00274   else
00275   {
00276     Y[1] = (int)(yl-0.5f);
00277     if (Y[1] < 0) Y[1] = 0;
00278
00279     Y[0] = Y[1]-1;
00280     Y[2] = Y[1]+1;
00281     Y[3] = Y[1]+2;
00282
00283     if (Y[0] < 0) Y[0] = 0;
00284     if (Y[3] > height-1) Y[3] = height-1;
00285
00286     u = yl - (Y[1]+0.5f);
00287   }
00288
00289   float CX[4], CY[4];
00290
00291   // Optimize calculations
00292   {
00293     float c, c2, c3;
00294
00295 #define C0 (-c3 + 2.0f*c2 - c)
00296 #define C1 ( c3 - 2.0f*c2 + 1.0f)
00297 #define C2 (-c3 + c2 + c)
00298 #define C3 ( c3 - c2)
00299
00300     c = t;
00301     c2 = c*c; c3 = c2*c;
00302     CX[0] = C0; CX[1] = C1; CX[2] = C2; CX[3] = C3;
00303
00304     c = u;
00305     c2 = c*c; c3 = c2*c;
00306     CY[0] = C0; CY[1] = C1; CY[2] = C2; CY[3] = C3;
00307
00308 #undef C0
00309 #undef C1
00310 #undef C2
00311 #undef C3
00312   }
00313
00314   TU LineValue, Value;
00315   float LineNorm, Norm;
00316
00317   Value = 0;
00318   Norm = 0;
00319
00320   for (int y = 0; y < 4; y++)
00321   {
00322     LineValue = 0;
00323     LineNorm = 0;
00324
00325     for (int x = 0; x < 4; x++)
00326     {
00327       LineValue += map[Y[y]*width+X[x]] * CX[x];
00328       LineNorm += CX[x];
00329     }
00330
00331     Value += LineValue * CY[y];
00332     Norm += CY[y] * LineNorm;
00333   }
00334
00335   if (Norm == 0)
00336   {
00337     Value = 0;
00338     return (T)Value;
00339   }
00340
00341   Value = (Value/Norm);
00342
00343   int size = sizeof(T);
00344   if (size == 1)
00345     return (T)(Value<=(TU)0? (TU)0: Value<=(TU)255? Value: (TU)255);
00346   else
00347     return (T)(Value);
00348 }
00349
00350 /** Calculates minimum and maximum values.
00351  * \ingroup math */
00352 template <class T>
00353 inline void imMinMax(const T *map, int count, T& min, T& max)
00354 {
00355   min = *map++;
00356   max = min;
00357   for (int i = 1; i < count; i++)
00358   {
00359     T value = *map++;
00360
00361     if (value > max)
00362       max = value;
00363     else if (value < min)
00364       min = value;
00365   }
00366 }
00367
00368 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_math_op.h Source File

im_math_op.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Math Operations
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_MATH_OP_H
00008 #define __IM_MATH_OP_H
00009
00010 #include "im_complex.h"
00011
00012
00013 /// Crop value to Byte limit
00014 template <class T>
00015 inline T crop_byte(const T& v)
00016 {
00017   return v < 0? 0: v > 255? 255: v;
00018 }
00019
00020 /// Generic Addition with 2 template types
00021 template <class T1, class T2>
00022 inline T1 add_op(const T1& v1, const T2& v2)
00023 {
00024   return v2 + v1;
00025 }
00026
00027 /// Generic Subtraction with 2 template types
00028 template <class T1, class T2>
00029 inline T1 sub_op(const T1& v1, const T2& v2)
00030 {
00031   return v2 - v1;
00032 }
00033
00034 /// Generic Multiplication with 2 template types
00035 template <class T1, class T2>
00036 inline T1 mul_op(const T1& v1, const T2& v2)
00037 {
00038   return v2 * v1;
00039 }
00040
00041 /// Generic Division with 2 template types
00042 template <class T1, class T2>
00043 inline T1 div_op(const T1& v1, const T2& v2)
00044 {
00045   return v1 / v2;
00046 }
00047
00048 /// Generic Invert
00049 template <class T>
00050 inline T inv_op(const T& v)
00051 {
00052   return 1/v;
00053 }
00054
00055 /// Generic Difference with 2 template types
00056 template <class T1, class T2>
00057 inline T1 diff_op(const T1& v1, const T2& v2)
00058 {
00059   if (v1 < v2)
00060     return v2 - v1;
00061   return v1 - v2;
00062 }
00063
00064 /// Generic Minimum with 2 template types
00065 template <class T1, class T2>
00066 inline T1 min_op(const T1& v1, const T2& v2)
00067 {
00068   if (v1 < v2)
00069     return v1;
00070   return v2;
00071 }
00072
00073 /// Generic Maximum with 2 template types
00074 template <class T1, class T2>
00075 inline T1 max_op(const T1& v1, const T2& v2)
00076 {
00077   if (v1 < v2)
00078     return v2;
00079   return v1;
00080 }
00081
00082 inline imbyte pow_op(const imbyte& v1, const imbyte& v2)
00083 {
00084   return (imbyte)pow((float)v1, v2);
00085 }
00086
00087 inline imushort pow_op(const imushort& v1, const imushort& v2)
00088 {
00089   return (imushort)pow((float)v1, v2);
00090 }
00091
00092 inline int pow_op(const int& v1, const int& v2)
00093 {
00094   return (int)pow((float)v1, v2);
00095 }
00096
00097 /// Generic Power with 2 template types
00098 template <class T1, class T2>
00099 inline T1 pow_op(const T1& v1, const T2& v2)
00100 {
00101   return (T1)pow(v1, v2);
00102 }
00103
00104 /// Generic Abssolute
00105 template <class T>
00106 inline T abs_op(const T& v)
00107 {
00108   if (v < 0)
00109     return -1*v;
00110   return v;
00111 }
00112
00113 /// Generic Less
00114 template <class T>
00115 inline T less_op(const T& v)
00116 {
00117   return -1*v;
00118 }
00119
00120 /// Generic Square
00121 template <class T>
00122 inline T sqr_op(const T& v)
00123 {
00124   return v*v;
00125 }
00126
00127 inline int sqrt(const int& C)
00128 {
00129   return (int)sqrt(float(C));
00130 }
00131
00132 /// Generic Square Root
00133 template <class T>
00134 inline T sqrt_op(const T& v)
00135 {
00136   return (T)sqrt(v);
00137 }
00138
00139 inline int exp(const int& v)
00140 {
00141   return (int)exp((float)v);
00142 }
00143
00144 /// Generic Exponential
00145 template <class T>
00146 inline T exp_op(const T& v)
00147 {
00148   return (T)exp(v);
00149 }
00150
00151 inline int log(const int& v)
00152 {
00153   return (int)log((float)v);
00154 }
00155
00156 /// Generic Logarithm
00157 template <class T>
00158 inline T log_op(const T& v)
00159 {
00160   return (T)log(v);
00161 }
00162
00163 // Dummy sin
00164 inline imcfloat sin(const imcfloat& v)
00165 {
00166   return (v);
00167 }
00168
00169 inline int sin(const int& v)
00170 {
00171   return (int)sin((float)v);
00172 }
00173
00174 /// Generic Sine
00175 template <class T>
00176 inline T sin_op(const T& v)
00177 {
00178   return (T)sin(v);
00179 }
00180
00181 inline int cos(const int& v)
00182 {
00183   return (int)cos((float)v);
00184 }
00185
00186 // Dummy cos
00187 inline imcfloat cos(const imcfloat& v)
00188 {
00189   return (v);
00190 }
00191
00192 /// Generic Cosine
00193 template <class T>
00194 inline T cos_op(const T& v)
00195 {
00196   return (T)cos(v);
00197 }
00198
00199 /// Sets a bit in an array
00200 inline void imDataBitSet(imbyte* data, int index, int bit)
00201 {
00202   if (bit)
00203     data[index / 8] |=  (0x01 << (7 - (index % 8)));
00204   else
00205     data[index / 8] &= ~(0x01 << (7 - (index % 8)));
00206 }
00207
00208 /// Gets a bit from an array
00209 inline int imDataBitGet(imbyte* data, int index)
00210 {
00211   return (data[index / 8] >> (7 - (index % 8))) & 0x01;
00212 }
00213
00214 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_palette.h Source File

im_palette.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Palette Generators
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_PALETTE_H
00008 #define __IM_PALETTE_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014
00015 /** \defgroup palette Palette Generators
00016  * \par
00017  * Creates several standard palettes. The palette is just an array of encoded color values.
00018  * See also \ref colorutl.
00019  * \par
00020  * In Lua, to create a palette you can call im.PaletteCreate.
00021  * \verbatim im.PaletteCreate([count: number]) -> pal: imPalette [in Lua 5] \endverbatim
00022  * Default count is 256.
00023  * IMLua and CDLua palettes are 100% compatible. The IM palette metatable name is "imPalette". \n
00024  * When converted to a string will return "imPalete(%p)" where %p is replaced by the userdata address.
00025  * If the palette is already destroyed by im.PaletteDestroy, then it will return also the suffix "-destroyed".
00026  * \par
00027  * In Lua, to destroy a palette you can call im.PaletteDestroy.
00028  * If this function is not called, the palette is destroyed by the garbage collector.
00029  * \verbatim im.PaletteDestroy(pal: imPalette) [in Lua 5] \endverbatim
00030  * \par
00031  * In Lua, array access is enabled so you can do:.
00032  * \verbatim color = pal[index] \endverbatim
00033  * \verbatim pal[index] = color \endverbatim
00034  * \verbatim count = #pal \endverbatim
00035  * \par
00036  * See \ref im_palette.h
00037  * \ingroup util */
00038
00039
00040 /** Searches for the nearest color on the table and returns the color index if successful.
00041  * It looks in all palette entries and finds the minimum euclidian square distance.
00042  * If the color matches the given color it returns immediately.
00043  * See also \ref colorutl.
00044  *
00045  * \verbatim im.PaletteFindNearest(pal: imPalette, color: lightuserdata) -> index: number [in Lua 5] \endverbatim
00046  * \ingroup palette */
00047 int imPaletteFindNearest(const long *palette, int palette_count, long color);
00048
00049 /** Searches for the color on the table and returns the color index if successful.
00050  * If the tolerance is 0 search for the exact match in the palette else search for the
00051  * first color that fits in the tolerance range.
00052  * See also \ref colorutl.
00053  *
00054  * \verbatim im.PaletteFindColor(pal: imPalette, color: lightuserdata, tol: number) -> index: number [in Lua 5] \endverbatim
00055  * \ingroup palette */
00056 int imPaletteFindColor(const long *palette, int palette_count, long color, unsigned char tol);
00057
00058 /** Creates a palette of gray scale values.
00059  * The colors are arranged from black to white.
00060  *
00061  * \verbatim im.PaletteGray() -> pal: imPalette [in Lua 5] \endverbatim
00062  * \ingroup palette */
00063 long* imPaletteGray(void);
00064
00065 /** Creates a palette of a gradient of red colors.
00066  * The colors are arranged from black to pure red.
00067  *
00068  * \verbatim im.PaletteRed() -> pal: imPalette [in Lua 5] \endverbatim
00069  * \ingroup palette */
00070 long* imPaletteRed(void);
00071
00072 /** Creates a palette of a gradient of green colors.
00073  * The colors are arranged from black to pure green.
00074  *
00075  * \verbatim im.PaletteGreen() -> pal: imPalette [in Lua 5] \endverbatim
00076  * \ingroup palette */
00077 long* imPaletteGreen(void);
00078
00079 /** Creates a palette of a gradient of blue colors.
00080  * The colors are arranged from black to pure blue.
00081  *
00082  * \verbatim im.PaletteBlue() -> pal: imPalette [in Lua 5] \endverbatim
00083  * \ingroup palette */
00084 long* imPaletteBlue(void);
00085
00086 /** Creates a palette of a gradient of yellow colors.
00087  * The colors are arranged from black to pure yellow.
00088  *
00089  * \verbatim im.PaletteYellow() -> pal: imPalette [in Lua 5] \endverbatim
00090  * \ingroup palette */
00091 long* imPaletteYellow(void);
00092
00093 /** Creates a palette of a gradient of magenta colors.
00094  * The colors are arranged from black to pure magenta.
00095  *
00096  * \verbatim im.PaletteMagenta() -> pal: imPalette [in Lua 5] \endverbatim
00097  * \ingroup palette */
00098 long* imPaletteMagenta(void);
00099
00100 /** Creates a palette of a gradient of cian colors.
00101  * The colors are arranged from black to pure cian.
00102  *
00103  * \verbatim im.PaletteCian() -> pal: imPalette [in Lua 5] \endverbatim
00104  * \ingroup palette */
00105 long* imPaletteCian(void);
00106
00107 /** Creates a palette of rainbow colors.
00108  * The colors are arranged in the light wave length spectrum order (starting from purple).
00109  *
00110  * \verbatim im.PaletteRainbow() -> pal: imPalette [in Lua 5] \endverbatim
00111  * \ingroup palette */
00112 long* imPaletteRainbow(void);
00113
00114 /** Creates a palette of hues with maximum saturation.
00115  *
00116  * \verbatim im.PaletteHues() -> pal: imPalette [in Lua 5] \endverbatim
00117  * \ingroup palette */
00118 long* imPaletteHues(void);
00119
00120 /** Creates a palette of a gradient of blue colors.
00121  * The colors are arranged from pure blue to white.
00122  *
00123  * \verbatim im.PaletteBlueIce() -> pal: imPalette [in Lua 5] \endverbatim
00124  * \ingroup palette */
00125 long* imPaletteBlueIce(void);
00126
00127 /** Creates a palette of a gradient from black to white passing trough red and orange.
00128  *
00129  * \verbatim im.PaletteHotIron() -> pal: imPalette [in Lua 5] \endverbatim
00130  * \ingroup palette */
00131 long* imPaletteHotIron(void);
00132
00133 /** Creates a palette of a gradient from black to white passing trough red and yellow.
00134  *
00135  * \verbatim im.PaletteBlackBody() -> pal: imPalette [in Lua 5] \endverbatim
00136  * \ingroup palette */
00137 long* imPaletteBlackBody(void);
00138
00139 /** Creates a palette with high contrast colors.
00140  *
00141  * \verbatim im.PaletteHighContrast() -> pal: imPalette [in Lua 5] \endverbatim
00142  * \ingroup palette */
00143 long* imPaletteHighContrast(void);
00144
00145 /** Creates a palette of an uniform range of colors from black to white.
00146  *  This is a 2^(2.6) bits per pixel palette.
00147  *
00148  * \verbatim im.PaletteUniform() -> pal: imPalette [in Lua 5] \endverbatim
00149  * \ingroup palette */
00150 long* imPaletteUniform(void);
00151
00152 /** Returns the index of the correspondent RGB color of an uniform palette.
00153  *
00154  * \verbatim im.PaletteUniformIndex(color: lightuserdata) -> index: number [in Lua 5] \endverbatim
00155  * \ingroup palette */
00156 int imPaletteUniformIndex(long color);
00157
00158 /** Returns the index of the correspondent RGB color of an uniform palette.
00159  * Uses an 8x8 ordered dither to lookup the index in a halftone matrix.
00160  * The spatial position used by the halftone method.
00161  *
00162  * \verbatim im.PaletteUniformIndexHalftoned(color: lightuserdata, x: number, y: number) -> index: number [in Lua 5] \endverbatim
00163  * \ingroup palette */
00164 int imPaletteUniformIndexHalftoned(long color, int x, int y);
00165
00166
00167 #if defined(__cplusplus)
00168 }
00169 #endif
00170
00171 #endif
00172


IM: im_plus.h Source File

im_plus.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief C++ Wrapper for File Access
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_PLUS_H
00008 #define __IM_PLUS_H
00009
00010
00011 /** \brief C++ Wrapper for the Image File Structure
00012  *
00013  * \par
00014  * Usage is just like the C API. Open and New are replaced by equivalent constructors. \n
00015  * Close is replaced by the destructor. Error checking is done by the Error() member. \n
00016  * Open and New errors are cheked using the Failed() member.
00017  *  \ingroup file */
00018 class imImageFile
00019 {
00020   imFile* ifile;
00021   int error;
00022
00023   imImageFile() {};
00024
00025 public:
00026
00027   imImageFile(const char* file_name)
00028     { this->ifile = imFileOpen(file_name, &this->error); }
00029
00030   imImageFile(const char* file_name, const char* format)
00031     { this->ifile = imFileNew(file_name, format, &this->error); }
00032
00033   ~imImageFile()
00034     { if (this->ifile) imFileClose(this->ifile); }
00035
00036   int Failed()
00037     { return this->ifile == 0; }
00038
00039   int Error()
00040     { return this->error; }
00041
00042   void SetAttribute(const char* attrib, int data_type, int count, const void* data)
00043     { imFileSetAttribute(this->ifile, attrib, data_type, count, data); }
00044
00045   const void* GetAttribute(const char* attrib, int *data_type, int *count)
00046     { return imFileGetAttribute(this->ifile, attrib, data_type, count); }
00047
00048   void GetInfo(char* format, char* compression, int *image_count)
00049     { imFileGetInfo(this->ifile, format, compression, image_count); }
00050
00051   void ReadImageInfo(int index, int *width, int *height, int *color_mode, int *data_type)
00052     { this->error = imFileReadImageInfo(this->ifile, index, width, height, color_mode, data_type); }
00053
00054   void GetPalette(long* palette, int *palette_count)
00055     { imFileGetPalette(this->ifile, palette, palette_count); }
00056
00057   void ReadImageData(void* data, int convert2bitmap, int color_mode_flags)
00058     { this->error = imFileReadImageData(this->ifile, data, convert2bitmap, color_mode_flags); }
00059
00060   void SetInfo(const char* compression)
00061     { imFileSetInfo(this->ifile, compression); }
00062
00063   void SetPalette(long* palette, int palette_count)
00064     { imFileSetPalette(this->ifile, palette, palette_count); }
00065
00066   void WriteImageInfo(int width, int height, int color_mode, int data_type)
00067     { this->error = imFileWriteImageInfo(this->ifile, width, height, color_mode, data_type); }
00068
00069   void WriteImageData(void* data)
00070     { this->error = imFileWriteImageData(this->ifile, data); }
00071 };
00072
00073 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_process.h File Reference

im_process.h File Reference

Image Processing. More...

Include dependency graph for im_process.h:

Go to the source code of this file.

Detailed Description

See Copyright Notice in im_lib.h

Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_process.h Source File

im_process.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Image Processing
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_PROCESS_H
00008 #define __IM_PROCESS_H
00009
00010 #include "im_process_pon.h"
00011 #include "im_process_loc.h"
00012 #include "im_process_glo.h"
00013 #include "im_process_ana.h"
00014
00015 #if     defined(__cplusplus)
00016 extern "C" {
00017 #endif
00018
00019
00020 /** \defgroup process Image Processing
00021  * \par
00022  * Several image processing functions based on the \ref imImage structure.
00023  * \par
00024  * You must link the application with "im_process.lib/.a/.so".
00025  * In Lua call require"imlua_process". \n
00026  * Some complex operations use the \ref counter.\n
00027  * There is no check on the input/output image properties,
00028  * check each function documentation before using it.
00029  */
00030
00031
00032 #if defined(__cplusplus)
00033 }
00034 #endif
00035
00036 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_process_ana.h Source File

im_process_ana.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Image Statistics and Analysis
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_PROC_ANA_H
00008 #define __IM_PROC_ANA_H
00009
00010 #include "im_image.h"
00011
00012 #if     defined(__cplusplus)
00013 extern "C" {
00014 #endif
00015
00016
00017
00018 /** \defgroup stats Image Statistics Calculations
00019  * \par
00020  * Operations to calculate some statistics over images.
00021  * \par
00022  * See \ref im_process_ana.h
00023  * \ingroup process */
00024
00025 /** Calculates the RMS error between two images (Root Mean Square Error).
00026  *
00027  * \verbatim im.CalcRMSError(image1: imImage, image2: imImage) -> rms: number [in Lua 5] \endverbatim
00028  * \ingroup stats */
00029 float imCalcRMSError(const imImage* image1, const imImage* image2);
00030
00031 /** Calculates the SNR of an image and its noise (Signal Noise Ratio).
00032  *
00033  * \verbatim im.CalcSNR(src_image: imImage, noise_image: imImage) -> snr: number [in Lua 5] \endverbatim
00034  * \ingroup stats */
00035 float imCalcSNR(const imImage* src_image, const imImage* noise_image);
00036
00037 /** Count the number of different colors in an image. \n
00038  * Image must be IM_BYTE, but all color spaces except IM_CMYK.
00039  *
00040  * \verbatim im.CalcCountColors(image: imImage) -> count: number [in Lua 5] \endverbatim
00041  * \ingroup stats */
00042 unsigned long imCalcCountColors(const imImage* image);
00043
00044 /** Calculates the histogram of a IM_BYTE data. \n
00045  * Histogram is always 256 positions long. \n
00046  * When cumulative is different from zero it calculates the cumulative histogram.
00047  *
00048  * \verbatim im.CalcHistogram(image: imImage, plane: number, cumulative: boolean) -> histo: table of numbers [in Lua 5] \endverbatim
00049  * Where plane is the depth plane to calculate the histogram. \n
00050  * The returned table is zero indexed. image can be IM_USHORT or IM_BYTE.
00051  * \ingroup stats */
00052 void imCalcHistogram(const unsigned char* data, int count, unsigned long* histo, int cumulative);
00053
00054 /** Calculates the histogram of a IM_USHORT data. \n
00055  * Histogram is always 65535 positions long. \n
00056  * When cumulative is different from zero it calculates the cumulative histogram. \n
00057  * Use \ref imCalcHistogram in Lua.
00058  * \ingroup stats */
00059 void imCalcUShortHistogram(const unsigned short* data, int count, unsigned long* histo, int cumulative);
00060
00061 /** Calculates the gray histogram of an image. \n
00062  * Image must be IM_BYTE/(IM_RGB, IM_GRAY, IM_BINARY or IM_MAP). \n
00063  * If the image is IM_RGB then the histogram of the luma component is calculated. \n
00064  * Histogram is always 256 positions long. \n
00065  * When cumulative is different from zero it calculates the cumulative histogram.
00066  *
00067  * \verbatim im.CalcGrayHistogram(image: imImage, cumulative: boolean) -> histo: table of numbers [in Lua 5] \endverbatim
00068  * \ingroup stats */
00069 void imCalcGrayHistogram(const imImage* image, unsigned long* histo, int cumulative);
00070
00071 /** Numerical Statistics Structure
00072  * \ingroup stats */
00073 typedef struct _imStats
00074 {
00075   float max;                /**< Maximum value              */
00076   float min;                /**< Minimum value              */
00077   unsigned long positive;   /**< Number of Positive Values  */
00078   unsigned long negative;   /**< Number of Negative Values  */
00079   unsigned long zeros;      /**< Number of Zeros            */
00080   float mean;               /**< Mean                       */
00081   float stddev;             /**< Standard Deviation         */
00082 } imStats;
00083
00084 /** Calculates the statistics about the image data. \n
00085  * There is one stats for each depth plane. For ex: stats[0]=red stats, stats[0]=green stats, ... \n
00086  * Supports all data types except IM_CFLOAT. \n
00087  *
00088  * \verbatim im.CalcImageStatistics(image: imImage) -> stats: table [in Lua 5] \endverbatim
00089  * Table contains the following fields: max, min, positive, negative, zeros, mean, stddev.
00090  * The same as the \ref imStats structure.
00091  * \ingroup stats */
00092 void imCalcImageStatistics(const imImage* image, imStats* stats);
00093
00094 /** Calculates the statistics about the image histogram data.\n
00095  * There is one stats for each depth plane. For ex: stats[0]=red stats, stats[0]=green stats, ... \n
00096  * Only IM_BYTE images are supported.
00097  *
00098  * \verbatim im.CalcHistogramStatistics(image: imImage) -> stats: table [in Lua 5] \endverbatim
00099  * \ingroup stats */
00100 void imCalcHistogramStatistics(const imImage* image, imStats* stats);
00101
00102 /** Calculates some extra statistics about the image histogram data.\n
00103  * There is one stats for each depth plane. \n
00104  * Only IM_BYTE images are supported. \n
00105  * mode will be -1 if more than one max is found.
00106  *
00107  * \verbatim im.CalcHistoImageStatistics(image: imImage) -> median: number, mode: number [in Lua 5] \endverbatim
00108  * \ingroup stats */
00109 void imCalcHistoImageStatistics(const imImage* image, int* median, int* mode);
00110
00111
00112
00113 /** \defgroup analyze Image Analysis
00114  * \par
00115  * See \ref im_process_ana.h
00116  * \ingroup process */
00117
00118 /** Find white regions in binary image. \n
00119  * Result is IM_GRAY/IM_USHORT type. Regions can be 4 connected or 8 connected. \n
00120  * Returns the number of regions found. Background is marked as 0. \n
00121  * Regions touching the border are considered only if touch_border=1.
00122  *
00123  * \verbatim im.AnalyzeFindRegions(src_image: imImage, dst_image: imImage, connect: number, touch_border: boolean) -> count: number [in Lua 5] \endverbatim
00124  * \verbatim im.AnalyzeFindRegionsNew(image: imImage, connect: number, touch_border: boolean) -> count: number, new_image: imImage [in Lua 5] \endverbatim
00125  * \ingroup analyze */
00126 int imAnalyzeFindRegions(const imImage* src_image, imImage* dst_image, int connect, int touch_border);
00127
00128 /** Measure the actual area of all regions. Holes are not included. \n
00129  * This is the number of pixels of each region. \n
00130  * Source image is IM_GRAY/IM_USHORT type (the result of \ref imAnalyzeFindRegions). \n
00131  * area has size the number of regions.
00132  *
00133  * \verbatim im.AnalyzeMeasureArea(image: imImage, [region_count: number]) -> area: table of numbers [in Lua 5] \endverbatim
00134  * The returned table is zero indexed.
00135  * \ingroup analyze */
00136 void imAnalyzeMeasureArea(const imImage* image, int* area, int region_count);
00137
00138 /** Measure the polygonal area limited by the perimeter line of all regions. Holes are not included. \n
00139  * Notice that some regions may have polygonal area zero. \n
00140  * Source image is IM_GRAY/IM_USHORT type (the result of \ref imAnalyzeFindRegions). \n
00141  * perimarea has size the number of regions.
00142  *
00143  * \verbatim im.AnalyzeMeasurePerimArea(image: imImage, [region_count: number]) -> perimarea: table of numbers [in Lua 5] \endverbatim
00144  * The returned table is zero indexed.
00145  * \ingroup analyze */
00146 void imAnalyzeMeasurePerimArea(const imImage* image, float* perimarea);
00147
00148 /** Calculate the centroid position of all regions. Holes are not included. \n
00149  * Source image is IM_GRAY/IM_USHORT type (the result of \ref imAnalyzeFindRegions). \n
00150  * area, cx and cy have size the number of regions. If area is NULL will be internally calculated.
00151  *
00152  * \verbatim im.AnalyzeMeasureCentroid(image: imImage, [area: table of numbers], [region_count: number]) -> cx: table of numbers, cy: table of numbers [in Lua 5] \endverbatim
00153  * The returned tables are zero indexed.
00154  * \ingroup analyze */
00155 void imAnalyzeMeasureCentroid(const imImage* image, const int* area, int region_count, float* cx, float* cy);
00156
00157 /** Calculate the principal major axis slope of all regions. \n
00158  * Source image is IM_GRAY/IM_USHORT type (the result of \ref imAnalyzeFindRegions). \n
00159  * data has size the number of regions. If area or centroid are NULL will be internally calculated. \n
00160  * Principal (major and minor) axes are defined to be those axes that pass through the
00161  * centroid, about which the moment of inertia of the region is, respectively maximal or minimal.
00162  *
00163  * \verbatim im.AnalyzeMeasurePrincipalAxis(image: imImage, [area: table of numbers], [cx: table of numbers], [cy: table of numbers], [region_count: number])
00164                               -> major_slope: table of numbers, major_length: table of numbers, minor_slope: table of numbers, minor_length: table of numbers [in Lua 5] \endverbatim
00165  * The returned tables are zero indexed.
00166  * \ingroup analyze */
00167 void imAnalyzeMeasurePrincipalAxis(const imImage* image, const int* area, const float* cx, const float* cy,
00168                                    const int region_count, float* major_slope, float* major_length,
00169                                                            float* minor_slope, float* minor_length);
00170
00171 /** Measure the number and area of holes of all regions. \n
00172  * Source image is IM_USHORT type (the result of \ref imAnalyzeFindRegions). \n
00173  * area and perim has size the number of regions, if some is NULL it will be not calculated.
00174  *
00175  * \verbatim im.AnalyzeMeasureHoles(image: imImage, connect: number, [region_count: number]) -> holes_count: number, area: table of numbers, perim: table of numbers [in Lua 5] \endverbatim
00176  * The returned tables are zero indexed.
00177  * \ingroup analyze */
00178 void imAnalyzeMeasureHoles(const imImage* image, int connect, int *holes_count, int* area, float* perim);
00179
00180 /** Measure the total perimeter of all regions (external and internal). \n
00181  * Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions). \n
00182  * It uses a half-pixel inter distance for 8 neighboors in a perimeter of a 4 connected region. \n
00183  * This function can also be used to measure line lenght. \n
00184  * perim has size the number of regions.
00185  *
00186  * \verbatim im.AnalyzeMeasurePerimeter(image: imImage) -> perim: table of numbers [in Lua 5] \endverbatim
00187  * \ingroup analyze */
00188 void imAnalyzeMeasurePerimeter(const imImage* image, float* perim, int region_count);
00189
00190 /** Isolates the perimeter line of gray integer images. Background is defined as being black (0). \n
00191  * It just checks if at least one of the 4 connected neighboors is non zero. Image borders are extended with zeros.
00192  *
00193  * \verbatim im.ProcessPerimeterLine(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00194  * \verbatim im.ProcessPerimeterLineNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00195  * \ingroup analyze */
00196 void imProcessPerimeterLine(const imImage* src_image, imImage* dst_image);
00197
00198 /** Eliminates regions that have area size outside or inside the given interval. \n
00199  * Source and destiny are a binary images. Regions can be 4 connected or 8 connected. \n
00200  * Can be done in-place. end_size can be zero to indicate no upper limit or an area with width*height size. \n
00201  * When searching inside the region the limits are inclusive (<= size >=), when searching outside the limits are exclusive (> size <).
00202  *
00203  * \verbatim im.ProcessRemoveByArea(src_image: imImage, dst_image: imImage, connect: number, start_size: number, end_size: number, inside: boolean) [in Lua 5] \endverbatim
00204  * \verbatim im.ProcessRemoveByAreaNew(image: imImage, connect: number, start_size: number, end_size: number, inside: boolean) -> new_image: imImage [in Lua 5] \endverbatim
00205  * \ingroup analyze */
00206 void imProcessRemoveByArea(const imImage* src_image, imImage* dst_image, int connect, int start_size, int end_size, int inside);
00207
00208 /** Fill holes inside white regions. \n
00209  * Source and destiny are a binary images. Regions can be 4 connected or 8 connected. \n
00210  * Can be done in-place.
00211  *
00212  * \verbatim im.ProcessFillHoles(src_image: imImage, dst_image: imImage, connect: number) [in Lua 5] \endverbatim
00213  * \verbatim im.ProcessFillHolesNew(image: imImage, connect: number) -> new_image: imImage [in Lua 5] \endverbatim
00214  * \ingroup analyze */
00215 void imProcessFillHoles(const imImage* src_image, imImage* dst_image, int connect);
00216
00217
00218 #if defined(__cplusplus)
00219 }
00220 #endif
00221
00222 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_process_glo.h Source File

im_process_glo.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Image Processing - Global Operations
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_PROCESS_GLO_H
00008 #define __IM_PROCESS_GLO_H
00009
00010 #include "im_image.h"
00011
00012 #if     defined(__cplusplus)
00013 extern "C" {
00014 #endif
00015
00016
00017
00018 /** \defgroup transform Other Domain Transform Operations
00019  * \par
00020  * Hough, Distance.
00021  *
00022  * See \ref im_process_glo.h
00023  * \ingroup process */
00024
00025 /** Hough Lines Transform. \n
00026  * It will detect white lines in a black background. So the source image must be a IM_BINARY image
00027  * with the white lines of interest enhanced. The better the threshold with the white lines the better
00028  * the line detection. \n
00029  * The destiny image must have IM_GRAY, IM_INT, hg_width=180, hg_height=2*rmax+1,
00030  * where rmax is the image diagonal/2 (rmax = srqrt(width*width + height*height)). \n
00031  * The hough transform defines  "cos(theta) * X  + sin(theta) * Y = rho" and the parameters are in the interval: \n
00032  * theta = "0 .. 179", rho = "-hg_height/2 .. hg_height/2" .\n
00033  * Where rho is the perpendicular distance from the center of the image and theta the angle with the normal.
00034  * So do not confuse theta with the line angle, they are perpendicular. \n
00035  * Returns zero if the counter aborted. \n
00036  * Inspired from ideas in XITE, Copyright 1991, Blab, UiO \n
00037  * http://www.ifi.uio.no/~blab/Software/Xite/
00038  *
00039  * \verbatim im.ProcessHoughLines(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] \endverbatim
00040  * \verbatim im.ProcessHoughLinesNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00041  * \ingroup transform */
00042 int imProcessHoughLines(const imImage* src_image, imImage* dst_image);
00043
00044 /** Draw detected hough lines. \n
00045  * The source image must be IM_GRAY and IM_BYTE. The destiny image can be a clone of the source image or
00046  * it can be the source image for in place processing. \n
00047  * If the hough transform is not NULL, then the hough points are filtered to include only lines
00048  * that are significally different from each other. \n
00049  * The hough image is the hough transform image, but it is optional and can be NULL.
00050  * If not NULL then it will be used to filter lines that are very similar. \n
00051  * The hough points image is a hough transform image that was thresholded to a IM_BINARY image,
00052  * usually using a Local Max threshold operation (see \ref imProcessLocalMaxThreshold). Again the better the threshold the better the results. \n
00053  * The destiny image will be set to IM_MAP, and the detected lines will be drawn using a red color. \n
00054  * Returns the number of detected lines.
00055  *
00056  * \verbatim im.ProcessHoughLinesDraw(src_image: imImage, hough: imImage, hough_points: imImage, dst_image: imImage) -> lines: number [in Lua 5] \endverbatim
00057  * \verbatim im.ProcessHoughLinesDrawNew(image: imImage, hough: imImage, hough_points: imImage) -> lines: number, new_image: imImage [in Lua 5] \endverbatim
00058  * \ingroup transform */
00059 int imProcessHoughLinesDraw(const imImage* src_image, const imImage* hough, const imImage* hough_points, imImage* dst_image);
00060
00061 /** Calculates the Cross Correlation in the frequency domain. \n
00062  * CrossCorr(a,b) = IFFT(Conj(FFT(a))*FFT(b)) \n
00063  * Images must be of the same size and only destiny image must be of type complex.
00064  *
00065  * \verbatim im.ProcessCrossCorrelation(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00066  * \verbatim im.ProcessCrossCorrelationNew(image1: imImage, image2: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00067  * \ingroup transform */
00068 void imProcessCrossCorrelation(const imImage* src_image1, const imImage* src_image2, imImage* dst_image);
00069
00070 /** Calculates the Auto Correlation in the frequency domain. \n
00071  * Uses the cross correlation.
00072  * Images must be of the same size and only destiny image must be of type complex.
00073  *
00074  * \verbatim im.ProcessAutoCorrelation(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00075  * \verbatim im.ProcessAutoCorrelationNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00076  * \ingroup transform */
00077 void imProcessAutoCorrelation(const imImage* src_image, imImage* dst_image);
00078
00079 /** Calculates the Distance Transform of a binary image
00080  * using an aproximation of the euclidian distance.\n
00081  * Each white pixel in the binary image is
00082  * assigned a value equal to its distance from the nearest
00083  * black pixel. \n
00084  * Uses a two-pass algorithm incrementally calculating the distance. \n
00085  * Source image must be IM_BINARY, destiny must be IM_FLOAT.
00086  *
00087  * \verbatim im.ProcessDistanceTransform(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00088  * \verbatim im.ProcessDistanceTransformNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00089  * \ingroup transform */
00090 void imProcessDistanceTransform(const imImage* src_image, imImage* dst_image);
00091
00092 /** Marks all the regional maximum of the distance transform. \n
00093  * source is IMGRAY/IM_FLOAT destiny in IM_BINARY. \n
00094  * We consider maximum all connected pixel values that have smaller pixel values around it.
00095  *
00096  * \verbatim im.ProcessRegionalMaximum(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00097  * \verbatim im.ProcessRegionalMaximumNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00098  * \ingroup transform */
00099 void imProcessRegionalMaximum(const imImage* src_image, imImage* dst_image);
00100
00101
00102
00103 /** \defgroup fourier Fourier Transform Operations
00104  * \par
00105  * All Fourier transforms use FFTW library. \n
00106  * The pre-compiled binaries for FFTW version 2.1.5 includes all the necessary files.
00107  * The pre-compiled binaries for FFTW version 3.x depends on an external library, not provided.
00108  * To build the code that uses FFTW version 3 you must define USE_FFTW3.
00109  * \par
00110  * FFTW Copyright Matteo Frigo, Steven G. Johnson and the MIT. \n
00111  * http://www.fftw.org                                         \n
00112  * See "fftw.h"
00113  * \par
00114  * Must link with "im_fftw" library. \n
00115  * \par
00116  * IMPORTANT: The FFTW lib has a GPL license. The license of the "im_fftw" library is automatically the GPL.
00117  * So you cannot use it for commercial applications without contacting the authors.
00118  * \par
00119  * See \ref im_process_glo.h
00120  * \ingroup process */
00121
00122 /** Forward FFT. \n
00123  * The result has its lowest frequency at the center of the image. \n
00124  * This is an unnormalized fft. \n
00125  * Images must be of the same size. Destiny image must be of type complex.
00126  *
00127  * \verbatim im.ProcessFFT(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00128  * \verbatim im.ProcessFFTNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00129  * \ingroup fourier */
00130 void imProcessFFT(const imImage* src_image, imImage* dst_image);
00131
00132 /** Inverse FFT. \n
00133  * The image has its lowest frequency restored to the origin before the transform. \n
00134  * The result is normalized by (width*height). \n
00135  * Images must be of the same size and both must be of type complex.
00136  *
00137  * \verbatim im.ProcessIFFT(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00138  * \verbatim im.ProcessIFFTNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00139  * \ingroup fourier */
00140 void imProcessIFFT(const imImage* src_image, imImage* dst_image);
00141
00142 /** Raw in-place FFT (forward or inverse). \n
00143  * The lowest frequency can be centered after forward, or
00144  * can be restored to the origin before inverse. \n
00145  * The result can be normalized after the transform by sqrt(w*h) [1] or by (w*h) [2],
00146  * or left unnormalized [0]. \n
00147  * Images must be of the same size and both must be of type complex.
00148  *
00149  * \verbatim im.ProcessFFTraw(image: imImage, inverse: number, center: number, normalize: number) [in Lua 5] \endverbatim
00150  * \ingroup fourier */
00151 void imProcessFFTraw(imImage* image, int inverse, int center, int normalize);
00152
00153 /** Auxiliary function for the raw FFT. \n
00154  * This is the function used internally to change the lowest frequency position in the image. \n
00155  * If the image size has even dimensions the flag "center2origin" is useless. But if it is odd,
00156  * you must specify if its from center to origin (usually used before inverse) or
00157  * from origin to center (usually used after forward). \n
00158  * Notice that this function is used for images in the the frequency domain. \n
00159  * Image type must be complex.
00160  *
00161  * \verbatim im.ProcessSwapQuadrants(image: imImage, center2origin: number) [in Lua 5] \endverbatim
00162  * \ingroup fourier */
00163 void imProcessSwapQuadrants(imImage* image, int center2origin);
00164
00165
00166 #if defined(__cplusplus)
00167 }
00168 #endif
00169
00170 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_process_loc.h Source File

im_process_loc.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Image Processing - Local Operations
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_PROCESS_LOC_H
00008 #define __IM_PROCESS_LOC_H
00009
00010 #include "im_image.h"
00011
00012 #if     defined(__cplusplus)
00013 extern "C" {
00014 #endif
00015
00016
00017
00018 /** \defgroup resize Image Resize
00019  * \par
00020  * Operations to change the image size. \n
00021  * All size operations include the alpha channel if any.
00022  * \par
00023  * See \ref im_process_loc.h
00024  * \ingroup process */
00025
00026 /** Only reduze the image size using the given decimation order. \n
00027  * Supported decimation orders:
00028  * \li 0 - zero order (mean)
00029  * \li 1 - first order (bilinear decimation)
00030  * Images must be of the same type. If image type is IM_MAP or IM_BINARY, must use order=0. \n
00031  * Returns zero if the counter aborted.
00032  *
00033  * \verbatim im.ProcessReduce(src_image: imImage, dst_image: imImage, order: number) -> counter: boolean [in Lua 5] \endverbatim
00034  * \verbatim im.ProcessReduceNew(image: imImage, order: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00035  * \ingroup resize */
00036 int imProcessReduce(const imImage* src_image, imImage* dst_image, int order);
00037
00038 /** Change the image size using the given interpolation order. \n
00039  * Supported interpolation orders:
00040  * \li 0 - zero order (near neighborhood)
00041  * \li 1 - first order (bilinear interpolation)
00042  * \li 3 - third order (bicubic interpolation)
00043  * Images must be of the same type. If image type is IM_MAP or IM_BINARY, must use order=0. \n
00044  * Returns zero if the counter aborted.
00045  *
00046  * \verbatim im.ProcessResize(src_image: imImage, dst_image: imImage, order: number) -> counter: boolean [in Lua 5] \endverbatim
00047  * \verbatim im.ProcessResizeNew(image: imImage, order: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00048  * \ingroup resize */
00049 int imProcessResize(const imImage* src_image, imImage* dst_image, int order);
00050
00051 /** Reduze the image area by 4 (w/2,h/2). \n
00052  * Images must be of the same type. Destiny image size must be source image width/2, height/2.
00053  * Can not operate on IM_MAP nor IM_BINARY images.
00054  *
00055  * \verbatim im.ProcessReduceBy4(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00056  * \verbatim im.ProcessReduceBy4New(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00057  * \ingroup resize */
00058 void imProcessReduceBy4(const imImage* src_image, imImage* dst_image);
00059
00060 /** Extract a rectangular region from an image. \n
00061  * Images must be of the same type. Destiny image size must be smaller than source image width-xmin, height-ymin. \n
00062  * ymin and xmin must be >0 and <size.
00063  *
00064  * \verbatim im.ProcessCrop(src_image: imImage, dst_image: imImage, xmin: number, ymin: number) [in Lua 5] \endverbatim
00065  * \verbatim im.ProcessCropNew(image: imImage, xmin: number, xmax: number, ymin: number, ymax: number) -> new_image: imImage [in Lua 5] \endverbatim
00066  * \ingroup resize */
00067 void imProcessCrop(const imImage* src_image, imImage* dst_image, int xmin, int ymin);
00068
00069 /** Insert a rectangular region in an image. \n
00070  * Images must be of the same type. Region image size can be larger than source image. \n
00071  * ymin and xmin must be >0 and <size. \n
00072  * Source and destiny must be of the same size. Can be done in place.
00073  *
00074  * \verbatim im.ProcessInsert(src_image: imImage, region_image: imImage, dst_image: imImage, xmin: number, ymin: number) [in Lua 5] \endverbatim
00075  * \verbatim im.ProcessInsertNew(image: imImage, region_image: imImage, xmin: number, ymin: number) -> new_image: imImage [in Lua 5] \endverbatim
00076  * \ingroup resize */
00077 void imProcessInsert(const imImage* src_image, const imImage* region_image, imImage* dst_image, int xmin, int ymin);
00078
00079 /** Increase the image size by adding pixels with zero value. \n
00080  * Images must be of the same type. Destiny image size must be greatter than source image width+xmin, height+ymin.
00081  *
00082  * \verbatim im.ProcessAddMargins(src_image: imImage, dst_image: imImage, xmin: number, ymin: number) [in Lua 5] \endverbatim
00083  * \verbatim im.ProcessAddMarginsNew(image: imImage, xmin: number, xmax: number, ymin: number, ymax: number) -> new_image: imImage [in Lua 5] \endverbatim
00084  * \ingroup resize */
00085 void imProcessAddMargins(const imImage* src_image, imImage* dst_image, int xmin, int ymin);
00086
00087
00088
00089 /** \defgroup geom Geometric Operations
00090  * \par
00091  * Operations to change the shape of the image. \n
00092  * All geometric operations include the alpha channel if any.
00093  * \par
00094  * See \ref im_process_loc.h
00095  * \ingroup process */
00096
00097 /** Calculates the size of the new image after rotation.
00098  *
00099  * \verbatim im.ProcessCalcRotateSize(width: number, height: number, cos0: number, sin0: number) [in Lua 5] \endverbatim
00100  * \ingroup geom */
00101 void imProcessCalcRotateSize(int width, int height, int *new_width, int *new_height, double cos0, double sin0);
00102
00103 /** Rotates the image using the given interpolation order (see \ref imProcessResize). \n
00104  * Images must be of the same type. The destiny size can be calculated using \ref imProcessCalcRotateSize to fit the new image size,
00105  * or can be any size, including the original size. The rotation is relative to the center of the image. \n
00106  * Returns zero if the counter aborted.
00107  *
00108  * \verbatim im.ProcessRotate(src_image: imImage, dst_image: imImage, cos0: number, sin0: number, order: number) -> counter: boolean [in Lua 5] \endverbatim
00109  * \verbatim im.ProcessRotateNew(image: imImage, cos0: number, sin0: number, order: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00110  * \ingroup geom */
00111 int imProcessRotate(const imImage* src_image, imImage* dst_image, double cos0, double sin0, int order);
00112
00113 /** Rotates the image using the given interpolation order (see \ref imProcessResize). \n
00114  * Images must be of the same type. Destiny can have any size, including the original size. \n
00115  * The rotation is relative to the reference point. But the result can be shifted to the origin. \n
00116  * Returns zero if the counter aborted.
00117  *
00118  * \verbatim im.ProcessRotateRef(src_image: imImage, dst_image: imImage, cos0: number, sin0: number, x: number, y: number, to_origin: boolean, order: number) -> counter: boolean [in Lua 5] \endverbatim
00119  * \verbatim im.ProcessRotateRefNew(image: imImage, cos0: number, sin0: number, x: number, y: number, to_origin: boolean, order: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00120  * \ingroup geom */
00121 int imProcessRotateRef(const imImage* src_image, imImage* dst_image, double cos0, double sin0, int x, int y, int to_origin, int order);
00122
00123 /** Rotates the image in 90 degrees counterclockwise or clockwise. Swap columns by lines. \n
00124  * Images must be of the same type. Destiny width and height must be source height and width. \n
00125  * Direction can be clockwise (1) or counter clockwise (-1).
00126  *
00127  * \verbatim im.ProcessRotate90(src_image: imImage, dst_image: imImage, dir_clockwise: boolean) [in Lua 5] \endverbatim
00128  * \verbatim im.ProcessRotate90New(image: imImage, dir_clockwise: boolean) -> new_image: imImage [in Lua 5] \endverbatim
00129  * \ingroup geom */
00130 void imProcessRotate90(const imImage* src_image, imImage* dst_image, int dir_clockwise);
00131
00132 /** Rotates the image in 180 degrees. Swap columns and swap lines. \n
00133  * Images must be of the same type and size.
00134  *
00135  * \verbatim im.ProcessRotate180(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00136  * \verbatim im.ProcessRotate180New(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00137  * \ingroup geom */
00138 void imProcessRotate180(const imImage* src_image, imImage* dst_image);
00139
00140 /** Mirror the image in a horizontal flip. Swap columns. \n
00141  * Images must be of the same type and size.
00142  * Can be done in-place.
00143  *
00144  * \verbatim im.ProcessMirror(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00145  * \verbatim im.ProcessMirrorNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00146  * \ingroup geom */
00147 void imProcessMirror(const imImage* src_image, imImage* dst_image);
00148
00149 /** Apply a vertical flip. Swap lines. \n
00150  * Images must be of the same type and size.
00151  * Can be done in-place.
00152  *
00153  * \verbatim im.ProcessFlip(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00154  * \verbatim im.ProcessFlipNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00155  * \ingroup geom */
00156 void imProcessFlip(const imImage* src_image, imImage* dst_image);
00157
00158 /** Apply a radial distortion using the given interpolation order (see imProcessResize). \n
00159  * Images must be of the same type and size. Returns zero if the counter aborted.
00160  *
00161  * \verbatim im.ProcessRadial(src_image: imImage, dst_image: imImage, k1: number, order: number) -> counter: boolean [in Lua 5] \endverbatim
00162  * \verbatim im.ProcessRadialNew(image: imImage, k1: number, order: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00163  * \ingroup geom */
00164 int imProcessRadial(const imImage* src_image, imImage* dst_image, float k1, int order);
00165
00166 /** Apply a swirl distortion using the given interpolation order (see imProcessResize). \n
00167  * Images must be of the same type and size. Returns zero if the counter aborted.
00168  *
00169  * \verbatim im.ProcessSwirl(src_image: imImage, dst_image: imImage, k: number, order: number) -> counter: boolean [in Lua 5] \endverbatim
00170  * \verbatim im.ProcessSwirlNew(image: imImage, k: number, order: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00171  * \ingroup geom */
00172 int imProcessSwirl(const imImage* src_image, imImage* dst_image, float k1, int order);
00173
00174 /** Split the image in two images, one containing the odd lines and other containing the even lines. \n
00175  * Images must be of the same type. Height of the output images must be half the height of the input image.
00176  * If the height of the input image is odd then the first image must have height equals to half+1.
00177  *
00178  * \verbatim im.ProcessInterlaceSplit(src_image: imImage, dst_image1: imImage, dst_image2: imImage) [in Lua 5] \endverbatim
00179  * \verbatim im.ProcessInterlaceSplitNew(image: imImage) -> new_image1: imImage, new_image2: imImage [in Lua 5] \endverbatim
00180  * \ingroup geom */
00181 void imProcessInterlaceSplit(const imImage* src_image, imImage* dst_image1, imImage* dst_image2);
00182
00183
00184
00185 /** \defgroup morphgray Morphology Operations for Gray Images
00186  * \par
00187  * See \ref im_process_loc.h
00188  * \ingroup process */
00189
00190 /** Base gray morphology convolution. \n
00191  * Supports all data types except IM_CFLOAT. Can be applied on color images. \n
00192  * Kernel is always IM_INT. Use kernel size odd for better results. \n
00193  * Use -1 for don't care positions in kernel. Kernel values are added to image values, then \n
00194  * you can use the maximum or the minimum within the kernel area. \n
00195  * No border extensions are used.
00196  * All the gray morphology operations use this function. \n
00197  * If the kernel image attribute "Description" exists it is used by the counter.
00198  *
00199  * \verbatim im.ProcessGrayMorphConvolve(src_image: imImage, dst_image: imImage, kernel: imImage, ismax: boolean) -> counter: boolean [in Lua 5] \endverbatim
00200  * \verbatim im.ProcessGrayMorphConvolveNew(image: imImage, kernel: imImage, ismax: boolean) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00201  * \ingroup morphgray */
00202 int imProcessGrayMorphConvolve(const imImage* src_image, imImage* dst_image, const imImage* kernel, int ismax);
00203
00204 /** Gray morphology convolution with a kernel full of "0"s and use minimum value.
00205  *
00206  * \verbatim im.ProcessGrayMorphErode(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00207  * \verbatim im.ProcessGrayMorphErodeNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00208  * \ingroup morphgray */
00209 int imProcessGrayMorphErode(const imImage* src_image, imImage* dst_image, int kernel_size);
00210
00211 /** Gray morphology convolution with a kernel full of "0"s and use maximum value.
00212  *
00213  * \verbatim im.ProcessGrayMorphDilate(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00214  * \verbatim im.ProcessGrayMorphDilateNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00215  * \ingroup morphgray */
00216 int imProcessGrayMorphDilate(const imImage* src_image, imImage* dst_image, int kernel_size);
00217
00218 /** Erode+Dilate.
00219  *
00220  * \verbatim im.ProcessGrayMorphOpen(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00221  * \verbatim im.ProcessGrayMorphOpenNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00222  * \ingroup morphgray */
00223 int imProcessGrayMorphOpen(const imImage* src_image, imImage* dst_image, int kernel_size);
00224
00225 /** Dilate+Erode.
00226  *
00227  * \verbatim im.ProcessGrayMorphClose(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00228  * \verbatim im.ProcessGrayMorphCloseNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00229  * \ingroup morphgray */
00230 int imProcessGrayMorphClose(const imImage* src_image, imImage* dst_image, int kernel_size);
00231
00232 /** Open+Difference.
00233  *
00234  * \verbatim im.ProcessGrayMorphTopHat(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00235  * \verbatim im.ProcessGrayMorphTopHatNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00236  * \ingroup morphgray */
00237 int imProcessGrayMorphTopHat(const imImage* src_image, imImage* dst_image, int kernel_size);
00238
00239 /** Close+Difference.
00240  *
00241  * \verbatim im.ProcessGrayMorphWell(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00242  * \verbatim im.ProcessGrayMorphWellNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00243  * \ingroup morphgray */
00244 int imProcessGrayMorphWell(const imImage* src_image, imImage* dst_image, int kernel_size);
00245
00246 /** Difference(Erode, Dilate).
00247  *
00248  * \verbatim im.ProcessGrayMorphGradient(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00249  * \verbatim im.ProcessGrayMorphGradientNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00250  * \ingroup morphgray */
00251 int imProcessGrayMorphGradient(const imImage* src_image, imImage* dst_image, int kernel_size);
00252
00253
00254
00255 /** \defgroup morphbin Morphology Operations for Binary Images
00256  * \par
00257  * See \ref im_process_loc.h
00258  * \ingroup process */
00259
00260 /** Base binary morphology convolution. \n
00261  * Images are all IM_BINARY. Kernel is IM_INT, but values can be only 1, 0 or -1. Use kernel size odd for better results. \n
00262  * Hit white means hit=1 and miss=0, or else hit=0 and miss=1. \n
00263  * Use -1 for don't care positions in kernel. Kernel values are simply compared with image values. \n
00264  * The operation can be repeated by a number of iterations.
00265  * The border is zero extended. \n
00266  * Almost all the binary morphology operations use this function.\n
00267  * If the kernel image attribute "Description" exists it is used by the counter.
00268  *
00269  * \verbatim im.ProcessBinMorphConvolve(src_image: imImage, dst_image: imImage, kernel: imImage, hit_white: boolean, iter: number) -> counter: boolean [in Lua 5] \endverbatim
00270  * \verbatim im.ProcessBinMorphConvolveNew(image: imImage, kernel: imImage, hit_white: boolean, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00271  * \ingroup morphbin */
00272 int imProcessBinMorphConvolve(const imImage* src_image, imImage* dst_image, const imImage* kernel, int hit_white, int iter);
00273
00274 /** Binary morphology convolution with a kernel full of "1"s and hit white.
00275  *
00276  * \verbatim im.ProcessBinMorphErode(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5] \endverbatim
00277  * \verbatim im.ProcessBinMorphErodeNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00278  * \ingroup morphbin */
00279 int imProcessBinMorphErode(const imImage* src_image, imImage* dst_image, int kernel_size, int iter);
00280
00281 /** Binary morphology convolution with a kernel full of "0"s and hit black.
00282  *
00283  * \verbatim im.ProcessBinMorphDilate(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5] \endverbatim
00284  * \verbatim im.ProcessBinMorphDilateNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00285  * \ingroup morphbin */
00286 int imProcessBinMorphDilate(const imImage* src_image, imImage* dst_image, int kernel_size, int iter);
00287
00288 /** Erode+Dilate.
00289  * When iteration is more than one it means Erode+Erode+Erode+...+Dilate+Dilate+Dilate+...
00290  *
00291  * \verbatim im.ProcessBinMorphOpen(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5] \endverbatim
00292  * \verbatim im.ProcessBinMorphOpenNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00293  * \ingroup morphbin */
00294 int imProcessBinMorphOpen(const imImage* src_image, imImage* dst_image, int kernel_size, int iter);
00295
00296 /** Dilate+Erode.
00297  *
00298  * \verbatim im.ProcessBinMorphClose(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5] \endverbatim
00299  * \verbatim im.ProcessBinMorphCloseNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00300  * \ingroup morphbin */
00301 int imProcessBinMorphClose(const imImage* src_image, imImage* dst_image, int kernel_size, int iter);
00302
00303 /** Erode+Difference. \n
00304  * The difference from the source image is applied only once.
00305  *
00306  * \verbatim im.ProcessBinMorphOutline(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5] \endverbatim
00307  * \verbatim im.ProcessBinMorphOutlineNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00308  * \ingroup morphbin */
00309 int imProcessBinMorphOutline(const imImage* src_image, imImage* dst_image, int kernel_size, int iter);
00310
00311 /** Thins the supplied binary image using Rosenfeld's parallel thinning algorithm. \n
00312  * Reference: \n
00313  * "Efficient Binary Image Thinning using Neighborhood Maps" \n
00314  * by Joseph M. Cychosz, 3ksnn64@ecn.purdue.edu              \n
00315  * in "Graphics Gems IV", Academic Press, 1994
00316  *
00317  * \verbatim im.ProcessBinMorphThin(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00318  * \verbatim im.ProcessBinMorphThinNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00319  * \ingroup morphbin */
00320 void imProcessBinMorphThin(const imImage* src_image, imImage* dst_image);
00321
00322
00323
00324 /** \defgroup rank Rank Convolution Operations
00325  * \par
00326  * All the rank convolution use the same base function. Near the border the base function
00327  * includes only the real image pixels in the rank. No border extensions are used.
00328  * \par
00329  * See \ref im_process_loc.h
00330  * \ingroup process */
00331
00332 /** Rank convolution using the median value. \n
00333  * Returns zero if the counter aborted. \n
00334  * Supports all data types except IM_CFLOAT. Can be applied on color images.
00335  *
00336  * \verbatim im.ProcessMedianConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00337  * \verbatim im.ProcessMedianConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00338  * \ingroup rank */
00339 int imProcessMedianConvolve(const imImage* src_image, imImage* dst_image, int kernel_size);
00340
00341 /** Rank convolution using (maximum-minimum) value. \n
00342  * Returns zero if the counter aborted. \n
00343  * Supports all data types except IM_CFLOAT. Can be applied on color images.
00344  *
00345  * \verbatim im.ProcessRangeConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00346  * \verbatim im.ProcessRangeConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00347  * \ingroup rank */
00348 int imProcessRangeConvolve(const imImage* src_image, imImage* dst_image, int kernel_size);
00349
00350 /** Rank convolution using the closest maximum or minimum value. \n
00351  * Returns zero if the counter aborted. \n
00352  * Supports all data types except IM_CFLOAT. Can be applied on color images.
00353  *
00354  * \verbatim im.ProcessRankClosestConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00355  * \verbatim im.ProcessRankClosestConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00356  * \ingroup rank */
00357 int imProcessRankClosestConvolve(const imImage* src_image, imImage* dst_image, int kernel_size);
00358
00359 /** Rank convolution using the maximum value. \n
00360  * Returns zero if the counter aborted. \n
00361  * Supports all data types except IM_CFLOAT. Can be applied on color images.
00362  *
00363  * \verbatim im.ProcessRankMaxConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00364  * \verbatim im.ProcessRankMaxConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00365  * \ingroup rank */
00366 int imProcessRankMaxConvolve(const imImage* src_image, imImage* dst_image, int kernel_size);
00367
00368 /** Rank convolution using the minimum value. \n
00369  * Returns zero if the counter aborted. \n
00370  * Supports all data types except IM_CFLOAT. Can be applied on color images.
00371  *
00372  * \verbatim im.ProcessRankMinConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00373  * \verbatim im.ProcessRankMinConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00374  * \ingroup rank */
00375 int imProcessRankMinConvolve(const imImage* src_image, imImage* dst_image, int kernel_size);
00376
00377 /** Threshold using a rank convolution with a range contrast function. \n
00378  * Supports all integer IM_GRAY images as source, and IM_BINARY as destiny. \n
00379  * Local variable threshold by the method of Bernsen. \n
00380  * Extracted from XITE, Copyright 1991, Blab, UiO \n
00381  * http://www.ifi.uio.no/~blab/Software/Xite/
00382 \verbatim
00383   Reference:
00384     Bernsen, J: "Dynamic thresholding of grey-level images"
00385                 Proc. of the 8th ICPR, Paris, Oct 1986, 1251-1255.
00386   Author:     Oivind Due Trier
00387 \endverbatim
00388  * Returns zero if the counter aborted.
00389  *
00390  * \verbatim im.ProcessRangeContrastThreshold(src_image: imImage, dst_image: imImage, kernel_size: number, min_range: number) -> counter: boolean [in Lua 5] \endverbatim
00391  * \verbatim im.ProcessRangeContrastThresholdNew(image: imImage, kernel_size: number, min_range: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00392  * \ingroup threshold */
00393 int imProcessRangeContrastThreshold(const imImage* src_image, imImage* dst_image, int kernel_size, int min_range);
00394
00395 /** Threshold using a rank convolution with a local max function.  \n
00396  * Returns zero if the counter aborted. \n
00397  * Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.
00398  *
00399  * \verbatim im.ProcessLocalMaxThreshold(src_image: imImage, dst_image: imImage, kernel_size: number, min_level: number) -> counter: boolean [in Lua 5] \endverbatim
00400  * \verbatim im.ProcessLocalMaxThresholdNew(image: imImage, kernel_size: number, min_level: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00401  * \ingroup threshold */
00402 int imProcessLocalMaxThreshold(const imImage* src_image, imImage* dst_image, int kernel_size, int min_level);
00403
00404
00405
00406 /** \defgroup convolve Convolution Operations
00407  * \par
00408  * See \ref im_process_loc.h
00409  * \ingroup process */
00410
00411 /** Base Convolution with a kernel. \n
00412  * Kernel can be IM_INT or IM_FLOAT, but always IM_GRAY. Use kernel size odd for better results. \n
00413  * Supports all data types. The border is mirrored. \n
00414  * Returns zero if the counter aborted. Most of the convolutions use this function.\n
00415  * If the kernel image attribute "Description" exists it is used by the counter.
00416  *
00417  * \verbatim im.ProcessConvolve(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5] \endverbatim
00418  * \verbatim im.ProcessConvolveNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00419  * \ingroup convolve */
00420 int imProcessConvolve(const imImage* src_image, imImage* dst_image, const imImage* kernel);
00421
00422 /** Base convolution when the kernel is separable. Only the first line and the first column will be used. \n
00423  * Returns zero if the counter aborted.\n
00424  * If the kernel image attribute "Description" exists it is used by the counter.
00425  *
00426  * \verbatim im.ProcessConvolveSep(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5] \endverbatim
00427  * \verbatim im.ProcessConvolveSepNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00428  * \ingroup convolve */
00429 int imProcessConvolveSep(const imImage* src_image, imImage* dst_image, const imImage* kernel);
00430
00431 /** Base Convolution with two kernels. The result is the magnitude of the result of each convolution. \n
00432  * Kernel can be IM_INT or IM_FLOAT, but always IM_GRAY. Use kernel size odd for better results. \n
00433  * Supports all data types. The border is mirrored. \n
00434  * Returns zero if the counter aborted. Most of the convolutions use this function.\n
00435  * If the kernel image attribute "Description" exists it is used by the counter.
00436  *
00437  * \verbatim im.ProcessConvolveDual(src_image: imImage, dst_image: imImage, kernel1, kernel2: imImage) -> counter: boolean [in Lua 5] \endverbatim
00438  * \verbatim im.ProcessConvolveDualNew(image: imImage, kernel1, kernel2: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00439  * \ingroup convolve */
00440 int imProcessConvolveDual(const imImage* src_image, imImage* dst_image, const imImage *kernel1, const imImage *kernel2);
00441
00442 /** Repeats the convolution a number of times. \n
00443  * Returns zero if the counter aborted.\n
00444  * If the kernel image attribute "Description" exists it is used by the counter.
00445  *
00446  * \verbatim im.ProcessConvolveRep(src_image: imImage, dst_image: imImage, kernel: imImage, count: number) -> counter: boolean [in Lua 5] \endverbatim
00447  * \verbatim im.ProcessConvolveRepNew(image: imImage, kernel: imImage, count: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00448  * \ingroup convolve */
00449 int imProcessConvolveRep(const imImage* src_image, imImage* dst_image, const imImage* kernel, int count);
00450
00451 /** Convolve with a kernel rotating it 8 times and getting the absolute maximum value. \n
00452  * Kernel must be square. \n
00453  * The rotation is implemented only for kernel sizes 3x3, 5x5 and 7x7. \n
00454  * Supports all data types except IM_CFLOAT.
00455  * Returns zero if the counter aborted.\n
00456  * If the kernel image attribute "Description" exists it is used by the counter.
00457  *
00458  * \verbatim im.ProcessCompassConvolve(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5] \endverbatim
00459  * \verbatim im.ProcessCompassConvolveNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00460  * \ingroup convolve */
00461 int imProcessCompassConvolve(const imImage* src_image, imImage* dst_image, imImage* kernel);
00462
00463 /** Utility function to rotate a kernel one time.
00464  *
00465  * \verbatim im.ProcessRotateKernel(kernel: imImage) [in Lua 5] \endverbatim
00466  * \ingroup convolve */
00467 void imProcessRotateKernel(imImage* kernel);
00468
00469 /** Difference(Gaussian1, Gaussian2). \n
00470  * Supports all data types,
00471  * but if source is IM_BYTE or IM_USHORT destiny image must be of type IM_INT.
00472  *
00473  * \verbatim im.ProcessDiffOfGaussianConvolve(src_image: imImage, dst_image: imImage, stddev1: number, stddev2: number) -> counter: boolean [in Lua 5] \endverbatim
00474  * \verbatim im.ProcessDiffOfGaussianConvolveNew(image: imImage, stddev1: number, stddev2: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00475  * \ingroup convolve */
00476 int imProcessDiffOfGaussianConvolve(const imImage* src_image, imImage* dst_image, float stddev1, float stddev2);
00477
00478 /** Convolution with a laplacian of a gaussian kernel. \n
00479  * Supports all data types,
00480  * but if source is IM_BYTE or IM_USHORT destiny image must be of type IM_INT.
00481  *
00482  * \verbatim im.ProcessLapOfGaussianConvolve(src_image: imImage, dst_image: imImage, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
00483  * \verbatim im.ProcessLapOfGaussianConvolveNew(image: imImage, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00484  * \ingroup convolve */
00485 int imProcessLapOfGaussianConvolve(const imImage* src_image, imImage* dst_image, float stddev);
00486
00487 /** Convolution with a kernel full of "1"s inside a circle. \n
00488  * Supports all data types.
00489  *
00490  * \verbatim im.ProcessMeanConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00491  * \verbatim im.ProcessMeanConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00492  * \ingroup convolve */
00493 int imProcessMeanConvolve(const imImage* src_image, imImage* dst_image, int kernel_size);
00494
00495 /** Convolution with a float gaussian kernel. \n
00496  * If sdtdev is negative its magnitude will be used as the kernel size. \n
00497  * Supports all data types.
00498  *
00499  * \verbatim im.ProcessGaussianConvolve(src_image: imImage, dst_image: imImage, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
00500  * \verbatim im.ProcessGaussianConvolveNew(image: imImage, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00501  * \ingroup convolve */
00502 int imProcessGaussianConvolve(const imImage* src_image, imImage* dst_image, float stddev);
00503
00504 /** Convolution with a barlett kernel. \n
00505  * Supports all data types.
00506  *
00507  * \verbatim im.ProcessBarlettConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
00508  * \verbatim im.ProcessBarlettConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00509  * \ingroup convolve */
00510 int imProcessBarlettConvolve(const imImage* src_image, imImage* dst_image, int kernel_size);
00511
00512 /** Magnitude of the sobel convolution. \n
00513  * Supports all data types.
00514  *
00515  * \verbatim im.ProcessSobelConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] \endverbatim
00516  * \verbatim im.ProcessSobelConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00517  * \ingroup convolve */
00518 int imProcessSobelConvolve(const imImage* src_image, imImage* dst_image);
00519
00520 /** Magnitude of the prewitt convolution. \n
00521  * Supports all data types.
00522  *
00523  * \verbatim im.ProcessPrewittConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] \endverbatim
00524  * \verbatim im.ProcessPrewittConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00525  * \ingroup convolve */
00526 int imProcessPrewittConvolve(const imImage* src_image, imImage* dst_image);
00527
00528 /** Spline edge dectection. \n
00529  * Supports all data types.
00530  *
00531  * \verbatim im.ProcessSplineEdgeConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] \endverbatim
00532  * \verbatim im.ProcessSplineEdgeConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00533  * \ingroup convolve */
00534 int imProcessSplineEdgeConvolve(const imImage* src_image, imImage* dst_image);
00535
00536 /** Finds the zero crossings of IM_INT and IM_FLOAT images. Crossings are marked with non zero values
00537  * indicating the intensity of the edge. It is usually used after a second derivative, laplace. \n
00538  * Extracted from XITE, Copyright 1991, Blab, UiO \n
00539  * http://www.ifi.uio.no/~blab/Software/Xite/
00540  *
00541  * \verbatim im.ProcessZeroCrossing(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00542  * \verbatim im.ProcessZeroCrossingNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00543  * \ingroup convolve */
00544 void imProcessZeroCrossing(const imImage* src_image, imImage* dst_image);
00545
00546 /** First part of the Canny edge detector. Includes the gaussian filtering and the nonmax suppression. \n
00547  * After using this you could apply a Hysteresis Threshold, see \ref imProcessHysteresisThreshold. \n
00548  * Image must be IM_BYTE/IM_GRAY. \n
00549  * Implementation from the book:
00550  \verbatim
00551     J. R. Parker
00552     "Algoritms for Image Processing and Computer Vision"
00553     WILEY
00554  \endverbatim
00555  *
00556  * \verbatim im.ProcessCanny(src_image: imImage, dst_image: imImage, stddev: number) [in Lua 5] \endverbatim
00557  * \verbatim im.ProcessCannyNew(image: imImage, stddev: number) -> new_image: imImage [in Lua 5] \endverbatim
00558  * \ingroup convolve */
00559 void imProcessCanny(const imImage* src_image, imImage* dst_image, float stddev);
00560
00561 /** Calculates the kernel size given the standard deviation. \n
00562  * If sdtdev is negative its magnitude will be used as the kernel size.
00563  *
00564  * \verbatim im.GaussianStdDev2KernelSize(stddev: number) -> kernel_size: number [in Lua 5] \endverbatim
00565  * \ingroup convolve */
00566 int imGaussianStdDev2KernelSize(float stddev);
00567
00568 /** Calculates the standard deviation given the kernel size.
00569  *
00570  * \verbatim im.GaussianKernelSize2StdDev(kernel_size: number) -> stddev: number [in Lua 5] \endverbatim
00571  * \ingroup convolve */
00572 float imGaussianKernelSize2StdDev(int kernel_size);
00573
00574 /** Edge enhancement using Unsharp mask. stddev control the gaussian filter,
00575  *  amount controls how much the edges will enhance the image (0<amount<1), and
00576  *  threshold controls which edges will be considered, it compares to twice of the absolute size of the edge.
00577  *  Although very similar to \ref imProcessSharp, produces better results.
00578  *
00579  * \verbatim im.ProcessUnsharp(src_image: imImage, dst_image: imImage, stddev: number, amount: number, threshold: number) [in Lua 5] \endverbatim
00580  * \verbatim im.ProcessUnsharpNew(image: imImage, stddev: number, amount: number, threshold: number) -> new_image: imImage [in Lua 5] \endverbatim
00581  * \ingroup convolve */
00582 int imProcessUnsharp(const imImage* src_image, imImage* dst_image, float stddev, float amount, float threshold);
00583
00584 /** Edge enhancement using Laplacian8 mask.
00585  *  amount controls how much the edges will enhance the image (0<amount<1), and
00586  *  threshold controls which edges will be considered, it compares to twice of the absolute size of the edge.
00587  *
00588  * \verbatim im.ProcessSharp(src_image: imImage, dst_image: imImage, amount: number, threshold: number) [in Lua 5] \endverbatim
00589  * \verbatim im.ProcessSharpNew(image: imImage, amount: number, threshold: number) -> new_image: imImage [in Lua 5] \endverbatim
00590  * \ingroup convolve */
00591 int imProcessSharp(const imImage* src_image, imImage* dst_image, float amount, float threshold);
00592
00593 /** Edge enhancement using a given kernel.
00594  *  If kernel has all positive values, then the unsharp technique is used, else sharp is used.
00595  *  amount controls how much the edges will enhance the image (0<amount<1), and
00596  *  threshold controls which edges will be considered, it compares to twice of the absolute size of the edge.
00597  *
00598  * \verbatim im.ProcessSharp(src_image: imImage, dst_image: imImage, amount: number, threshold: number) [in Lua 5] \endverbatim
00599  * \verbatim im.ProcessSharpNew(image: imImage, amount: number, threshold: number) -> new_image: imImage [in Lua 5] \endverbatim
00600  * \ingroup convolve */
00601 int imProcessSharpKernel(const imImage* src_image, const imImage* kernel, imImage* dst_image, float amount, float threshold);
00602
00603
00604 #if defined(__cplusplus)
00605 }
00606 #endif
00607
00608 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_process_pon.h Source File

im_process_pon.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Image Processing - Pontual Operations
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_PROCESS_PON_H
00008 #define __IM_PROCESS_PON_H
00009
00010 #include "im_image.h"
00011
00012 #if     defined(__cplusplus)
00013 extern "C" {
00014 #endif
00015
00016
00017
00018 /** \defgroup arithm Arithmetic Operations
00019  * \par
00020  * Simple math operations for images.
00021  * \par
00022  * See \ref im_process_pon.h
00023  * \ingroup process */
00024
00025 /** Unary Arithmetic Operations. \n
00026  * Inverse and log may lead to math exceptions.
00027  * \ingroup arithm */
00028 enum imUnaryOp {
00029   IM_UN_EQL,    /**< equal             =     a        */
00030   IM_UN_ABS,    /**< abssolute         =    |a|       */
00031   IM_UN_LESS,   /**< less              =    -a        */
00032   IM_UN_INV,    /**< invert            =   1/a       (#) */
00033   IM_UN_SQR,    /**< square            =     a*a      */
00034   IM_UN_SQRT,   /**< square root       =     a^(1/2)  */
00035   IM_UN_LOG,    /**< natural logarithm =  ln(a)      (#) */
00036   IM_UN_EXP,    /**< exponential       = exp(a)       */
00037   IM_UN_SIN,    /**< sine              = sin(a)       */
00038   IM_UN_COS,    /**< cosine            = cos(a)       */
00039   IM_UN_CONJ,   /**< complex conjugate =     ar - ai*i                   */
00040   IM_UN_CPXNORM /**< complex normalization by magnitude = a / cpxmag(a)  */
00041 };
00042
00043 /** Apply an arithmetic unary operation. \n
00044  * Can be done in place, images must match size. \n
00045  * Destiny image can be several types depending on source: \n
00046  * \li byte -> byte, ushort, int, float
00047  * \li ushort -> byte, ushort, int, float
00048  * \li int -> byte, ushort, int, float
00049  * \li float -> float
00050  * \li complex -> complex
00051  * If destiny is byte, then the result is cropped to 0-255.
00052  *
00053  * \verbatim im.ProcessUnArithmeticOp(src_image: imImage, dst_image: imImage, op: number) [in Lua 5] \endverbatim
00054  * \verbatim im.ProcessUnArithmeticOpNew(image: imImage, op: number) -> new_image: imImage [in Lua 5] \endverbatim
00055  * \ingroup arithm */
00056 void imProcessUnArithmeticOp(const imImage* src_image, imImage* dst_image, int op);
00057
00058 /** Binary Arithmetic Operations. \n
00059  * Divide may lead to math exceptions.
00060  * \ingroup arithm */
00061 enum imBinaryOp {
00062   IM_BIN_ADD,    /**< add         =    a+b            */
00063   IM_BIN_SUB,    /**< subtract    =    a-b            */
00064   IM_BIN_MUL,    /**< multiply    =    a*b            */
00065   IM_BIN_DIV,    /**< divide      =    a/b            (#) */
00066   IM_BIN_DIFF,   /**< difference  =    |a-b|          */
00067   IM_BIN_POW,    /**< power       =    a^b            */
00068   IM_BIN_MIN,    /**< minimum     =    (a < b)? a: b  */
00069   IM_BIN_MAX     /**< maximum     =    (a > b)? a: b  */
00070 };
00071
00072 /** Apply a binary arithmetic operation. \n
00073  * Can be done in place, images must match size. \n
00074  * Source images must match type, destiny image can be several types depending on source: \n
00075  * \li byte -> byte, ushort, int, float
00076  * \li ushort -> ushort, int, float
00077  * \li int -> int, float
00078  * \li float -> float
00079  * \li complex -> complex
00080  * One exception is that you can combine complex with float resulting complex.
00081  * If destiny is byte, then the result is cropped to 0-255.
00082  *
00083  * \verbatim im.ProcessArithmeticOp(src_image1: imImage, src_image2: imImage, dst_image: imImage, op: number) [in Lua 5] \endverbatim
00084  * \verbatim im.ProcessArithmeticOpNew(image1: imImage, image2: imImage, op: number) -> new_image: imImage [in Lua 5] \endverbatim
00085  * The New function will create a new image of the same type of the source images.
00086  * \ingroup arithm */
00087 void imProcessArithmeticOp(const imImage* src_image1, const imImage* src_image2, imImage* dst_image, int op);
00088
00089 /** Apply a binary arithmetic operation with a constant value. \n
00090  * Can be done in place, images must match size. \n
00091  * Destiny image can be several types depending on source: \n
00092  * \li byte -> byte, ushort, int, float
00093  * \li ushort -> byte, ushort, int, float
00094  * \li int -> byte, ushort, int, float
00095  * \li float -> float
00096  * \li complex -> complex
00097  * The constant value is type casted to an apropriate type before the operation.
00098  * If destiny is byte, then the result is cropped to 0-255.
00099  *
00100  * \verbatim im.ProcessArithmeticConstOp(src_image: imImage, src_const: number, dst_image: imImage, op: number) [in Lua 5] \endverbatim
00101  * \verbatim im.ProcessArithmeticConstOpNew(image: imImage, src_const: number, op: number) -> new_image: imImage [in Lua 5] \endverbatim
00102  * \ingroup arithm */
00103 void imProcessArithmeticConstOp(const imImage* src_image, float src_const, imImage* dst_image, int op);
00104
00105 /** Blend two images using an alpha value = [a * alpha + b * (1 - alpha)]. \n
00106  * Can be done in place, images must match size and type. \n
00107  * alpha value must be in the interval [0.0 - 1.0].
00108  *
00109  * \verbatim im.ProcessBlendConst(src_image1: imImage, src_image2: imImage, dst_image: imImage, alpha: number) [in Lua 5] \endverbatim
00110  * \verbatim im.ProcessBlendConstNew(image1: imImage, image2: imImage, alpha: number) -> new_image: imImage [in Lua 5] \endverbatim
00111  * \ingroup arithm */
00112 void imProcessBlendConst(const imImage* src_image1, const imImage* src_image2, imImage* dst_image, float alpha);
00113
00114 /** Blend two images using an alpha channel = [a * alpha + b * (1 - alpha)]. \n
00115  * Can be done in place, images must match size and type. \n
00116  * alpha_image must have the same data type except for complex images that must be float, and color_space must be IM_GRAY.
00117  * integer alpha values must be:
00118 \verbatim
00119 0 - 255        IM_BYTE
00120 0 - 65535      IM_USHORT
00121 0 - 2147483647 IM_INT
00122 \endverbatim
00123  * that will be normalized to 0 - 1.
00124  * \verbatim im.ProcessBlend(src_image1: imImage, src_image2: imImage, alpha_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00125  * \verbatim im.ProcessBlendNew(image1: imImage, image2: imImage, alpha_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00126  * \ingroup arithm */
00127 void imProcessBlend(const imImage* src_image1, const imImage* src_image2, const imImage* alpha_image, imImage* dst_image);
00128
00129 /** Compose two images that have an alpha channel using the OVER operator. \n
00130  * Can be done in place, images must match size and type. \n
00131  * Integer alpha values must be:
00132 \verbatim
00133 0 - 255        IM_BYTE
00134 0 - 65535      IM_USHORT
00135 0 - 2147483647 IM_INT
00136 \endverbatim
00137  * that will be normalized to 0 - 1.
00138  * \verbatim im.ProcessCompose(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00139  * \verbatim im.ProcessComposeNew(image1: imImage, image2: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00140  * \ingroup arithm */
00141 void imProcessCompose(const imImage* src_image1, const imImage* src_image2, imImage* dst_image);
00142
00143 /** Split a complex image into two images with real and imaginary parts \n
00144  * or magnitude and phase parts (polar). \n
00145  * Source image must be IM_CFLOAT, destiny images must be IM_FLOAT.
00146  *
00147  * \verbatim im.ProcessSplitComplex(src_image: imImage, dst_image1: imImage, dst_image2: imImage, polar: boolean) [in Lua 5] \endverbatim
00148  * \verbatim im.ProcessSplitComplexNew(image: imImage, polar: boolean) -> dst_image1: imImage, dst_image2: imImage [in Lua 5] \endverbatim
00149  * \ingroup arithm */
00150 void imProcessSplitComplex(const imImage* src_image, imImage* dst_image1, imImage* dst_image2, int polar);
00151
00152 /** Merges two images as the real and imaginary parts of a complex image, \n
00153  * or as magnitude and phase parts (polar = 1). \n
00154  * Source images must be IM_FLOAT, destiny image must be IM_CFLOAT.
00155  *
00156  * \verbatim im.ProcessMergeComplex(src_image1: imImage, src_image2: imImage, dst_image: imImage, polar: boolean) [in Lua 5] \endverbatim
00157  * \verbatim im.ProcessMergeComplexNew(image1: imImage, image2: imImage, polar: boolean) -> new_image: imImage [in Lua 5] \endverbatim
00158  * \ingroup arithm */
00159 void imProcessMergeComplex(const imImage* src_image1, const imImage* src_image2, imImage* dst_image, int polar);
00160
00161 /** Calculates the mean of multiple images. \n
00162  * Images must match size and type.
00163  *
00164  * \verbatim im.ProcessMultipleMean(src_image_list: table of imImage, dst_image: imImage) [in Lua 5] \endverbatim
00165  * \verbatim im.ProcessMultipleMeanNew(src_image_list: table of imImage) -> new_image: imImage [in Lua 5] \endverbatim
00166  * \ingroup arithm */
00167 void imProcessMultipleMean(const imImage** src_image_list, int src_image_count, imImage* dst_image);
00168
00169 /** Calculates the standard deviation of multiple images. \n
00170  * Images must match size and type. Use \ref imProcessMultipleMean to calculate the mean_image.
00171  *
00172  * \verbatim im.ProcessMultipleStdDev(src_image_list: table of imImage, mean_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00173  * \verbatim im.ProcessMultipleStdDevNew(src_image_list: table of imImage, mean_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00174  * \ingroup arithm */
00175 void imProcessMultipleStdDev(const imImage** src_image_list, int src_image_count, const imImage *mean_image, imImage* dst_image);
00176
00177 /** Calculates the auto-covariance of an image with the mean of a set of images. \n
00178  * Images must match size and type. Returns zero if the counter aborted. \n
00179  * Destiny is IM_FLOAT.
00180  *
00181  * \verbatim im.ProcessAutoCovariance(src_image: imImage, mean_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] \endverbatim
00182  * \verbatim im.ProcessAutoCovarianceNew(src_image: imImage, mean_image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00183  * \ingroup arithm */
00184 int imProcessAutoCovariance(const imImage* src_image, const imImage* mean_image, imImage* dst_image);
00185
00186 /** Multiplies the conjugate of one complex image with another complex image. \n
00187  * Images must match size. Conj(img1) * img2 \n
00188  * Can be done in-place.
00189  *
00190  * \verbatim im.ProcessMultiplyConj(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00191  * \verbatim im.ProcessMultiplyConjNew(src_image1: imImage, src_image2: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00192  * \ingroup arithm */
00193 void imProcessMultiplyConj(const imImage* src_image1, const imImage* src_image2, imImage* dst_image);
00194
00195
00196
00197 /** \defgroup quantize Additional Image Quantization Operations
00198  * \par
00199  * Additionally operations to the \ref imConvertColorSpace function.
00200  * \par
00201  * See \ref im_process_pon.h
00202  * \ingroup process */
00203
00204 /** Converts a RGB image to a MAP image using uniform quantization
00205  * with an optional 8x8 ordered dither. The RGB image must have data type IM_BYTE.
00206  *
00207  * \verbatim im.ProcessQuantizeRGBUniform(src_image: imImage, dst_image: imImage, do_dither: boolean) [in Lua 5] \endverbatim
00208  * \verbatim im.ProcessQuantizeRGBUniformNew(src_image: imImage, do_dither: boolean) -> new_image: imImage [in Lua 5] \endverbatim
00209  * \ingroup quantize */
00210 void imProcessQuantizeRGBUniform(const imImage* src_image, imImage* dst_image, int do_dither);
00211
00212 /** Quantizes a gray scale image in less that 256 grays using uniform quantization. \n
00213  * Both images must be IM_BYTE/IM_GRAY. Can be done in place.
00214  *
00215  * \verbatim im.ProcessQuantizeGrayUniform(src_image: imImage, dst_image: imImage, grays: number) [in Lua 5] \endverbatim
00216  * \verbatim im.ProcessQuantizeGrayUniformNew(src_image: imImage, grays: number) -> new_image: imImage [in Lua 5] \endverbatim
00217  * \ingroup quantize */
00218 void imProcessQuantizeGrayUniform(const imImage* src_image, imImage* dst_image, int grays);
00219
00220
00221
00222 /** \defgroup histo Histogram Based Operations
00223  * \par
00224  * See \ref im_process_pon.h
00225  * \ingroup process */
00226
00227 /** Performs an histogram expansion based on a percentage of the number of pixels. \n
00228  * Percentage defines an amount of pixels to include at the lowest level and at the highest level.
00229  * If its is zero only empty counts of the histogram will be considered. \n
00230  * Images must be IM_BYTE/(IM_RGB or IM_GRAY). Can be done in place. \n
00231  * To expand the gammut without using the histogram, by just specifing the lowest and highest levels
00232  * use the \ref IM_GAMUT_EXPAND tone gammut operation (\ref imProcessToneGamut).
00233  *
00234  * \verbatim im.ProcessExpandHistogram(src_image: imImage, dst_image: imImage, percent: number) [in Lua 5] \endverbatim
00235  * \verbatim im.ProcessExpandHistogramNew(src_image: imImage, percent: number) -> new_image: imImage [in Lua 5] \endverbatim
00236  * \ingroup histo */
00237 void imProcessExpandHistogram(const imImage* src_image, imImage* dst_image, float percent);
00238
00239 /** Performs an histogram equalization. \n
00240  * Images must be IM_BYTE/(IM_RGB or IM_GRAY). Can be done in place.
00241  *
00242  * \verbatim im.ProcessEqualizeHistogram(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00243  * \verbatim im.ProcessEqualizeHistogramNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00244  * \ingroup histo */
00245 void imProcessEqualizeHistogram(const imImage* src_image, imImage* dst_image);
00246
00247
00248
00249 /** \defgroup colorproc Color Processing Operations
00250  * \par
00251  * Operations to change the color components configuration.
00252  * \par
00253  * See \ref im_process_pon.h
00254  * \ingroup process */
00255
00256 /** Split a RGB image into luma and chroma. \n
00257  * Chroma is calculated as R-Y,G-Y,B-Y. Source image must be IM_RGB/IM_BYTE. \n
00258  * luma image is IM_GRAY/IM_BYTE and chroma is IM_RGB/IM_BYTE. \n
00259  * Source and destiny must have the same size.
00260  *
00261  * \verbatim im.ProcessSplitYChroma(src_image: imImage, y_image: imImage, chroma_image: imImage) [in Lua 5] \endverbatim
00262  * \verbatim im.ProcessSplitYChromaNew(src_image: imImage) -> y_image: imImage, chroma_image: imImage [in Lua 5] \endverbatim
00263  * \ingroup colorproc */
00264 void imProcessSplitYChroma(const imImage* src_image, imImage* y_image, imImage* chroma_image);
00265
00266 /** Split a RGB image into HSI planes. \n
00267  * Source image must be IM_RGB/IM_BYTE,IM_FLOAT. Destiny images are all IM_GRAY/IM_FLOAT. \n
00268  * Source images must normalized to 0-1 if type is IM_FLOAT (\ref imProcessToneGamut can be used). See \ref hsi for a definition of the color conversion.\n
00269  * Source and destiny must have the same size.
00270  *
00271  * \verbatim im.ProcessSplitHSI(src_image: imImage, h_image: imImage, s_image: imImage, i_image: imImage) [in Lua 5] \endverbatim
00272  * \verbatim im.ProcessSplitHSINew(src_image: imImage) -> h_image: imImage, s_image: imImage, i_image: imImage [in Lua 5] \endverbatim
00273  * \ingroup colorproc */
00274 void imProcessSplitHSI(const imImage* src_image, imImage* h_image, imImage* s_image, imImage* i_image);
00275
00276 /** Merge HSI planes into a RGB image. \n
00277  * Source images must be IM_GRAY/IM_FLOAT. Destiny image can be IM_RGB/IM_BYTE,IM_FLOAT. \n
00278  * Source and destiny must have the same size. See \ref hsi for a definition of the color conversion.
00279  *
00280  * \verbatim im.ProcessMergeHSI(h_image: imImage, s_image: imImage, i_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00281  * \verbatim im.ProcessMergeHSINew(h_image: imImage, s_image: imImage, i_image: imImage) -> dst_image: imImage [in Lua 5] \endverbatim
00282  * \ingroup colorproc */
00283 void imProcessMergeHSI(const imImage* h_image, const imImage* s_image, const imImage* i_image, imImage* dst_image);
00284
00285 /** Split a multicomponent image into separate components, including alpha.\n
00286  * Destiny images must be IM_GRAY. Size and data types must be all the same.\n
00287  * The number of destiny images must match the depth of the source image, including alpha.
00288  *
00289  * \verbatim im.ProcessSplitComponents(src_image: imImage, dst_image_list: table of imImage) [in Lua 5] \endverbatim
00290  * \verbatim im.ProcessSplitComponentsNew(src_image: imImage) -> dst_image_list: table of imImage [in Lua 5] \endverbatim
00291  * \ingroup colorproc */
00292 void imProcessSplitComponents(const imImage* src_image, imImage** dst_image_list);
00293
00294 /** Merges separate components into a multicomponent image, including alpha.\n
00295  * Source images must be IM_GRAY. Size and data types must be all the same.\n
00296  * The number of source images must match the depth of the destiny image, including alpha.
00297  *
00298  * \verbatim im.ProcessMergeComponents(src_image_list: table of imImage, dst_image: imImage) [in Lua 5] \endverbatim
00299  * \verbatim im.ProcessMergeComponentsNew(src_image_list: table of imImage) -> dst_image: imImage [in Lua 5] \endverbatim
00300  * \ingroup colorproc */
00301 void imProcessMergeComponents(const imImage** src_image_list, imImage* dst_image);
00302
00303 /** Normalize the color components by their sum. Example: c1 = c1/(c1+c2+c3). \n
00304  * Destiny image must be IM_FLOAT.
00305  *
00306  * \verbatim im.ProcessNormalizeComponents(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00307  * \verbatim im.ProcessNormalizeComponentsNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00308  * \ingroup colorproc */
00309 void imProcessNormalizeComponents(const imImage* src_image, imImage* dst_image);
00310
00311 /** Replaces the source color by the destiny color. \n
00312  * The color will be type casted to the image data type. \n
00313  * The colors must have the same number of components of the images. \n
00314  * Supports all color spaces and all data types except IM_CFLOAT.
00315  *
00316  * \verbatim im.ProcessReplaceColor(src_image: imImage, dst_image: imImage, src_color: table of numbers, dst_color: table of numbers) [in Lua 5] \endverbatim
00317  * \verbatim im.ProcessReplaceColorNew(src_image: imImage, src_color: table of numbers, dst_color: table of numbers) -> new_image: imImage [in Lua 5] \endverbatim
00318  * \ingroup colorproc */
00319 void imProcessReplaceColor(const imImage* src_image, imImage* dst_image, float* src_color, float* dst_color);
00320
00321
00322
00323 /** \defgroup logic Logical Arithmetic Operations
00324  * \par
00325  * Logical binary math operations for images.
00326  * \par
00327  * See \ref im_process_pon.h
00328  * \ingroup process */
00329
00330 /** Logical Operations.
00331  * \ingroup logic */
00332 enum imLogicOp {
00333   IM_BIT_AND,   /**< and  =   a & b   */
00334   IM_BIT_OR,    /**< or   =   a | b   */
00335   IM_BIT_XOR    /**< xor  = ~(a | b)  */
00336 };
00337
00338 /** Apply a logical operation.\n
00339  * Images must have data type IM_BYTE, IM_USHORT or IM_INT. Can be done in place.
00340  *
00341  * \verbatim im.ProcessBitwiseOp(src_image1: imImage, src_image2: imImage, dst_image: imImage, op: number) [in Lua 5] \endverbatim
00342  * \verbatim im.ProcessBitwiseOpNew(src_image1: imImage, src_image2: imImage, op: number) -> new_image: imImage [in Lua 5] \endverbatim
00343  * \ingroup logic */
00344 void imProcessBitwiseOp(const imImage* src_image1, const imImage* src_image2, imImage* dst_image, int op);
00345
00346 /** Apply a logical NOT operation.\n
00347  * Images must have data type IM_BYTE, IM_USHORT or IM_INT. Can be done in place.
00348  *
00349  * \verbatim im.ProcessBitwiseNot(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00350  * \verbatim im.ProcessBitwiseNotNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00351  * \ingroup logic */
00352 void imProcessBitwiseNot(const imImage* src_image, imImage* dst_image);
00353
00354 /** Apply a bit mask. \n
00355  * The same as imProcessBitwiseOp but the second image is replaced by a fixed mask. \n
00356  * Images must have data type IM_BYTE. It is valid only for AND, OR and XOR. Can be done in place.
00357  *
00358  * \verbatim im.ProcessBitMask(src_image: imImage, dst_image: imImage, mask: string, op: number) [in Lua 5] \endverbatim
00359  * \verbatim im.ProcessBitMaskNew(src_image: imImage, mask: string, op: number) -> new_image: imImage [in Lua 5] \endverbatim
00360  * In Lua, mask is a string with 0s and 1s, for example: "11001111".
00361  * \ingroup logic */
00362 void imProcessBitMask(const imImage* src_image, imImage* dst_image, unsigned char mask, int op);
00363
00364 /** Extract or Reset a bit plane. For ex: 000X0000 or XXX0XXXX (plane=3).\n
00365  * Images must have data type IM_BYTE. Can be done in place.
00366  *
00367  * \verbatim im.ProcessBitPlane(src_image: imImage, dst_image: imImage, plane: number, do_reset: boolean) [in Lua 5] \endverbatim
00368  * \verbatim im.ProcessBitPlaneNew(src_image: imImage, plane: number, do_reset: boolean) -> new_image: imImage [in Lua 5] \endverbatim
00369  * \ingroup logic */
00370 void imProcessBitPlane(const imImage* src_image, imImage* dst_image, int plane, int do_reset);
00371
00372
00373
00374 /** \defgroup render Synthetic Image Render
00375  * \par
00376  * Renders some 2D mathematical functions as images. All the functions operates in place
00377  * and supports all data types except IM_CFLOAT.
00378  * \par
00379  * See \ref im_process_pon.h
00380  * \ingroup process */
00381
00382 /** Render Funtion.
00383  * \verbatim render_func(x: number, y: number, d: number, param: table of number) -> value: number [in Lua 5] \endverbatim
00384  * \ingroup render */
00385 typedef float (*imRenderFunc)(int x, int y, int d, float* param);
00386
00387 /** Render Conditional Funtion.
00388  * \verbatim render_cond_func(x: number, y: number, d: number, param: table of number) -> value: number, cond: boolean [in Lua 5] \endverbatim
00389  * \ingroup render */
00390 typedef float (*imRenderCondFunc)(int x, int y, int d, int *cond, float* param);
00391
00392 /** Render a synthetic image using a render function. \n
00393  * plus will make the render be added to the current image data,
00394  * or else all data will be replaced. All the render functions use this or the conditional function. \n
00395  * Returns zero if the counter aborted.
00396  *
00397  * \verbatim im.ProcessRenderOp(image: imImage, render_func: function, render_name: string, param: table of number, plus: boolean) -> counter: boolean [in Lua 5] \endverbatim
00398  * \ingroup render */
00399 int imProcessRenderOp(imImage* image, imRenderFunc render_func, char* render_name, float* param, int plus);
00400
00401 /** Render a synthetic image using a conditional render function. \n
00402  * Data will be rendered only if the condional param is true. \n
00403  * Returns zero if the counter aborted.
00404  *
00405  * \verbatim im.ProcessRenderCondOp(image: imImage, render_cond_func: function, render_name: string, param: table of number) -> counter: boolean [in Lua 5] \endverbatim
00406  * \ingroup render */
00407 int imProcessRenderCondOp(imImage* image, imRenderCondFunc render_cond_func, char* render_name, float* param);
00408
00409 /** Render speckle noise on existing data. Can be done in place.
00410  *
00411  * \verbatim im.ProcessRenderAddSpeckleNoise(src_image: imImage, dst_image: imImage, percent: number) -> counter: boolean [in Lua 5] \endverbatim
00412  * \verbatim im.ProcessRenderAddSpeckleNoiseNew(src_image: imImage, percent: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00413  * \ingroup render */
00414 int imProcessRenderAddSpeckleNoise(const imImage* src_image, imImage* dst_image, float percent);
00415
00416 /** Render gaussian noise on existing data. Can be done in place.
00417  *
00418  * \verbatim im.ProcessRenderAddGaussianNoise(src_image: imImage, dst_image: imImage, mean: number, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
00419  * \verbatim im.ProcessRenderAddGaussianNoiseNew(src_image: imImage, mean: number, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00420  * \ingroup render */
00421 int imProcessRenderAddGaussianNoise(const imImage* src_image, imImage* dst_image, float mean, float stddev);
00422
00423 /** Render uniform noise on existing data. Can be done in place.
00424  *
00425  * \verbatim im.ProcessRenderAddUniformNoise(src_image: imImage, dst_image: imImage, mean: number, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
00426  * \verbatim im.ProcessRenderAddUniformNoiseNew(src_image: imImage, mean: number, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00427  * \ingroup render */
00428 int imProcessRenderAddUniformNoise(const imImage* src_image, imImage* dst_image, float mean, float stddev);
00429
00430 /** Render random noise.
00431  *
00432  * \verbatim im.ProcessRenderRandomNoise(image: imImage) -> counter: boolean [in Lua 5] \endverbatim
00433  * \ingroup render */
00434 int imProcessRenderRandomNoise(imImage* image);
00435
00436 /** Render a constant. The number of values must match the depth of the image.
00437  *
00438  * \verbatim im.ProcessRenderConstant(image: imImage, value: table of number) -> counter: boolean [in Lua 5] \endverbatim
00439  * \ingroup render */
00440 int imProcessRenderConstant(imImage* image, float* value);
00441
00442 /** Render a centered wheel.
00443  *
00444  * \verbatim im.ProcessRenderWheel(image: imImage, internal_radius: number, external_radius: number) -> counter: boolean [in Lua 5] \endverbatim
00445  * \ingroup render */
00446 int imProcessRenderWheel(imImage* image, int internal_radius, int external_radius);
00447
00448 /** Render a centered cone.
00449  *
00450  * \verbatim im.ProcessRenderCone(image: imImage, radius: number) -> counter: boolean [in Lua 5] \endverbatim
00451  * \ingroup render */
00452 int imProcessRenderCone(imImage* image, int radius);
00453
00454 /** Render a centered tent.
00455  *
00456  * \verbatim im.ProcessRenderTent(image: imImage, tent_width: number, tent_height: number) -> counter: boolean [in Lua 5] \endverbatim
00457  * \ingroup render */
00458 int imProcessRenderTent(imImage* image, int tent_width, int tent_height);
00459
00460 /** Render a ramp. Direction can be vertical (1) or horizontal (0).
00461  *
00462  * \verbatim im.ProcessRenderRamp(image: imImage, start: number, end: number, vert_dir: boolean) -> counter: boolean [in Lua 5] \endverbatim
00463  * \ingroup render */
00464 int imProcessRenderRamp(imImage* image, int start, int end, int vert_dir);
00465
00466 /** Render a centered box.
00467  *
00468  * \verbatim im.ProcessRenderBox(image: imImage, box_width: number, box_height: number) -> counter: boolean [in Lua 5] \endverbatim
00469  * \ingroup render */
00470 int imProcessRenderBox(imImage* image, int box_width, int box_height);
00471
00472 /** Render a centered sinc.
00473  *
00474  * \verbatim im.ProcessRenderSinc(image: imImage, x_period: number, y_period: number) -> counter: boolean [in Lua 5] \endverbatim
00475  * \ingroup render */
00476 int imProcessRenderSinc(imImage* image, float x_period, float y_period);
00477
00478 /** Render a centered gaussian.
00479  *
00480  * \verbatim im.ProcessRenderGaussian(image: imImage, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
00481  * \ingroup render */
00482 int imProcessRenderGaussian(imImage* image, float stddev);
00483
00484 /** Render the laplacian of a centered gaussian.
00485  *
00486  * \verbatim im.ProcessRenderLapOfGaussian(image: imImage, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
00487  * \ingroup render */
00488 int imProcessRenderLapOfGaussian(imImage* image, float stddev);
00489
00490 /** Render a centered cosine.
00491  *
00492  * \verbatim im.ProcessRenderCosine(image: imImage, x_period: number, y_period: number) -> counter: boolean [in Lua 5] \endverbatim
00493  * \ingroup render */
00494 int imProcessRenderCosine(imImage* image, float x_period, float y_period);
00495
00496 /** Render a centered grid.
00497  *
00498  * \verbatim im.ProcessRenderGrid(image: imImage, x_space: number, y_space: number) -> counter: boolean [in Lua 5] \endverbatim
00499  * \ingroup render */
00500 int imProcessRenderGrid(imImage* image, int x_space, int y_space);
00501
00502 /** Render a centered chessboard.
00503  *
00504  * \verbatim im.ProcessRenderChessboard(image: imImage, x_space: number, y_space: number) -> counter: boolean [in Lua 5] \endverbatim
00505  * \ingroup render */
00506 int imProcessRenderChessboard(imImage* image, int x_space, int y_space);
00507
00508
00509
00510 /** \defgroup tonegamut Tone Gamut Operations
00511  * \par
00512  * Operations that try to preserve the min-max interval in the output (the dynamic range).
00513  * \par
00514  * See \ref im_process_pon.h
00515  * \ingroup process */
00516
00517
00518 /** Tone Gamut Operations.
00519  * \ingroup tonegamut */
00520 enum imToneGamut {
00521   IM_GAMUT_NORMALIZE, /**< normalize = (a-min) / (max-min)     (destiny image must be IM_FLOAT)   */
00522   IM_GAMUT_POW,       /**< pow       = ((a-min) / (max-min))^gamma * (max-min) + min                  \n
00523                                        param[0]=gamma                                             */
00524   IM_GAMUT_LOG,       /**< log       = log(K * (a-min) / (max-min) + 1))*(max-min)/log(K+1) + min     \n
00525                                        param[0]=K     (K>0)                                       */
00526   IM_GAMUT_EXP,       /**< exp       = (exp(K * (a-min) / (max-min)) - 1))*(max-min)/(exp(K)-1) + min \n
00527                                        param[0]=K                                                 */
00528   IM_GAMUT_INVERT,    /**< invert    = max - (a-min)                                              */
00529   IM_GAMUT_ZEROSTART, /**< zerostart = a - min                                                    */
00530   IM_GAMUT_SOLARIZE,  /**< solarize  = a < level ?  a:  (level * (max-min) - a * (level-min)) / (max-level) \n
00531                                        param[0]=level percentage (0-100) relative to min-max      \n
00532                                        photography solarization effect. */
00533   IM_GAMUT_SLICE,     /**< slice     = start < a || a > end ?  min:  binarize?  max: a                     \n
00534                                        param[0]=start,  param[1]=end,  param[2]=binarize          */
00535   IM_GAMUT_EXPAND,    /**< expand    = a < start ?  min: a > end ? max :  (a-start)*(max-min)/(end-start) + min  \n
00536                                        param[0]=start,  param[1]=end                              */
00537   IM_GAMUT_CROP,      /**< crop      = a < start ?  start: a > end ? end : a                                        \n
00538                                        param[0]=start,  param[1]=end                              */
00539   IM_GAMUT_BRIGHTCONT /**< brightcont = a < min ?  min:  a > max ?  max:  a * tan(c_a) + b_s + (max-min)*(1 - tan(c_a))/2  \n
00540                                         param[0]=bright_shift (-100%..+100%),  param[1]=contrast_factor (-100%..+100%)     \n
00541                                         change brightness and contrast simultaneously. */
00542 };
00543
00544 /** Apply a gamut operation with arguments. \n
00545  * Supports all data types except IM_CFLOAT. \n
00546  * The linear operation do a special convertion when min > 0 and max < 1, it forces min=0 and max=1. \n
00547  * IM_BYTE images have min=0 and max=255 always. \n
00548  * Can be done in place. When there is no extra params, can use NULL.
00549  *
00550  * \verbatim im.ProcessToneGamut(src_image: imImage, dst_image: imImage, op: number, param: table of number) [in Lua 5] \endverbatim
00551  * \verbatim im.ProcessToneGamutNew(src_image: imImage, op: number, param: table of number) -> new_image: imImage [in Lua 5] \endverbatim
00552  * \ingroup tonegamut */
00553 void imProcessToneGamut(const imImage* src_image, imImage* dst_image, int op, float* param);
00554
00555 /** Converts from (0-1) to (0-255), crop out of bounds values. \n
00556  * Source image must be IM_FLOAT, and destiny image must be IM_BYTE.
00557  *
00558  * \verbatim im.ProcessUnNormalize(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00559  * \verbatim im.ProcessUnNormalizeNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00560  * \ingroup tonegamut */
00561 void imProcessUnNormalize(const imImage* src_image, imImage* dst_image);
00562
00563 /** Directly converts IM_USHORT, IM_INT and IM_FLOAT into IM_BYTE images. \n
00564  * This can also be done using \ref imConvertDataType with IM_CAST_DIRECT.
00565  *
00566  * \verbatim im.ProcessDirectConv(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00567  * \verbatim im.ProcessDirectConvNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00568  * \ingroup tonegamut */
00569 void imProcessDirectConv(const imImage* src_image, imImage* dst_image);
00570
00571 /** A negative effect. Uses \ref imProcessToneGamut with IM_GAMUT_INVERT for non MAP images. \n
00572  * Supports all color spaces and all data types except IM_CFLOAT. \n
00573  * Can be done in place.
00574  *
00575  * \verbatim im.ProcessNegative(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00576  * \verbatim im.ProcessNegativeNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00577  * \ingroup tonegamut */
00578 void imProcessNegative(const imImage* src_image, imImage* dst_image);
00579
00580
00581
00582 /** \defgroup threshold Threshold Operations
00583  * \par
00584  * Operations that converts a usually IM_GRAY/IM_BYTE image into a IM_BINARY image using several threshold techniques.
00585  * \par
00586  * See \ref im_process_pon.h
00587  * \ingroup process */
00588
00589 /** Apply a manual threshold. \n
00590  * threshold = a <= level ? 0: value \n
00591  * Normal value is 1 but another common value is 255. Can be done in place for IM_BYTE source. \n
00592  * Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.
00593  *
00594  * \verbatim im.ProcessThreshold(src_image: imImage, dst_image: imImage, level: number, value: number) [in Lua 5] \endverbatim
00595  * \verbatim im.ProcessThresholdNew(src_image: imImage, level: number, value: number) -> new_image: imImage [in Lua 5] \endverbatim
00596  * \ingroup threshold */
00597 void imProcessThreshold(const imImage* src_image, imImage* dst_image, int level, int value);
00598
00599 /** Apply a threshold by the difference of two images. \n
00600  * threshold = a1 <= a2 ? 0: 1   \n
00601  * Can be done in place.
00602  *
00603  * \verbatim im.ProcessThresholdByDiff(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00604  * \verbatim im.ProcessThresholdByDiffNew(src_image1: imImage, src_image2: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00605  * \ingroup threshold */
00606 void imProcessThresholdByDiff(const imImage* src_image1, const imImage* src_image2, imImage* dst_image);
00607
00608 /** Apply a threshold by the Hysteresis method. \n
00609  * Hysteresis thersholding of edge pixels. Starting at pixels with a
00610  * value greater than the HIGH threshold, trace a connected sequence
00611  * of pixels that have a value greater than the LOW threhsold. \n
00612  * Supports only IM_BYTE images.
00613  * Note: could not find the original source code author name.
00614  *
00615  * \verbatim im.ProcessHysteresisThreshold(src_image: imImage, dst_image: imImage, low_thres: number, high_thres: number) [in Lua 5] \endverbatim
00616  * \verbatim im.ProcessHysteresisThresholdNew(src_image: imImage, low_thres: number, high_thres: number) -> new_image: imImage [in Lua 5] \endverbatim
00617  * \ingroup threshold */
00618 void imProcessHysteresisThreshold(const imImage* src_image, imImage* dst_image, int low_thres, int high_thres);
00619
00620 /** Estimates hysteresis low and high threshold levels. \n
00621  * Supports only IM_BYTE images.
00622  * Usefull for \ref imProcessHysteresisThreshold.
00623  *
00624  * \verbatim im.ProcessHysteresisThresEstimate(image: imImage) -> low_level: number, high_level: number [in Lua 5] \endverbatim
00625  * \ingroup threshold */
00626 void imProcessHysteresisThresEstimate(const imImage* image, int *low_level, int *high_level);
00627
00628 /** Calculates the threshold level for manual threshold using an uniform error approach. \n
00629  * Supports only IM_BYTE images.
00630  * Extracted from XITE, Copyright 1991, Blab, UiO \n
00631  * http://www.ifi.uio.no/~blab/Software/Xite/
00632 \verbatim
00633   Reference:
00634     S. M. Dunn & D. Harwood & L. S. Davis:
00635     "Local Estimation of the Uniform Error Threshold"
00636     IEEE Trans. on PAMI, Vol PAMI-6, No 6, Nov 1984.
00637   Comments: It only works well on images whith large objects.
00638   Author: Olav Borgli, BLAB, ifi, UiO
00639   Image processing lab, Department of Informatics, University of Oslo
00640 \endverbatim
00641  * Returns the used level.
00642  *
00643  * \verbatim im.ProcessUniformErrThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5] \endverbatim
00644  * \verbatim im.ProcessUniformErrThresholdNew(src_image: imImage)  -> level: number, new_image: imImage [in Lua 5] \endverbatim
00645  * \ingroup threshold */
00646 int imProcessUniformErrThreshold(const imImage* src_image, imImage* dst_image);
00647
00648 /** Apply a dithering on each image channel by using a difusion error method. \n
00649  * It can be applied on any IM_BYTE images. It will "threshold" each channel indivudually, so
00650  * source and destiny must be of the same depth.
00651  *
00652  * \verbatim im.ProcessDifusionErrThreshold(src_image: imImage, dst_image: imImage, level: number) [in Lua 5] \endverbatim
00653  * \verbatim im.ProcessDifusionErrThresholdNew(src_image: imImage, level: number) -> new_image: imImage [in Lua 5] \endverbatim
00654  * \ingroup threshold */
00655 void imProcessDifusionErrThreshold(const imImage* src_image, imImage* dst_image, int level);
00656
00657 /** Calculates the threshold level for manual threshold using a percentage of pixels
00658  * that should stay bellow the threshold. \n
00659  * Supports only IM_BYTE images.
00660  * Returns the used level.
00661  *
00662  * \verbatim im.ProcessPercentThreshold(src_image: imImage, dst_image: imImage, percent: number) -> level: number [in Lua 5] \endverbatim
00663  * \verbatim im.ProcessPercentThresholdNew(src_image: imImage, percent: number) -> level: number, new_image: imImage [in Lua 5] \endverbatim
00664  * \ingroup threshold */
00665 int imProcessPercentThreshold(const imImage* src_image, imImage* dst_image, float percent);
00666
00667 /** Calculates the threshold level for manual threshold using the Otsu approach. \n
00668  * Returns the used level. \n
00669  * Supports only IM_BYTE images.
00670  * Original implementation by Flavio Szenberg.
00671  *
00672  * \verbatim im.ProcessOtsuThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5] \endverbatim
00673  * \verbatim im.ProcessOtsuThresholdNew(src_image: imImage) -> level: number, new_image: imImage [in Lua 5] \endverbatim
00674  * \ingroup threshold */
00675 int imProcessOtsuThreshold(const imImage* src_image, imImage* dst_image);
00676
00677 /** Calculates the threshold level for manual threshold using (max-min)/2. \n
00678  * Returns the used level. \n
00679  * Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.
00680  *
00681  * \verbatim im.ProcessMinMaxThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5] \endverbatim
00682  * \verbatim im.ProcessMinMaxThresholdNew(src_image: imImage) -> level: number, new_image: imImage [in Lua 5] \endverbatim
00683  * \ingroup threshold */
00684 int imProcessMinMaxThreshold(const imImage* src_image, imImage* dst_image);
00685
00686 /** Estimates Local Max threshold level for IM_BYTE images.
00687  *
00688  * \verbatim im.ProcessLocalMaxThresEstimate(image: imImage) -> level: number [in Lua 5] \endverbatim
00689  * \ingroup threshold */
00690 void imProcessLocalMaxThresEstimate(const imImage* image, int *level);
00691
00692 /** Apply a manual threshold using an interval. \n
00693  * threshold = start_level <= a <= end_level ? 1: 0 \n
00694  * Normal value is 1 but another common value is 255. Can be done in place for IM_BYTE source. \n
00695  * Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.
00696  *
00697  * \verbatim im.ProcessSliceThreshold(src_image: imImage, dst_image: imImage, start_level: number, end_level: number) [in Lua 5] \endverbatim
00698  * \verbatim im.ProcessSliceThresholdNew(src_image: imImage, start_level: number, end_level: number) -> new_image: imImage [in Lua 5] \endverbatim
00699  * \ingroup threshold */
00700 void imProcessSliceThreshold(const imImage* src_image, imImage* dst_image, int start_level, int end_level);
00701
00702
00703 /** \defgroup effects Special Effects
00704  * \par
00705  * Operations to change image appearance.
00706  * \par
00707  * See \ref im_process_pon.h
00708  * \ingroup process */
00709
00710
00711 /** Generates a zoom in effect averaging colors inside a square region. \n
00712  * Operates only on IM_BYTE images.
00713  *
00714  * \verbatim im.ProcessPixelate(src_image: imImage, dst_image: imImage, box_size: number) [in Lua 5] \endverbatim
00715  * \verbatim im.ProcessPixelateNew(src_image: imImage, box_size: number) -> new_image: imImage [in Lua 5] \endverbatim
00716  * \ingroup effects */
00717 void imProcessPixelate(const imImage* src_image, imImage* dst_image, int box_size);
00718
00719 /** A simple Posterize effect. It reduces the number of colors in the image eliminating
00720  * less significant bit planes. Can have 1 to 7 levels. See \ref imProcessBitMask. \n
00721  * Images must have data type IM_BYTE.
00722  *
00723  * \verbatim im.ProcessPosterize(src_image: imImage, dst_image: imImage, level: number) [in Lua 5] \endverbatim
00724  * \verbatim im.ProcessPosterizeNew(src_image: imImage, level: number) -> new_image: imImage [in Lua 5] \endverbatim
00725  * \ingroup effects */
00726 void imProcessPosterize(const imImage* src_image, imImage* dst_image, int level);
00727
00728
00729
00730 #if defined(__cplusplus)
00731 }
00732 #endif
00733
00734 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_raw.h Source File

im_raw.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief RAW File Format
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_RAW_H
00008 #define __IM_RAW_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014
00015 /** Opens a RAW image file.
00016  * See also \ref imErrorCodes.
00017  *
00018  * \verbatim im.FileOpenRaw(file_name: string) -> ifile: imFile, error: number [in Lua 5] \endverbatim
00019  * \ingroup raw */
00020 imFile* imFileOpenRaw(const char* file_name, int *error);
00021
00022 /** Creates a RAW image file.
00023  * See also \ref imErrorCodes.
00024  *
00025  * \verbatim im.FileNewRaw(file_name: string) -> ifile: imFile, error: number [in Lua 5] \endverbatim
00026  * \ingroup raw */
00027 imFile* imFileNewRaw(const char* file_name, int *error);
00028
00029
00030 #if defined(__cplusplus)
00031 }
00032 #endif
00033
00034 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: im_util.h Source File

im_util.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Utilities
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_UTIL_H
00008 #define __IM_UTIL_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014
00015 /** \defgroup util Utilities
00016  * \par
00017  * See \ref im_util.h
00018  * @{
00019  */
00020
00021 #define IM_MIN(_a, _b) (_a < _b? _a: _b)
00022 #define IM_MAX(_a, _b) (_a > _b? _a: _b)
00023
00024 /** @} */
00025
00026
00027 /** \defgroup str String Utilities
00028  * \par
00029  * See \ref im_util.h
00030  * \ingroup util */
00031
00032 /** Check if the two strings are equal.
00033  * \ingroup str */
00034 int imStrEqual(const char* str1, const char* str2);
00035
00036 /** Calculate the size of the string but limited to max_len.
00037  * \ingroup str */
00038 int imStrNLen(const char* str, int max_len);
00039
00040 /** Check if the data is a string.
00041  * \ingroup str */
00042 int imStrCheck(const void* data, int count);
00043
00044
00045
00046 /** \defgroup imageutil Raw Data Utilities
00047  * \par
00048  * See \ref im_util.h
00049  * \ingroup imagerep */
00050
00051 /** Returns the size of the data buffer.
00052  *
00053  * \verbatim im.ImageDataSize(width: number, height: number, color_mode: number, data_type: number) -> datasize: number [in Lua 5] \endverbatim
00054  * \ingroup imageutil */
00055 int imImageDataSize(int width, int height, int color_mode, int data_type);
00056
00057 /** Returns the size of one line of the data buffer. \n
00058  * This depends if the components are packed. If packed includes all components, if not includes only one.
00059  *
00060  * \verbatim im.ImageLineSize(width: number, color_mode: number, data_type: number) -> linesize: number [in Lua 5] \endverbatim
00061  * \ingroup imageutil */
00062 int imImageLineSize(int width, int color_mode, int data_type);
00063
00064 /** Returns the number of elements of one line of the data buffer. \n
00065  * This depends if the components are packed. If packed includes all components, if not includes only one.
00066  *
00067  * \verbatim im.ImageLineCount(width: number, color_mode: number) -> linecount: number [in Lua 5] \endverbatim
00068  * \ingroup imageutil */
00069 int imImageLineCount(int width, int color_mode);
00070
00071 /** Check if the combination color_mode+data_type is valid.
00072  *
00073  * \verbatim im.ImageCheckFormat(color_mode: number, data_type: number) -> check: boolean [in Lua 5] \endverbatim
00074  * \ingroup imageutil */
00075 int imImageCheckFormat(int color_mode, int data_type);
00076
00077
00078
00079 /** \defgroup colorutl Color Utilities
00080  * \par
00081  * See \ref im_util.h
00082  * \ingroup util */
00083
00084 /** Encode RGB components in a long for palete usage. \n
00085  * "long" definition is compatible with the CD library definition.
00086  *
00087  * \verbatim im.ColorEncode(red: number, green: number, blue: number) -> color: lightuserdata [in Lua 5] \endverbatim
00088  * \ingroup colorutl */
00089 long imColorEncode(unsigned char red, unsigned char green, unsigned char blue);
00090
00091 /** Decode RGB components from a long for palete usage. \n
00092  * "long" definition is compatible with the CD library definition.
00093  *
00094  * \verbatim im.ColorDecode(color: lightuserdata) -> red: number, green: number, blue: number [in Lua 5] \endverbatim
00095  * \ingroup colorutl */
00096 void imColorDecode(unsigned char *red, unsigned char *green, unsigned char *blue, long color);
00097
00098
00099
00100 /** \defgroup colormodeutl Color Mode Utilities
00101  * \par
00102  * See \ref im_util.h
00103  * \ingroup imagerep */
00104
00105 /** Returns the color mode name.
00106  *
00107  * \verbatim im.ColorModeSpaceName(color_mode: number) -> name: string [in Lua 5] \endverbatim
00108  * \ingroup colormodeutl */
00109 const char* imColorModeSpaceName(int color_mode);
00110
00111 /** Returns the number of components of the color space including alpha.
00112  *
00113  * \verbatim im.ColorModeDepth(color_mode: number) -> depth: number [in Lua 5] \endverbatim
00114  * \ingroup colormodeutl */
00115 int imColorModeDepth(int color_mode);
00116
00117 /** Returns the color space of the color mode.
00118  *
00119  * \verbatim im.ColorModeSpace(color_mode: number) -> color_space: number [in Lua 5] \endverbatim
00120  * \ingroup colormodeutl */
00121 #define imColorModeSpace(_cm) (_cm & 0xFF)
00122
00123 /** Check if the two color modes match. Only the color space is compared.
00124  *
00125  * \verbatim im.ColorModeMatch(color_mode1: number, color_mode2: number) -> match: boolean [in Lua 5] \endverbatim
00126  * \ingroup colormodeutl */
00127 #define imColorModeMatch(_cm1, _cm2) (imColorModeSpace(_cm1) == imColorModeSpace(_cm2))
00128
00129 /** Check if the color mode has an alpha channel.
00130  *
00131  * \verbatim im.ColorModeHasAlpha(color_mode: number) -> has_alpha: boolean [in Lua 5] \endverbatim
00132  * \ingroup colormodeutl */
00133 #define imColorModeHasAlpha(_cm) (_cm & IM_ALPHA)
00134
00135 /** Check if the color mode components are packed in one plane.
00136  *
00137  * \verbatim im.ColorModeIsPacked(color_mode: number) -> is_packed: boolean [in Lua 5] \endverbatim
00138  * \ingroup colormodeutl */
00139 #define imColorModeIsPacked(_cm) (_cm & IM_PACKED)
00140
00141 /** Check if the color mode orients the image from top down to bottom.
00142  *
00143  * \verbatim im.ColorModeIsTopDown(color_mode: number) -> is_top_down: boolean [in Lua 5] \endverbatim
00144  * \ingroup colormodeutl */
00145 #define imColorModeIsTopDown(_cm) (_cm & IM_TOPDOWN)
00146
00147 /** Returns the color space of the equivalent display bitmap image. \n
00148  * Original packing and alpha are ignored. Returns IM_RGB, IM_GRAY, IM_MAP or IM_BINARY.
00149  *
00150  * \verbatim im.ColorModeToBitmap(color_mode: number) -> color_space: number [in Lua 5] \endverbatim
00151  * \ingroup colormodeutl */
00152 int imColorModeToBitmap(int color_mode);
00153
00154 /** Check if the color mode and data_type defines a display bitmap image.
00155  *
00156  * \verbatim im.ColorModeIsBitmap(color_mode: number, data_type: number) -> is_bitmap: boolean [in Lua 5] \endverbatim
00157  * \ingroup colormodeutl */
00158 int imColorModeIsBitmap(int color_mode, int data_type);
00159
00160
00161
00162 /** \defgroup datatypeutl Data Type Utilities
00163  * \par
00164  * See \ref im_util.h
00165  * \ingroup util
00166  * @{
00167  */
00168
00169 typedef unsigned char imbyte;
00170 typedef unsigned short imushort;
00171
00172 #define IM_BYTECROP(_v) (_v < 0? 0: _v > 255? 255: _v)
00173 #define IM_CROPMAX(_v, _max) (_v < 0? 0: _v > _max? _max: _v)
00174
00175 /** @} */
00176
00177 /** Returns the size in bytes of a specified numeric data type.
00178  *
00179  * \verbatim im.DataTypeSize(data_type: number) -> size: number [in Lua 5] \endverbatim
00180  * \ingroup datatypeutl */
00181 int imDataTypeSize(int data_type);
00182
00183 /** Returns the numeric data type name given its identifier.
00184  *
00185  * \verbatim im.DataTypeName(data_type: number) -> name: string [in Lua 5] \endverbatim
00186  * \ingroup datatypeutl */
00187 const char* imDataTypeName(int data_type);
00188
00189 /** Returns the maximum value of an integer data type. For floating point returns 0.
00190  *
00191  * \verbatim im.DataTypeIntMax(data_type: number) -> int_max: number [in Lua 5] \endverbatim
00192  * \ingroup datatypeutl */
00193 unsigned long imDataTypeIntMax(int data_type);
00194
00195 /** Returns the minimum value of an integer data type. For floating point returns 0.
00196  *
00197  * \verbatim im.DataTypeIntMin(data_type: number) -> int_min: number [in Lua 5] \endverbatim
00198  * \ingroup datatypeutl */
00199 long imDataTypeIntMin(int data_type);
00200
00201
00202
00203 /** \defgroup bin Binary Data Utilities
00204  * \par
00205  * See \ref im_util.h
00206  * \ingroup util */
00207
00208 /** CPU Byte Orders.
00209   * \ingroup bin */
00210 enum imByteOrder
00211 {
00212   IM_LITTLEENDIAN, /**< Little Endian - The most significant byte is on the right end of a word. Used by Intel processors. */
00213   IM_BIGENDIAN     /**< Big Endian - The most significant byte is on the left end of a word. Used by Motorola processors, also is the network standard byte order. */
00214 };
00215
00216 /** Returns the current CPU byte order.
00217  * \ingroup bin */
00218 int imBinCPUByteOrder(void);
00219
00220 /** Changes the byte order of an array of 2, 4 or 8 byte values.
00221  * \ingroup bin */
00222 void imBinSwapBytes(void *data, int count, int size);
00223
00224 /** Changes the byte order of an array of 2 byte values.
00225  * \ingroup bin */
00226 void imBinSwapBytes2(void *data, int count);
00227
00228 /** Inverts the byte order of the 4 byte values
00229  * \ingroup bin */
00230 void imBinSwapBytes4(void *data, int count);
00231
00232 /** Inverts the byte order of the 8 byte values
00233  * \ingroup bin */
00234 void imBinSwapBytes8(void *data, int count);
00235
00236
00237
00238 /** \defgroup compress Data Compression Utilities
00239  * \par
00240  * Deflate compression support uses zlib version 1.2.3.     \n
00241  * http://www.zlib.org/                                      \n
00242  * Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
00243  * \par
00244  * LZF compression support uses libLZF version 3.5.       \n
00245  * http://software.schmorp.de/pkg/liblzf                  \n
00246  * Copyright (C) 2000-2009 Marc Alexander Lehmann
00247  * See \ref im_util.h
00248  * \ingroup util */
00249
00250 /** Compresses the data using the ZLIB Deflate compression. \n
00251  * The destination buffer must be at least 0.1% larger than source_size plus 12 bytes. \n
00252  * It compresses raw byte data. zip_quality can be 1 to 9. \n
00253  * Returns the size of the compressed buffer or zero if failed.
00254  * \ingroup compress */
00255 int imCompressDataZ(const void* src_data, int src_size, void* dst_data, int dst_size, int zip_quality);
00256
00257 /** Uncompresses the data compressed with the ZLIB Deflate compression. \n
00258  * Returns zero if failed.
00259  * \ingroup compress */
00260 int imCompressDataUnZ(const void* src_data, int src_size, void* dst_data, int dst_size);
00261
00262 /** Compresses the data using the libLZF compression. \n
00263  * Returns the size of the compressed buffer or zero if failed.
00264  * \ingroup compress */
00265 int imCompressDataLZF(const void* src_data, int src_size, void* dst_data, int dst_size, int zip_quality);
00266
00267 /** Uncompresses the data compressed with the libLZF compression.
00268  * Returns zero if failed.
00269  * \ingroup compress */
00270 int imCompressDataUnLZF(const void* src_data, int src_size, void* dst_data, int dst_size);
00271
00272
00273 #if defined(__cplusplus)
00274 }
00275 #endif
00276
00277 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: imlua.h Source File

imlua.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief IM Lua 5 Binding
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IMLUA_H
00008 #define __IMLUA_H
00009
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013
00014 /** \defgroup imlua ImLua 5 Binding Reference
00015  * \par
00016  * Binding for the Lua 5 scripting language.           \n
00017  * Lua 5.1 Copyright (C) 1994-2005 Lua.org, PUC-Rio    \n
00018  * R. Ierusalimschy, L. H. de Figueiredo & W. Celes    \n
00019  * http://www.lua.org
00020  * \par
00021  * See \ref imlua.h
00022  * \ingroup util */
00023
00024 #ifdef LUA_NOOBJECT  /* Lua 3 */
00025 void imlua_open(void);
00026 #endif
00027
00028 #ifdef LUA_TNONE  /* Lua 5 */
00029
00030 /** Initializes the Lua binding of the main IM library.  \n
00031  * Returns 1 (leaves the "im" table on the top of the stack).
00032  * You must link the application with the "imlua51" library.
00033  * \ingroup imlua */
00034 int imlua_open(lua_State *L);
00035 int luaopen_imlua(lua_State *L);
00036
00037 #ifdef __IM_IMAGE_H  /* must include im_image.h before this */
00038 /** Pushes an image as a metatable on the stack.
00039  * \ingroup imlua */
00040 void imlua_pushimage(lua_State *L, imImage* image);
00041
00042 /** Gets an image as a metatable from the stack, checks for correct type.
00043  * \ingroup imlua */
00044 imImage* imlua_checkimage(lua_State *L, int param);
00045 #endif
00046
00047 /** Initializes the Lua binding of the capture library.  \n
00048  * Returns 1 (leaves the "im" table on the top of the stack).
00049  * You must link the application with the "imlua_capture51" library.
00050  * \ingroup imlua */
00051 int imlua_open_capture(lua_State *L);
00052 int luaopen_imlua_capture(lua_State *L);
00053
00054 /** Initializes the Lua binding of the process library.  \n
00055  * Returns 1 (leaves the "im" table on the top of the stack).
00056  * You must link the application with the "imlua_process51" library.
00057  * \ingroup imlua */
00058 int imlua_open_process(lua_State *L);
00059 int luaopen_imlua_process(lua_State *L);
00060
00061 /** Initializes the Lua binding of the fourier transform library.  \n
00062  * Returns 1 (leaves the "im" table on the top of the stack).
00063  * You must link the application with the "imlua_fftw51" library.
00064  * \ingroup imlua */
00065 int imlua_open_fftw(lua_State *L);
00066 int luaopen_imlua_fftw(lua_State *L);
00067
00068
00069 #endif
00070
00071 #ifdef __cplusplus
00072 }
00073 #endif
00074
00075 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: old_im.h Source File

old_im.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Old API
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006
00007 #ifndef __IM_OLD_H
00008 #define __IM_OLD_H
00009
00010 #if     defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013
00014 enum {IM_BMP, IM_PCX, IM_GIF, IM_TIF, IM_RAS, IM_SGI, IM_JPG, IM_LED, IM_TGA};
00015 enum {IM_NONE = 0x0000, IM_DEFAULT = 0x0100, IM_COMPRESSED = 0x0200};
00016
00017 #define IM_ERR_READ IM_ERR_ACCESS
00018 #define IM_ERR_WRITE IM_ERR_ACCESS
00019 #define IM_ERR_TYPE IM_ERR_DATA
00020 #define IM_ERR_COMP IM_ERR_COMPRESS
00021
00022 long imEncodeColor(unsigned char red, unsigned char green, unsigned char blue);
00023 void imDecodeColor(unsigned char* red, unsigned char* green, unsigned char* blue, long palette);
00024 int imFileFormat(char *filename, int* format);
00025 int imImageInfo(char *filename, int *width, int *height, int *type, int *palette_count);
00026 int imLoadRGB(char *filename, unsigned char *red, unsigned char *green, unsigned char *blue);
00027 int imSaveRGB(int width, int height, int format, unsigned char *red, unsigned char *green, unsigned char *blue, char *filename);
00028 int imLoadMap(char *filename, unsigned char *map, long *palette);
00029 int imSaveMap(int width, int height, int format, unsigned char *map, int palette_count, long *palette, char *filename);
00030 void imRGB2Map(int width, int height, unsigned char *red, unsigned char *green, unsigned char *blue, unsigned char *map, int palette_count, long *palette);
00031 void imMap2RGB(int width, int height, unsigned char *map, int palette_count, long *colors, unsigned char *red, unsigned char *green, unsigned char *blue);
00032 void imRGB2Gray(int width, int height, unsigned char *red, unsigned char *green, unsigned char *blue, unsigned char *map, long *grays);
00033 void imMap2Gray(int width, int height, unsigned char *map, int palette_count, long *colors, unsigned char *grey_map, long *grays);
00034 void imResize(int src_width, int src_height, unsigned char *src_map, int dst_width, int dst_height, unsigned char *dst_map);
00035 void imStretch(int src_width, int src_height, unsigned char *src_map, int dst_width, int dst_height, unsigned char *dst_map);
00036 typedef int (*imCallback)(char *filename);
00037 int imRegisterCallback(imCallback cb, int cb_id, int format);
00038
00039 #define IM_INTERRUPTED -1
00040 #define IM_ALL -1
00041 #define IM_COUNTER_CB   0
00042 typedef int (*imFileCounterCallback)(char *filename, int percent, int io);
00043
00044 #define IM_RESOLUTION_CB   1
00045 typedef int (*imResolutionCallback)(char *filename, double* xres, double* yres, int* res_unit);
00046
00047 enum {IM_RES_NONE, IM_RES_DPI, IM_RES_DPC};
00048
00049 #define IM_GIF_TRANSPARENT_COLOR_CB 0
00050 typedef int (*imGifTranspIndex)(char *filename, unsigned char *transp_index);
00051
00052 #define IM_TIF_IMAGE_DESCRIPTION_CB 0
00053 typedef int (*imTiffImageDesc)(char *filename, char* img_desc);
00054
00055 #if defined(__cplusplus)
00056 }
00057 #endif
00058
00059 #endif
Generated on Sat Nov 13 2010 03:25:30 for IM by doxygen 1.7.1


IM: _imStats Struct Reference

Data Fields

_imStats Struct Reference
[Image Statistics Calculations]

Data Fields

float | max
float | min
unsigned long | positive
unsigned long | negative
unsigned long | zeros
float | mean
float | stddev

Detailed Description

Numerical Statistics Structure

Field Documentation

float _imStats::max

Maximum value

float _imStats::min

Minimum value

unsigned long _imStats::positive

Number of Positive Values

unsigned long _imStats::negative

Number of Negative Values

unsigned long _imStats::zeros

Number of Zeros

float _imStats::mean

Mean

float _imStats::stddev

Standard Deviation

The documentation for this struct was generated from the following file:
  • im_process_ana.h
Generated on Sat Nov 13 2010 03:25:31 for IM by doxygen 1.7.1