yes
This commit is contained in:
parent
411b8bd6d8
commit
c91b133c88
@ -11,8 +11,8 @@ import Text.JSON ( encode )
|
||||
import Text.Read (readMaybe)
|
||||
|
||||
-- String to float
|
||||
stringToFloat :: String -> Float
|
||||
stringToFloat s = case readMaybe s of
|
||||
stringToDouble :: String -> Double
|
||||
stringToDouble s = case readMaybe s of
|
||||
Just x -> x
|
||||
Nothing -> error "Invalid float value"
|
||||
|
||||
@ -29,7 +29,7 @@ mainProcess (polarity,primaryScaleDark,primaryScaleLight, input, output) = do
|
||||
setStdGen $ mkStdGen 0
|
||||
|
||||
image <- loadImage input
|
||||
palette <- evolve (polarity,stringToFloat primaryScaleDark,stringToFloat primaryScaleLight,convertRGB8 image)
|
||||
palette <- evolve (polarity,stringToDouble primaryScaleDark,stringToDouble primaryScaleLight,convertRGB8 image)
|
||||
let outputTable = makeOutputTable $ V.map lab2rgb palette
|
||||
|
||||
writeFile output $ encode outputTable
|
||||
|
@ -38,7 +38,7 @@ randomFromImage image = do
|
||||
color = RGB (fromIntegral r) (fromIntegral g) (fromIntegral b)
|
||||
return $ rgb2lab color
|
||||
|
||||
instance Species (String,Float,Float, Image PixelRGB8) (V.Vector LAB) where
|
||||
instance Species (String,Double,Double, Image PixelRGB8) (V.Vector LAB) where
|
||||
generate (_,_,_, image) = V.replicateM 16 $ randomFromImage image
|
||||
|
||||
crossover _ a b = return $ alternatingZip a b
|
||||
|
Loading…
Reference in New Issue
Block a user