Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve the pixel values of an image with Haskell

Is there a way or a library available that can load an image (jpeg, png, etc) and assign the pixel values of that image into a list or matrix? I'd like to do some experiments with image and pattern recognition.

A little nudge in the right direction would be appreciated.

like image 899
subtlearray Avatar asked Oct 15 '12 18:10

subtlearray


2 Answers

You can use JuicyPixels, a native Haskell library for image loading. This is rather easy to convert to REPA as well (manually or with JuicyPixesl-repa).

like image 53
Thomas M. DuBuisson Avatar answered Oct 05 '22 10:10

Thomas M. DuBuisson


I've used the repa-devil package for this in the past. It lets you work with a bunch of formats using Developer's Image Library (DevIL). You can read and write all the formats you are likely to care about.

The actual image data is given as a Repa array. This is a great library for array operations and makes it very easy to write parallel code.

like image 21
Tikhon Jelvis Avatar answered Oct 05 '22 08:10

Tikhon Jelvis