-
Notifications
You must be signed in to change notification settings - Fork 165
Boost.GIL 3 Ideas
- Draft under heavy brainstorm
- Accepted ideas are submitted as issues/PRs to Boost.GIL 3 project.
- Good outline of the C++11 Metaprogramming by Peter Dimov - Part 1 and Part 2
- Use Boost.Hana for metaprogramming, defining types like pixel, color spaces, etc.
- C++11: delegating constructor
- C++11: move semantics constructor (#438 and PR #457)
- using variadic templates will help
- make use of overlapping functionality with boost::geometry, like point type registration. See Andrew Hundt's email from 2013/03/13
- pixel should have a begin() and end() members.
- make Alignment a template parameter for image class
use boost::fusion for defining pixel and color spaces. See emails
- Restructure into folders and make flat files shorter, manageable. See toolbox extension
- Careful about files reaming (see https://svn.boost.org/trac10/wiki/Guidelines/MaintenanceGuidelines)
- Structure (prose, API reference)
Interesting Q&A on Boost mailing list, StackOverflow and other places as candidates for tutorials:
- Using gil with windows bitmaps
-
Array to image (also Windows bitmap)
- Array to image solution (also posted to http://esoerik.blogspot.com/2011/04/overriding-boostgils-from-rgba-color.html)
- Use OpenCV as backend?
- image class has a boolean template parameter defining wheather or not an image is planar.
- view_t is defined with view_type_from_pixel
- if planar == true then special allocate_( ... )
- Enable building IO extension with single-file https://github.com/nothings/stb as alternative format library
- http://lodev.org/lodepng/
- https://github.com/supotmaild/Tiny_Jpeg
Designing a JPEG Decoder & Source Code
Understanding What is stored in a Canon RAW .CR2 file, How and Why
- http://gdal.org is a library for raster geospatial data formats.
- GDAL support for IOv2 prototype: https://github.com/mloskot/boost-gil-workshop/tree/gil-io2-gdal/
- aka HD Photo (formerly Windows Media Photo)
- Windows native JPEG XR codec is available through the Windows Imaging Component (WIC)
- Microsoft developed as reference implementation in
jxrlib
. It used to be at http://jxrlib.codeplex.com and now is community-maintained at https://github.com/4creators/jxrlib/, available also via vcpkg port.
This is a curious format, could be interesting, for comparative tests, etc.
- https://github.com/psiha/gil offers alternative GIL.IO implementation with list of feature here. Might inspire further improvements in current implementation.
- https://github.com/stereomatchingkiss/gil_algorithms - small collection of algorithms based on GIL
- A Proposal to Add 2D Graphics Rendering and Display to C++
- AntiGrain
- pixman
- gegl New hardware acceleration code landed to upstream GEGL, from 03/21/2012
http://developers.slashdot.org/story/14/01/04/2115249/cairo-2d-graphics-may-become-part-of-iso-c
Lea Verou writes: To accurately convert values from RGB to CMYK and vice versa, the way Photoshop does, you need to use an ICC color profile. All the simple algorithmic solutions you'll find in the interwebs (like the one posted above) are inacurrate and produce colors that are outside the CMYK color gamut (for example they convert CMYK(100, 0, 0, 0) to rgb(0, 255, 255) which is obviously wrong since rgb(0, 255, 255) can't be reproduced with CMYK). Look into the java.awt.color.ICC_ColorSpace and java.awt.color.ICC_Profile classes for converting colors using ICC color profiles. As for the color profile files themselves, Adobe distributes them for free. (http://stackoverflow.com/questions/4858131/rgb-to-cmyk-and-back-algorithm)
@vinniefalco writes: There is not a 1:1 relationship between "converting" from RGB to CMYK. In fact there are an infinite number of ways to represent an RGB image as a CMYK image, by varying the amount of black and using different algorithms (undercover removal or gray component replacement for example). Not all representations match the original RGB image, as the gamut of CMYK is typically smaller than the gamut of RGB. The process of turning an RGB image into a CYMK image is called "color separation", and algorithms to do this are very valuable and of course totally proprietary. There is also another important and related process, which is to render a CMYK image as an RGB image using proper colors. In order to do this, you generally need to know:
- The precise CIE XYZ color values for each of the inks (Cyan, Magenta, Yellow, and Black)
- Metadata about the ink+paper, for example the dot spread, and the paper's white color
- The color profile of the RGB monitor, this is used to convert perceptual CIE XYZ colors into color-correct RGB colors (this transformation is particular to the monitor's color profile)
A scientist by the name of Hans E. J. Neugebauer published a paper in 1937 ("Die theoretischen Grundlagen des Mehrfarbenbuchdrucks", or "The theoretical foundations of multicolor printing") which proposed a model for predicting the CIE XYZ color that a given CMYK halftoned pattern might look like. These are known as the "Neugebauer Equations." All modern programs (such as Photoshop) use some variation of these Neugebauer equations, with improvements to make the model more accurate. Some of these improvements can be seen in published papers (some not). Using these equations, one can predict the CIE XYZ color of a CMYK dot given information about the inks and paper. This can then be used to display the CMYK image in a colorimetrically correct fashion using the monitor's color profile as described above. This algorithm is called "Proof Colors" in Photoshop.
An implementation of Proof Colors (CMYK to color-correct RGB) by definition will have a formula for mapping CMYK to RGB. If this mapping were inverted, it can be used to perform a color separation (converting perceptual RGB to CMYK for a given set of inks and paper). Unfortunately, there is a wrinkle here. While the CMYK to RGB algorithm is one to one, the inverse is not. As stated earlier, there are an infinite number of CMYK images which in theory will all look like the same RGB image. To choose between these possibilities, the algorithm must be given guidance such as the amount of black to use and the manner in which colors are substituted (undercolor removal, gray component replacement). There is also another wrinkle, which is that the Neugebauer equations are not analytically invertible. This inversion will have to be performed numerically using an iterative algorithm such as Newton's method.
web resources: http://www.color.org/faqs.xalter http://en.wikipedia.org/wiki/ICC_profile
implementations https://docs.oracle.com/javase/7/docs/api/java/awt/color/ICC_ColorSpace.html
http://en.wikipedia.org/wiki/Common_Intermediate_Format
Some Links:
- http://www.sunrayimage.com/examples.html
- http://trace.eas.asu.edu/yuv/
- http://fourcc.org/yuv.php
- http://softpixel.com/~cwright/programming/colorspace/yuv/
https://github.com/dmilos/color - implements color conversion and manipulation.
These ideas are old and might be obsolete.
- make sure not only integral types can the base type when creating a pixel type. See packed_pixel_t
- outsource io_new's bit_operations
- outsource io_new's io_devices
- look at the cairo proposal: https://groups.google.com/a/isocpp.org/forum/#!msg/graphics/UfvaqOyQbQ4/mv0CJS2mRtYJ with reference implementation: https://github.com/mikebmcl/N3888_RefImpl