2016-04-02 133 views
-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, :]) 

回答

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() 
相關問題