From 889c7407307964b086f187d2d808669217c9417e Mon Sep 17 00:00:00 2001 From: Angel Wang Date: Sat, 20 Jun 2026 13:28:26 -0600 Subject: [PATCH] feat: add more time options, try add overcast/clear --- grade.sh | 93 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 22 deletions(-) diff --git a/grade.sh b/grade.sh index 3253068..96b0379 100755 --- a/grade.sh +++ b/grade.sh @@ -1,6 +1,17 @@ #!/usr/bin/env bash -rm -r graded && mkdir -p graded/{morning,afternoon}/{0..3} +# RULES: +# Eliminate golden first, it's the outlier +# LAB -> a greater than 50: golden +# The rest of the categories: +# LAB -> l less than 45: night +# LAB -> l less than 60: day +# LAB -> l all other: noon +# Clear/overcast +# HSI -> s less than 10: overcast +# HSI -> l else: clear + +rm -r graded && mkdir -p graded/{night,golden,day,noon}/{clear,overcast} lutgen apply -p catppuccin-latte -l 8 -L 0.001 -P -r 21.5 ./orig/* -o ./graded @@ -9,28 +20,66 @@ cd graded for file in *; do if [ -f "$file" ]; then - h=$(magick $file -colorspace HSI -channel r -separate +channel -format "%[fx:100*u.mean]\n" info:) + l=$(magick $file -colorspace Oklch -channel 0 -separate +channel -format "%[fx:100*u.mean]\n" info:) + # c=$(magick $file -colorspace Oklch -channel 1 -separate +channel -format "%[fx:100*u.mean]\n" info:) + # h=$(magick $file -colorspace Oklch -channel b -separate +channel -format "%[fx:u.mean]\n" info:) - if (( $(echo "$h < 40" | bc -l) )); then - mv $file morning/$file - else - mv $file afternoon/$file - fi - fi -done + echo $l -for file in */*; do - if [ -f "$file" ]; then - l=$(magick $file -colorspace LAB -channel r -separate +channel -format "%[fx:100*u.mean]\n" info:) - - if (( $(echo "$l < 50" | bc -l) )); then - mv $file ${file%/*}/0/${file#*/} - elif (( $(echo "$l < 60" | bc -l) )); then - mv $file ${file%/*}/1/${file#*/} - elif (( $(echo "$l < 70" | bc -l) )); then - mv $file ${file%/*}/2/${file#*/} - else - mv $file ${file%/*}/3/${file#*/} - fi + # if (( $(echo "$h > 285" | bc -l) )) || (( $(echo "$h < 90" | bc -l) )) ; then + # echo $h + # mv $file golden/$file + # fi fi done + + + +# for file in *; do +# if [ -f "$file" ]; then +# b=$(magick $file -colorspace LAB -channel b -separate +channel -format "%[fx:100*u.mean]\n" info:) +# # l=$(magick $file -colorspace LAB -channel r -separate +channel -format "%[fx:100*u.mean]\n" info:) +# # && (( $(echo "$l > 50" | bc -l) )) +# a=$(magick $file -colorspace LAB -channel g -separate +channel -format "%[fx:100*u.mean]\n" info:) + +# if (( $(echo "$a > 51" | bc -l) )) && (( $(echo "$b > 47" | bc -l) )) ; then +# mv $file golden/$file +# fi + +# # for file in golden/*; do +# # if [ -f "$file" ]; then +# # if (( $(echo "$a < 55" | bc -l) )) && (( $(echo "$b < 55" | bc -l) )); then +# # mv $file ${file%/*}/overcast/${file#*/} +# # else +# # mv $file ${file%/*}/clear/${file#*/} +# # fi +# # fi +# # done + +# fi +# done + +# for file in *; do +# if [ -f "$file" ]; then +# l=$(magick $file -colorspace LAB -channel r -separate +channel -format "%[fx:100*u.mean]\n" info:) +# if (( $(echo "$l < 50" | bc -l) )); then +# mv $file night/$file +# elif (( $(echo "$l < 60" | bc -l) )); then +# mv $file day/$file +# else +# mv $file noon/$file +# fi +# fi +# done + +# for file in */*; do +# if [ -f "$file" ]; then +# s=$(magick $file -colorspace HSI -channel g -separate +channel -format "%[fx:100*u.mean]\n" info:) + +# if (( $(echo "$s < 15" | bc -l) )); then +# mv $file ${file%/*}/overcast/${file#*/} +# else +# mv $file ${file%/*}/clear/${file#*/} +# fi +# fi +# done -- 2.51.2