diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e81a61..00ab06f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ else (PNG_FOUND) endif (PNG_FOUND) SET(src image.c) -SET(luasrc init.lua lena.jpg lena.png win.ui) +SET(luasrc init.lua fabio.jpg fabio.png lena.jpg lena.png win.ui) ADD_TORCH_PACKAGE(image "${src}" "${luasrc}" "Image Processing") TARGET_LINK_LIBRARIES(image luaT TH) diff --git a/README.md b/README.md index 52f58ca..01b2055 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,6 @@ $ luarocks install image > require 'image' > l = image.lena() > image.display(l) +> f = image.fabio() +> image.display(f) ``` diff --git a/fabio.jpg b/fabio.jpg new file mode 100644 index 0000000..895b2bc Binary files /dev/null and b/fabio.jpg differ diff --git a/fabio.png b/fabio.png new file mode 100644 index 0000000..0a7b14c Binary files /dev/null and b/fabio.png differ diff --git a/init.lua b/init.lua index d685a6b..aa2052e 100644 --- a/init.lua +++ b/init.lua @@ -1013,6 +1013,25 @@ local function lena() end rawset(image, 'lena', lena) + +---------------------------------------------------------------------- +-- fabio is a nice gender-balancing variation on lena +-- See: http://www.claremontmckenna.edu/news/every-picture-tells-a-story/ +-- and first use in http://arxiv.org/abs/1202.6429 +-- along with original file on http://nuit-blanche.blogspot.co.uk/2012/03/let-there-be-only-one-fabio.html +local function fabio() + local fname = 'fabio' + if xlua.require 'libjpeg' then + lena = image.load(paths.concat(sys.fpath(), fname .. '.jpg'), 1) + elseif xlua.require 'libpng' then + lena = image.load(paths.concat(sys.fpath(), fname .. '.png'), 1) + else + dok.error('no bindings available to load images (libjpeg AND libpng missing)', 'image.fabio') + end + return lena +end +rawset(image, 'fabio', fabio) + ---------------------------------------------------------------------- -- image.rgb2lab(image) -- converts a RGB image to YUV