Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
diegomage
Posts: 205 Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151
Post
by diegomage » 2018-08-12T10:45:34-07:00
IM trying to convert elsa image but the blonde color in the image when I use kmeans
I use kmeans from this page
http://www.fmwconcepts.com/imagemagick/kmeans/index.php
Code: Select all
./kmeans elsa.png kdf_black2.png -n 15 -C LAB
not works to get the color of hair and differentiate for skin pink color
INPUT IMAGE
RESULT IMAGE
please help me
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2018-08-12T11:08:08-07:00
Try using seed colors in the script rather than just some number of colors. But I doubt that will work. You can also try -remap. See
https://www.imagemagick.org/Usage/quantize/#remap
diegomage
Posts: 205 Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151
Post
by diegomage » 2018-08-12T11:46:09-07:00
yes very thankyou I try but not get results .
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2018-08-12T11:51:25-07:00
I do not know how to help. Your input image is rather poor.
diegomage
Posts: 205 Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151
Post
by diegomage » 2018-08-12T17:20:23-07:00
I use kmeans for obtain the most common color and use a mask over each color and use a kmeans over each color mask of original image and combine all parts , repeating my code 5 times and works
this is my code
Code: Select all
./kmeans anna2.jpg kdf_black2.png -n 15 -colors 15 -c 0.3 -C sRGB -t flattened >colorsf
convert anna2.jpg -fuzz 100% -fill white -opaque black annafinal3.png
convert annafinal3.png -transparent white annafinal3.png
n=3
echo $n;n=$(($n + 1));p="p";vartt=$n$p;vartx=$(sed -n "$vartt" <colorsf);echo $vartx;echo $vartx > filevartx;x=$(grep -Po '[^,]+$' filevartx);convert kdf_black2.png -fill white +opaque "$x" kdf_black3.png
convert kdf_black3.png -fill black -opaque "$x" kdf_black4.png;convert kdf_black4.png -negate kdf_black4x.png; convert anna2.jpg -mask kdf_black4x.png -fuzz 90% -fill white -opaque black +mask kdf_black5.png
./kmeans kdf_black5.png kdf_black2x.png -n 15 -colors 15 -c 0.3 -C sRGB -t flattened
convert kdf_black2x.png -transparent white "annafinal$n.png"
z=$(($n - 1))
composite "annafinal$z.png" "annafinal$n.png" "annafinal$n.png"
this is my result
very thankyou