RMagickã使ã£ã¦ãç»åå
ã§ä½¿ç¨ããã¦ããè²ã®çµ±è¨ãåå¾ãããµã³ãã«ãæ¸ãã¦ã¿ã¾ããã使ç¨ããã¦ããè²ãã¨ã«å²åãç®åºãã使ç¨éã®å¤ãé ã«åºåãã¾ãã require 'rubygems' require 'RMagick' imgs = Magick::Image.read("./kitten.jpg") img = imgs.first # ç»åå
ã§ä½¿ç¨ããã¦ããè²ã®ä¸è¦§ãéè¨ histogram = img.color_histogram.inject({}) {|h,pair| color = pair[0].to_color( Magick::AllCompliance, false, 8, true ) h[color] ||= 0 h[color] += pair[1] h }.sort_by {|pair| pair[1]*-1 } #使ç¨ããã¦ããé ã«ã½ã¼ã #å²åã
{{#tags}}- {{label}}
{{/tags}}