【问题标题】:Is there a way to convert x,y coordinates to a grayscale matrix? (python)有没有办法将 x,y 坐标转换为灰度矩阵? (Python)
【发布时间】:2020-06-26 09:19:07
【问题描述】:

例如,如果我有一个 2xN 矩阵,其中第一行是我的 x 值,第二行是我的 y 值,我可以将这些点转换为灰度矩阵吗?有这种事吗?

即)

X = [[1,2,3],[4,5,6]

【问题讨论】:

  • 灰度矩阵是什么意思?

标签: python matrix grayscale


【解决方案1】:

如果要转成灰度图

import numpy as np

X = [[1,2,3],[4,5,6]]

a=np.array(X)
grayscale=(a-np.amin(a))/(np.amax(a)-np.amin(a))

print(grayscale) # or do want ever you want

#if want to view the image
import cv2

cv2.imshow("grayscale", grayscale)
cv2.waitKey(0)
cv2.destroyAllWindows()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多