【发布时间】:2019-01-28 04:46:00
【问题描述】:
RGB 数据。如何在 Python、OpenCV 上计算和排序
我想在 Python、OpenCV 上工作,这些步骤如下
1. Get the RGB data from pictures
2. Calculate the R*G*B on each pixel of the pictures
3. Sort the data by descending order and plot them on graph or csv
4. Get the max and min and medium of R*G*B
我可以处理第 1 步。如下代码。 但是,我不知道如何在step2之后编写程序 最好将数据保存为 csv 或 numpy 有人有想法吗?请帮我。如果你给我看代码会很有帮助。
import cv2
import numpy
im_f = np.array(Image.open('data/image.jpg'), 'f')
print(im[:, :])
【问题讨论】:
-
对你来说粗略但最简单的方法,因为你正在学习如下:
im = cv2.imread(...);b,g,r = cv2.split(im);c = sorted(b*g*r,reverse=True); mx,min=c[-1],c[0]等等等等 -
请问你为什么要这样做/绘制这个?
标签: python-3.x numpy opencv