Skip to content

Commit

Permalink
Merge branch 'fabio' of github.com:jucor/image into jucor-fabio
Browse files Browse the repository at this point in the history
Conflicts:
	CMakeLists.txt
  • Loading branch information
clementfarabet committed Jul 24, 2014
2 parents 6217ca6 + 082080d commit d66a11e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ $ luarocks install image
> require 'image'
> l = image.lena()
> image.display(l)
> f = image.fabio()
> image.display(f)
```
Binary file added fabio.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fabio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d66a11e

Please sign in to comment.