【发布时间】:2016-11-27 09:18:08
【问题描述】:
【问题讨论】:
-
您可以将 opencv 与 python 一起使用(它们也应该存在于 java 中,但我不确定)。使用它们可以操纵色彩空间和值,但我不确定这是否会解决这些图像的不同“花瓣”颜色的情况..
标签: java python image image-processing
【问题讨论】:
标签: java python image image-processing
在 Python 中,您可以借助 Image 模块来完成这些工作。
例如——
import Image
picture = Image.open("/path/to/my/picture.jpg")
r,g,b = picture.getpixel( (0,0) )
print("Red: {0}, Green: {1}, Blue: {2}".format(r,g,b))
以上代码将为您提供 (0,0) 处像素的信息
import Image
picture = Image.open("/path/to/my/picture.jpg")
# Get the size of the image
width, height = picture.size()
# Process every pixel
for x in width:
for y in height:
# get pixel color
current_color = picture.getpixel( (x,y) )
# your main logic here to choose new color
# put the new color on the pixel
picture.putpixel( (x,y), new_color)
【讨论】: