python opencv角點(diǎn)檢測(cè)連線功能的實(shí)現(xiàn)代碼
原始圖
角點(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 cv2import numpy as npimg=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)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. 基于javaweb+jsp實(shí)現(xiàn)學(xué)生宿舍管理系統(tǒng)2. 多級(jí)聯(lián)動(dòng)下拉選擇框,動(dòng)態(tài)獲取下一級(jí)3. ASP.NET MVC實(shí)現(xiàn)樹形導(dǎo)航菜單4. 如何封裝一個(gè)Ajax函數(shù)5. Java 接口和抽象類的區(qū)別詳解6. Laravel Eloquent ORM高級(jí)部分解析7. IDEA 搭建maven 安裝、下載、配置的圖文教程詳解8. jsp response.sendRedirect()用法詳解9. Spring security 自定義過濾器實(shí)現(xiàn)Json參數(shù)傳遞并兼容表單參數(shù)(實(shí)例代碼)10. PHP擴(kuò)展之URL編碼、解碼及解析——URLs
