This commit is contained in:
Louis Dalibard 2024-12-24 16:44:30 +01:00
parent c4930a5629
commit 1cd71d7210

View File

@ -34,17 +34,17 @@ randomFromImage image = do
color = RGB (fromIntegral r) (fromIntegral g) (fromIntegral b)
return $ rgb2lab color
instance Species (String, Image PixelRGB8) (V.Vector LAB) where
generate (_, image) = V.replicateM 16 $ randomFromImage image
instance Species (String,String,String, Image PixelRGB8) (V.Vector LAB) where
generate (_,_,_, image) = V.replicateM 16 $ randomFromImage image
crossover _ a b = return $ alternatingZip a b
mutate (_, image) palette = do
mutate (_,_,_, image) palette = do
index <- randomRIO (0, 15)
colour <- randomFromImage image
return $ palette // [(index, colour)]
fitness (polarity, _) palette
fitness (polarity_,_,, _) palette
= realToFrac $ accentDifference - (primarySimilarity/10) - scheme
where
-- The primary scale should use similar colours, to an extent.