Plot data reconstruction reading pixel colors from image files

Hi, How can I open and read colors of specific pixels of an image file in Haskell? Which packages, functions do you recommend? You can have a look at the quoted conversation for an idea on what I would like to automate. Best Regards, Cetin Sert
Hi dear *^o^*,
Here are the points from Figure 37
[SEE ATTACHED PNG]
Cisse Goni Kodougou Nouna normals log10s normals log10s normals log10s normals log10s 0.7999999999999998 0.5249999999999999 0.4249999999999998 0.375 0.41249999999999964 0.4249999999999998 0.8500000000000001 1.575 1.5999999999999999 1.325 1.0499999999999998 6.30957344480193 3.3496543915782757 2.6607250597988084 2.371373705661655 2.5852348395621885 2.6607250597988084 7.07945784384138 37.583740428844415 39.81071705534971 21.134890398366466 11.220184543019629 -0.5625 -0.3250000000000002 0.16249999999999964 0.3374999999999999 0.5 0.8500000000000001 1.4874999999999998 2.1375 2.2625 1.875 1.0 0.27384196342643613 0.4731512589614803 1.4537843856076607 2.1752040340195222 3.1622776601683795 7.07945784384138 30.725573652674456 137.24609610075626 183.02061063110568 74.98942093324558 10.0 0.7250000000000001 0.34999999999999964 0.3374999999999999 0.5 0.625 0.6374999999999997 0.7624999999999997 1.2249999999999999 1.5125 1.2125 0.625 5.308844442309884 2.2387211385683377 2.1752040340195222 3.1622776601683795 4.216965034285822 4.340102636447436 5.787619883491203 16.788040181225597 32.546178349804585 16.31172909227838 4.216965034285822 0.3374999999999999 0.13749999999999973 0.375 0.6499999999999999 0.5749999999999997 0.47499999999999964 0.9874999999999998 1.825 2.025 1.4749999999999999 0.7624999999999997 2.1752040340195222 1.372460961007561 2.371373705661655 4.46683592150963 3.7583740428844394 2.9853826189179573 9.716279515771058 66.83439175686145 105.92537251772886 29.853826189179586 5.787619883491203 Top to Bottom in the table is Left to Right in the figure.
Lots of love, CS ;-)
P/S: Sorry it took a bit longer than expected but it was lots of fun!
-------------------------------------------------------------------
module Main where
import Control.Monad
f x = 3 - (x / 80) -- 80: number of pixels d x = x - 2 -- pixel offset
cisse, goni, kodou, nouna :: [Double] cisse = [178,200,208,212,209,208,174,116,114,136,158] goni = [287,268,229,215,202,174,123,71 ,61 ,92 ,162] kodou = [184,214,215,202,192,191,181,144,121,145,192] nouna = [215,231,212,190,196,204,163,96 ,80 ,124,181]
disp :: (String, [Double]) → IO () disp (town,pixels) = do putStrLn $ town putStrLn $ ">normals" mapM_ print $ points putStrLn $ ">log10s" mapM_ print $ log10s putStrLn $ "-------------------" where points = map (f . d) pixels log10s = map (10 **) points
main :: IO () main = do mapM_ disp [("Cisse", cisse),("Goni", goni),("Kodougou", kodou),("Nouna", nouna)]
--------------------
Cisse
normals 0.7999999999999998 0.5249999999999999 0.4249999999999998 0.375 0.41249999999999964 0.4249999999999998 0.8500000000000001 1.575 1.5999999999999999 1.325 1.0499999999999998 log10s 6.30957344480193 3.3496543915782757 2.6607250597988084 2.371373705661655 2.5852348395621885 2.6607250597988084 7.07945784384138 37.583740428844415 39.81071705534971 21.134890398366466 11.220184543019629
Goni
normals -0.5625 -0.3250000000000002 0.16249999999999964 0.3374999999999999 0.5 0.8500000000000001 1.4874999999999998 2.1375 2.2625 1.875 1.0 log10s 0.27384196342643613 0.4731512589614803 1.4537843856076607 2.1752040340195222 3.1622776601683795 7.07945784384138 30.725573652674456 137.24609610075626 183.02061063110568 74.98942093324558 10.0
Kodougou
normals 0.7250000000000001 0.34999999999999964 0.3374999999999999 0.5 0.625 0.6374999999999997 0.7624999999999997 1.2249999999999999 1.5125 1.2125 0.625 log10s 5.308844442309884 2.2387211385683377 2.1752040340195222 3.1622776601683795 4.216965034285822 4.340102636447436 5.787619883491203 16.788040181225597 32.546178349804585 16.31172909227838 4.216965034285822
Nouna
normals 0.3374999999999999 0.13749999999999973 0.375 0.6499999999999999 0.5749999999999997 0.47499999999999964 0.9874999999999998 1.825 2.025 1.4749999999999999 0.7624999999999997 log10s 2.1752040340195222 1.372460961007561 2.371373705661655 4.46683592150963 3.7583740428844394 2.9853826189179573 9.716279515771058 66.83439175686145 105.92537251772886 29.853826189179586 5.787619883491203

If you don't find anything more specific, I suggest taking a look at Data.Binary and reading a simple format like BMP or so. (You can convert your file to BMP with an external program before.)

On Fri, Jul 17, 2009 at 06:31:20PM +0200, Cetin Sert wrote:
How can I open and read colors of specific pixels of an image file in Haskell? Which packages, functions do you recommend?
You could try DevIL, SDL-image or Gtk, I guess. -- Felipe.

Felipe Lessa schrieb:
On Fri, Jul 17, 2009 at 06:31:20PM +0200, Cetin Sert wrote:
How can I open and read colors of specific pixels of an image file in Haskell? Which packages, functions do you recommend?
You could try DevIL, SDL-image or Gtk, I guess.

Henning Thielemann wrote:
Felipe Lessa schrieb:
On Fri, Jul 17, 2009 at 06:31:20PM +0200, Cetin Sert wrote:
How can I open and read colors of specific pixels of an image file in Haskell? Which packages, functions do you recommend?
You could try DevIL, SDL-image or Gtk, I guess.
This is (one of) the problems that AC-EasyRaster is supposed to make easy. (AC-EasyRaster is just is a convinience binding over the top of Gtk2hs... Makes it easier to find the stuff you're actually looking for. Hopefully.)
participants (5)
-
Andrew Coppin
-
Cetin Sert
-
Felipe Lessa
-
Henning Thielemann
-
Matthias Görgens