explore 0.0.5 → 0.0.5.1
raw patch · 9 files changed
+328/−22 lines, 9 filesbinary-added
Files
- 39-cisse.output +97/−0
- 39-goni.output +97/−0
- 39-nouna.output +97/−0
- LICENSE +1/−1
- Main.hs +21/−19
- README +8/−0
- example.ods binary
- example.xls binary
- explore.cabal +7/−2
+ 39-cisse.output view
@@ -0,0 +1,97 @@+ExPloRe 0.0.5.1 : Experimental Plot Reconstructor+-------------------------------------------------------------------++call : 39-cisse-x.png 39-legend TC 100 150 150 150 F 20.83++image : 39-cisse-x.png+width : 1500+height: 654++area : A 0 0 1500 654+match : TC 100 150 150 150+legend: 39-legend+lines : 1+step : 20.83++("City",RGBA 255 0 0 255)++-------------------------------------------------------------------+RGBA 255 0 0 255++City++point x mid y matches y++1 0 []+2 20 []+3 41 []+4 62 643 [641,642,643,644]+5 83 643 [641,642,643,644]+6 104 642 [640,641,642,643,644]+7 124 642 [640,641,642,643,644]+8 145 642 [640,641,642,643]+9 166 642 [640,641,642,643,644]+10 187 643 [641,642,643,644]+11 208 644 [642,643,644,645]+12 229 646 [644,645,646,647]+13 249 648 [646,647,648,649]+14 270 650 [648,649,650,651,652]+15 291 652 [650,651,652,653]+16 312 652 [651,652,653]+17 333 653 [652,653]+18 354 653 [652,653]+19 374 653 [652,653]+20 395 653 [652,653]+21 416 652 [651,652,653]+22 437 652 [651,652,653]+23 458 652 [651,652,653]+24 479 652 [651,652,653]+25 499 652 [651,652,653]+26 520 652 [651,652,653]+27 541 652 [651,652,653]+28 562 652 [651,652,653]+29 583 652 [651,652,653]+30 604 652 [650,651,652,653]+31 624 652 [650,651,652,653]+32 645 651 [649,650,651,652,653]+33 666 651 [649,650,651,652]+34 687 651 [649,650,651,652]+35 708 653 [653]+36 729 []+37 749 []+38 770 []+39 791 []+40 812 651 [648,649,650,651,652,653]+41 833 587 [578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596]+42 854 487 [477,478,479,480,481,482,483,484,485,486,487,488,489,492,493,494,495,496,497,498]+43 874 380 [368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391]+44 895 272 [262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282]+45 916 192 [185,186,187,188,189,190,191,192,193,194,195,196,197,198]+46 937 157 [155,156,157,158]+47 958 182 [176,177,178,179,180,181,182,183,184,185,186,187]+48 979 252 [243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261]+49 999 345 [334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356]+50 1020 448 [438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458]+51 1041 539 [531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547]+52 1062 599 [595,596,597,598,599,600,601,602]+53 1083 613 [611,612,613,614,615]+54 1103 616 [614,615,616,617]+55 1124 614 [612,613,614,615,616]+56 1145 612 [610,611,612,613]+57 1166 608 [606,607,608,609]+58 1187 606 [604,605,606,607,608]+59 1208 611 [609,610,611,612]+60 1228 617 [615,616,617,618,619]+61 1249 624 [622,623,624,625,626]+62 1270 631 [629,630,631,632,633]+63 1291 636 [635,636,637]+64 1312 641 [639,640,641,642]+65 1333 641 [640,641,642]+66 1353 640 [638,639,640,641]+67 1374 637 [635,636,637,638]+68 1395 635 [633,634,635,636]+69 1416 632 [630,631,632,633,634]+70 1437 631 [631]+71 1458 []+72 1478 []+73 1499 []
+ 39-goni.output view
@@ -0,0 +1,97 @@+ExPloRe 0.0.5.1 : Experimental Plot Reconstructor+-------------------------------------------------------------------++call : 39-goni-x.png 39-legend TC 100 150 150 150 F 20.83++image : 39-goni-x.png+width : 1500+height: 654++area : A 0 0 1500 654+match : TC 100 150 150 150+legend: 39-legend+lines : 1+step : 20.83++("City",RGBA 255 0 0 255)++-------------------------------------------------------------------+RGBA 255 0 0 255++City++point x mid y matches y++1 0 []+2 20 []+3 41 []+4 62 652 [651,652,653]+5 83 652 [650,651,652,653]+6 104 652 [650,651,652,653]+7 124 652 [651,652,653]+8 145 652 [651,652,653]+9 166 653 [652,653]+10 187 653 [652,653]+11 208 653 [652,653]+12 229 653 [652,653]+13 249 653 [652,653]+14 270 653 [652,653]+15 291 653 [652,653]+16 312 653 [652,653]+17 333 653 [652,653]+18 354 653 [652,653]+19 374 653 [652,653]+20 395 653 [652,653]+21 416 653 [652,653]+22 437 653 [652,653]+23 458 653 [652,653]+24 479 653 [652,653]+25 499 653 [652,653]+26 520 653 [652,653]+27 541 653 [652,653]+28 562 653 [652,653]+29 583 653 [652,653]+30 604 653 [652,653]+31 624 652 [651,652,653]+32 645 652 [650,651,652,653]+33 666 651 [649,650,651,652,653]+34 687 649 [647,648,649,650]+35 708 648 [646,647,648,649,650]+36 729 649 [647,648,649,650]+37 749 649 [647,648,649,650]+38 770 646 [644,645,646,647,648]+39 791 640 [638,639,640,641,642]+40 812 625 [622,623,624,625,626,627,628]+41 833 587 [582,583,584,585,586,587,588,589,590,591,592]+42 854 533 [527,528,529,530,531,532,533,534,535,536,537,538,539]+43 874 475 [468,469,470,471,472,473,474,475,476,477,478,479,480,481]+44 895 408 [401,402,403,404,405,406,407,408,409,410,411,412,413,414,415]+45 916 344 [337,338,339,340,341,342,343,344,345,346,347,348,349,350]+46 937 289 [283,284,285,286,287,288,289,290,291,292,293,294]+47 958 234 [228,229,230,231,232,233,234,235,236,237,238,239]+48 979 177 [171,172,173,174,175,176,177,178,179,180,181,182]+49 999 126 [120,121,122,123,124,125,126,127,128,129,130,131]+50 1020 81 [77,78,79,80,81,82,83,84,85]+51 1041 53 [51,52,53,54,55]+52 1062 49 [48,49]+53 1083 80 [75,76,77,78,79,80,81,82,83,84,85]+54 1103 136 [131,132,133,134,135,136,137,138,139,140,141]+55 1124 215 [206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224]+56 1145 302 [293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310]+57 1166 384 [376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391]+58 1187 449 [443,444,445,446,447,448,449,450,451,452,453,454]+59 1208 496 [492,493,494,495,496,497,498,499,500]+60 1228 537 [532,533,534,535,536,537,538,539,540,541]+61 1249 573 [569,570,571,572,573,574,575,576,577]+62 1270 604 [601,602,603,604,605,606,607]+63 1291 628 [625,626,627,628,629,630,631]+64 1312 645 [642,643,644,645,646,647]+65 1333 652 [650,651,652,653]+66 1353 649 [647,648,649,650,651]+67 1374 638 [636,637,638,639,640]+68 1395 625 [622,623,624,625,626,627]+69 1416 611 [608,609,610,611,612,613]+70 1437 600 [598,599,600,601]+71 1458 []+72 1478 []+73 1499 []
+ 39-nouna.output view
@@ -0,0 +1,97 @@+ExPloRe 0.0.5.1 : Experimental Plot Reconstructor+-------------------------------------------------------------------++call : 39-nouna-x.png 39-legend TC 100 150 150 150 F 20.83++image : 39-nouna-x.png+width : 1500+height: 654++area : A 0 0 1500 654+match : TC 100 150 150 150+legend: 39-legend+lines : 1+step : 20.83++("City",RGBA 255 0 0 255)++-------------------------------------------------------------------+RGBA 255 0 0 255++City++point x mid y matches y++1 0 []+2 20 []+3 41 []+4 62 653 [652,653]+5 83 652 [651,652,653]+6 104 652 [651,652,653]+7 124 652 [651,652,653]+8 145 652 [651,652,653]+9 166 652 [651,652,653]+10 187 652 [651,652,653]+11 208 652 [651,652,653]+12 229 652 [651,652,653]+13 249 653 [652,653]+14 270 653 [652,653]+15 291 652 [651,652,653]+16 312 652 [651,652,653]+17 333 652 [650,651,652,653]+18 354 651 [649,650,651,652,653]+19 374 650 [648,649,650,651,652]+20 395 649 [647,648,649,650,651]+21 416 648 [646,647,648,649,650]+22 437 648 [646,647,648,649]+23 458 648 [646,647,648,649,650]+24 479 649 [647,648,649,650,651]+25 499 650 [648,649,650,651,652]+26 520 651 [649,650,651,652,653]+27 541 652 [650,651,652,653]+28 562 652 [651,652,653]+29 583 652 [651,652,653]+30 604 653 [652,653]+31 624 653 [652,653]+32 645 653 [652,653]+33 666 652 [651,652,653]+34 687 652 [651,652,653]+35 708 653 [652,653]+36 729 []+37 749 []+38 770 []+39 791 []+40 812 648 [646,647,648,649,650]+41 833 635 [633,634,635,636,637]+42 854 619 [616,617,618,619,620,621]+43 874 601 [598,599,600,601,602,603]+44 895 577 [574,575,576,577,578,579,580]+45 916 550 [546,547,548,549,550,551,552,553]+46 937 514 [510,511,512,513,514,515,516,517,518]+47 958 460 [455,456,457,458,459,460,461,462,463,464,469]+48 979 387 [382,383,384,385,386,387,388,389,390,391]+49 999 316 [309,310,311,312,313,314,315,316,317,318,322,323,324,325]+50 1020 248 [242,243,244,245,246,247,248,249,250,251,252,253,254]+51 1041 200 [197,198,199,200,201,202]+52 1062 187 [187]+53 1083 222 [216,217,218,219,220,221,222,223,224,225,226,227,228]+54 1103 290 [281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298]+55 1124 382 [372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391]+56 1145 478 [468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488]+57 1166 564 [556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571]+58 1187 622 [618,619,620,621,622,623,624,625,626]+59 1208 640 [638,639,640,641,642]+60 1228 647 [645,646,647,648]+61 1249 650 [648,649,650,651]+62 1270 651 [649,650,651,652]+63 1291 651 [649,650,651,652]+64 1312 651 [649,650,651,652]+65 1333 651 [649,650,651,652]+66 1353 650 [648,649,650,651]+67 1374 648 [646,647,648,649]+68 1395 645 [643,644,645,646]+69 1416 642 [640,641,642,643,644]+70 1437 641 [641]+71 1458 []+72 1478 []+73 1499 []
LICENSE view
@@ -16,7 +16,7 @@ * The names of contributors may not be used to endorse or promote products derived from this software without specific prior- written permission. + written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Main.hs view
@@ -1,5 +1,5 @@+-- (c) 2009, Cetin Sert -- | ExPloRe: Experimental Plot Reconstructor--- explore cisse.png cisse.legend "TA 20" F module Main where @@ -59,7 +59,7 @@ main :: IO () main = do- putStrLn $ "ExPloRe 0.01 : Experimental Plot Reconstructor"+ putStrLn $ "ExPloRe 0.0.5.1 : Experimental Plot Reconstructor" args@(imgPath:legendPath:matching_:area_:step_:_) <- getArgs -- initialize image @@ -85,7 +85,7 @@ let cols = takeWhile (< r) $ map (floor . (start +) . (step *)) [0..] let icols = zip [1..] cols let matching = read matching_ :: Matching- let (~=) = matchEq matching+ let (~=) = colorEq matching putStrLn $ "area : " ++ show area putStrLn $ "match : " ++ show matching @@ -98,7 +98,7 @@ putStrLn $ "" mapM_ (putStrLn . show) lines - -- scan bitmap + -- scan bitmap mapM_ (scan bitmap area icols rows (@#) (~=)) lines @@ -114,25 +114,27 @@ putStrLn $ "point\tx\tmid y\tmatches y" putStrLn $ "" withStorableArray bitmap $ \byte -> do - let pixel :: Ptr RGBA = castPtr byte - forM_ icols $ \(n,j) -> do - let matches = flip filter rows $ \i -> (pixel @# i) j ~= color - let m = mid matches - t- putStrLn $ case not . null $ matches of - True -> show n ++ "\t" ++ show j ++ "\t" ++ show m ++ "\t" ++ show matches - False -> show n ++ "\t" ++ show j ++ "\t \t[]" --- + let pixel :: Ptr RGBA = castPtr byte + forM_ icols $ \(n,j) -> do + let matches = flip filter rows $ \i -> (pixel @# i) j ~= color + let m = mid matches - t+ putStrLn $ case not . null $ matches of + True -> show n ++ "\t" ++ show j ++ "\t" ++ show m ++ "\t" ++ show matches + False -> show n ++ "\t" ++ show j ++ "\t \t[]" -matchEq :: Matching -> RGBA -> RGBA -> Bool-matchEq S = mcc_ 0 0 0 0-matchEq (TA v) = mcc_ v v v v-matchEq (TC r g b a) = mcc_ r g b a -mcc_ :: Int -> Int -> Int -> Int -> RGBA -> RGBA -> Bool -mcc_ tr tg tb ta (RGBA a b c d) (RGBA x y z w) = let fe = fuzzyEq in+-- | fuzzy color matching+colorEq :: Matching -> RGBA -> RGBA -> Bool+colorEq S = compEq 0 0 0 0+colorEq (TA v) = compEq v v v v+colorEq (TC r g b a) = compEq r g b a++-- | fuzzy color matching+compEq :: Int -> Int -> Int -> Int -> RGBA -> RGBA -> Bool +compEq tr tg tb ta (RGBA a b c d) (RGBA x y z w) = let fe = fuzzyEq in fe tr a x && fe tg b y && fe tb c z && fe ta d w --- | simple fuzzy equality for+-- | simple fuzzy equality fuzzyEq :: forall b a. (Num b, Ord b, Integral a) => b -> a -> a -> Bool fuzzyEq 0 = (==) fuzzyEq t = \x y -> t > (abs $ fromIntegral x - fromIntegral y)
README view
@@ -3,6 +3,8 @@ - It is only a very early hack ^__^"!! - Line occlusion causes matches to fail. - Supports only 32-bit PNGs (with an alpha/transparency channel).+ - No automatic recognition whatsoever of figures/plots given+ a full page. Lots of happy moments with Gimp and Inkscape!! EXAMPLES@@ -23,3 +25,9 @@ from Sayoro, Burkina Faso September 2005++ - To create the example outputs:++ explore 39-cisse-x.png 39-legend "TC 100 150 150 150" F 20.83+ explore 39-goni-x.png 39-legend "TC 100 150 150 150" F 20.83+ explore 39-nouna-x.png 39-legend "TC 100 150 150 150" F 20.83
example.ods view
binary file changed (171592 → 171491 bytes)
+ example.xls view
binary file changed (absent → 182272 bytes)
explore.cabal view
@@ -1,5 +1,5 @@ name: explore-version: 0.0.5+version: 0.0.5.1 cabal-version: >= 1.2 license: BSD3 license-file: LICENSE@@ -13,18 +13,23 @@ description: Very first prototype of a command line tool to extract pixel positions matching a given colour to help reconstruct plot data. See example.ods- and Main.hs to figure out its usage.+ or example.xls, README and Main.hs on the+ project homepage to figure out its usage. stability: Experimental build-type: Simple extra-source-files: AUTHORS, README, example.ods,+ example.xls, 39-cisse-x.png, 39-goni-x.png, 39-nouna-x.png, 39-legend, Thesis_FullVer280705.png, Thesis_FullVer280705.svg+ 39-cisse.output,+ 39-goni.output,+ 39-nouna.output Executable explore buildable: True