在 Imagemagick 命令行中,您可以:
convert -size 1x1 xc:red -colorspace HSV -format "%[pixel:u.p{0,0}]\n" info:
hsv(0,100%,100%)
或
convert lena.png[3x3+10+10] -colorspace HSV txt:
# ImageMagick pixel enumeration: 3,3,65535,hsv
0,0: (1944,34369,57825) #0886E1 hsv(11,52%,88%)
1,0: (1560,32622,57825) #067FE1 hsv(9,50%,88%)
2,0: (1643,33060,57568) #0681E0 hsv(9,50%,88%)
0,1: (2072,33787,57825) #0883E1 hsv(11,52%,88%)
1,1: (2129,34369,57825) #0886E1 hsv(12,52%,88%)
2,1: (2036,34678,57311) #0887DF hsv(11,53%,87%)
0,2: (1805,33347,58082) #0782E2 hsv(10,51%,89%)
1,2: (2012,33057,58082) #0881E2 hsv(11,50%,89%)
2,2: (1916,33204,57825) #0781E1 hsv(11,51%,88%)
对不起,我不懂 C++。我认为您需要做的就是使用 -colorspace HSV 的等效项,然后执行您通常为 RGB 执行的操作。
如果这不起作用,那么您可以在 Imagemagick Discourse Server Users 或 Magick++ 论坛上提问https://www.imagemagick.org/discourse-server/
附:看着http://cimg.eu/reference/structcimg__library_1_1CImg.html#a6c0ab36ca2418c9b62590cdfdcbdc793,我明白了
CImg< T > & RGBtoHSV ()
Convert pixel values from RGB to HSV color spaces.