欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python opencv角點(diǎn)檢測(cè)連線功能的實(shí)現(xiàn)代碼

 更新時(shí)間:2020年11月24日 10:28:13   作者:圖像處理大大大大大牛啊  
這篇文章主要介紹了python opencv角點(diǎn)檢測(cè)連線功能的實(shí)現(xiàn)代碼,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

原始圖

在這里插入圖片描述

角點(diǎn)檢測(cè)

points = cv2.goodFeaturesToTrack(gray, 100, 0.01, 10)
points = np.int0(points).reshape(-1,2)

for point in points:
  x, y = point.ravel()
  cv2.circle(img, (x, y), 10, (0, 255, 0), -1)

在這里插入圖片描述

連線

cv2.line(img, (0, y1), (1000, y1), (0, 255, 0), thickness=3, lineType=8)
cv2.line(img, (0, y2), (1000, y2), (0, 255, 0), thickness=3, lineType=8)

在這里插入圖片描述

完整代碼

""" 
@author: qq群686070107
""" 
import cv2
import numpy as np
img=cv2.imread("1.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
points = cv2.goodFeaturesToTrack(gray, 100, 0.01, 10)
points = np.int0(points).reshape(-1,2)

for point in points:
  x, y = point.ravel()
  cv2.circle(img, (x, y), 10, (0, 255, 0), -1)


y1 = min(points[:,1])
y2 = max(points[:,1])

## small and big enough 
cv2.line(img, (0, y1), (1000, y1), (0, 255, 0), thickness=3, lineType=8)
cv2.line(img, (0, y2), (1000, y2), (0, 255, 0), thickness=3, lineType=8)

cv2.imshow("img", img)
cv2.waitKey(0)

到此這篇關(guān)于python opencv角點(diǎn)檢測(cè) 連線功能的實(shí)現(xiàn)代碼的文章就介紹到這了,更多相關(guān)python opencv角點(diǎn)檢測(cè)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論