我已将此代码的图像坐标点检索到数组。我可以将此坐标点绘制到图像中。
import numpy as np
import matplotlib.pyplot as plt
import cv2
img = cv2.imread('2.jpg')
edge = cv2.Canny(img, 100, 200)
ans = []
for y in range(0, edge.shape[0]):
for x in range(0, edge.shape[1]):
if edge[y, x] != 0:
ans = ans + [[x, y]]
ans = np.array(ans)
print(ans.shape)
print(ans[0:10, :])
答案 0 :(得分:0)
import numpy as np
import matplotlib.pyplot as plt
import cv2
img = cv2.imread('2.jpg')
edge = cv2.Canny(img, 100, 200)
plt.subplot(122),plt.imshow(edge,cmap = 'gray')
plt.show()