Giter Site home page Giter Site logo

repa-devil's Introduction

Support for image reading and writing of Repa arrays using in-place FFI calls

The repa-image library adds support for reading and
writing images in many formats based on the DevIL
open source image library. Image data is represented in Haskell
as typed, multi-dimensional repa arrays.

Developer's Image Library (DevIL) is a library to
develop applications with very powerful image
loading capabilities, yet with a relatively simple
interface. DevIL can load, save, convert,
manipulate, filter and display a wide variety of
image formats, including:
    BMP, ICO, JPG, PNG, PNM, TGA, TIF, GIF, EXIF and many more.

References:
* <http://hackage.haskell.org/package/repa>
* <http://openil.sourceforge.net/>
* <http://www.haskell.org/haskellwiki/Numeric_Haskell:_A_Repa_Tutorial>

repa-devil's People

Contributors

ornedan avatar raphaelj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ornedan forec

repa-devil's Issues

Build failure with GHC 7.8

Subset of the output:

Unpacking to repa-devil-0.3.2.3/
Resolving dependencies...
Configuring repa-devil-0.3.2.3...
Building repa-devil-0.3.2.3...
Preprocessing library repa-devil-0.3.2.3...
[1 of 1] Compiling Data.Array.Repa.IO.DevIL ( dist/build/Data/Array/Repa/IO/DevIL.hs, dist/build/Data/Array/Repa/IO/DevIL.o )

Data/Array/Repa/IO/DevIL.hsc:92:40:
    Not in scope: type constructor or class ‘Applicative’

Data/Array/Repa/IO/DevIL.hsc:180:24: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:212:31: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:217:17: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:220:18: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:223:17: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:226:18: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:229:18: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:232:18: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:247:27: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:261:15: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:266:15: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:271:15: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:276:15: Not in scope: ‘<$>’

Data/Array/Repa/IO/DevIL.hsc:281:15: Not in scope: ‘<$>’

transformers-0.5

I know this package is deprecated, but I have some old code that uses it that I want to keep working.

My code (and repa-devil) compiles and works correctly with cabal new-install -w ghc-8.6.1 --allow-newer=transformers, so I suspect the dependency bound can simply be lifted, suggest transformers >= 0.2 && < 0.6

It could be fixed by a metadata revision on Hackage (no need to upload a whole new version).

Dimensions in Image constructors

This question relates to the dimensions in the five constructors:

RGBA (Array F DIM3 Word8)    
RGB (Array F DIM3 Word8)     
BGRA (Array F DIM3 Word8)    
BGR (Array F DIM3 Word8)     
Grey (Array F DIM2 Word8)    

Only the Grey constructor has a two dimensional array type parameter DIM2, the rest take a three dimensional array DIM3. Here are the sources for repa-examples:
https://github.com/DDCSF/repa/tree/master/repa-examples

Many of the repa examples operate on two dimensional arrays, for example:

blur :: Monad m => Int -> Array U DIM2 Double -> m (Array U DIM2 Double)
gradientX_sep :: Array DIM2 Float -> Array DIM2 Float
blurSepX :: Array U DIM2 Float -> IO (Array U DIM2 Float)
solveLaplace
        :: Monad m
        => Int                        -- ^ Number of iterations to use.
        -> Array U DIM2 Double        -- ^ Boundary value mask.
        -> Array U DIM2 Double        -- ^ Boundary values.
        -> Array U DIM2 Double        -- ^ Initial state.
        -> m (Array U DIM2 Double)

And so on... Does this mean that all the repa examples can only operate on DIM2 greyscale images? Or does this imply a separation between the use of repa dimensions in devil-repa (colour images are DIM3) and repa-examples (images are DIM2).

linking on Windows

When I tried to compile a Haskell package importing repa-devil on Windows it gave linking errors complaining about undefined references to IL functions such as:

 Linking dist\build\test\test.exe ...
 dist\build\shapes\test-tmp\Main.o:fake:(.text+0x71900): undefined reference to `ilInit'
 dist\build\shapes\test-tmp\Main.o:fake:(.text+0x71910): undefined reference to `ilOriginFunc'

I was able to fix it by replacing all foreign import ccall calling conventions by stdcall, eg.

 foreign import ccall unsafe "ilInit" ilInitC :: IO ()

by

 foreign import stdcall unsafe "ilInit" ilInitC :: IO ()

After reinstalling such a modified repa-devil I can read and write PNG images etc.

This is my setup:

A small Haskell program which triggers the error:

module Main where

import Data.Array.Repa.IO.DevIL

main = runIL $ do
  (RGB im) <- readImage "blah.png"
  return ()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.