-1
このコードから画像への座標点を配列に取得しました。この座標点を画像にプロットすることができます。画像に座標点をプロットする方法
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, :])