Funny Things002——鞋的颜色

Posted chenyun-

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Funny Things002——鞋的颜色相关的知识,希望对你有一定的参考价值。

网上的那张鞋子的图片到底是什么颜色的?灰绿色还是粉色?

1. 先截取图片中鞋的那块的图片,获取大小

2. 带入大小分别计算R,G,B平均值

3. 通过计算所得的数据画图可得结果

 1 from PIL import Image
 2 from pylab import *
 3 
 4 shoe = array(Image.open("shoe.jpg"))
 5 
 6 a = 0
 7 b = 0
 8 c = 0
 9 d = 96 * 96
10 
11 for i in range (95):
12     for j in range (95):
13         a += shoe[i, j][0]
14         b += shoe[i, j][1]
15         c += shoe[i, j][2]
16 
17 print(int(a/d),int(b/d),int(c/d))

图片见:https://github.com/chenger9/shoe-color

以上是关于Funny Things002——鞋的颜色的主要内容,如果未能解决你的问题,请参考以下文章

HLS NGINX-RTMP [错误] 1281#0:* 58 hls:强制片段拆分:10.002 秒

在片段中设置文本颜色

OpenGL 四 - 002OpenGL 图形渲染之颜色混合

AlertDialog 更改片段中的背景颜色 [重复]

AtCoder Grand Contest 002 (AGC002) F - Leftmost Ball 动态规划 排列组合

agc002fLeftmost Ball