Hey, I've got so many PIL bounding box(x,y, x1,y1)开发者_高级运维
I just want to know how many colors are there in the bounding box, is there any fast way to do?
>>> myimg = ...
>>> colors = myimg.crop((x0, y0, x1, y1)).getcolors()
According to PIL's docs getcolors "Returns an unsorted list of (count, color) tuples, where the count is the number of times the corresponding color occurs in the image".
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论