網(wǎng)站首頁 編程語言 正文
效果展示
中心的三個(gè)沒檢測到
import cv2 import numpy as np import matplotlib.pyplot as plt w = 20 h = 5 params = cv2.SimpleBlobDetector_Params() # Setup SimpleBlobDetector parameters. print('params') print(params) print(type(params)) # Filter by Area. params.filterByArea = True params.minArea = 10e1 params.maxArea = 10e3 params.minDistBetweenBlobs = 25 # params.filterByColor = True params.filterByConvexity = False # tweak these as you see fit # Filter by Circularity # params.filterByCircularity = False # params.minCircularity = 0.2 # params.blobColor = 0 # # # Filter by Convexity # params.filterByConvexity = True # params.minConvexity = 0.87 # Filter by Inertia # params.filterByInertia = True # params.filterByInertia = False # params.minInertiaRatio = 0.01 # img = cv2.imread("circles/circels.jpg",1) img = cv2.imread("circles/Snap_001.jpg",1) gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) # Detect blobs. # image = cv2.resize(gray_img, (int(img.shape[1]/4),int(img.shape[0]/4)), 1, 1, cv2.INTER_LINEAR) # image = cv2.resize(gray_img, dsize=None, fx=0.25, fy=0.25, interpolation=cv2.INTER_LINEAR) minThreshValue = 120 _, gray = cv2.threshold(gray, minThreshValue, 255, cv2.THRESH_BINARY) gray = cv2.resize(gray, dsize=None, fx=2, fy=2, interpolation=cv2.INTER_LINEAR) # plt.imshow(gray) # cv2.imshow("gray",gray) detector = cv2.SimpleBlobDetector_create(params) keypoints = detector.detect(gray) print(len(keypoints)) fig = plt.figure() # im_with_keypoints = cv2.drawKeypoints(gray, keypoints, np.array([]), (0, 0, 255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS) im_with_keypoints = cv2.drawKeypoints(gray, keypoints, np.array([]), (0, 0, 255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS) plt.imshow(cv2.cvtColor(im_with_keypoints, cv2.COLOR_BGR2RGB),interpolation='bicubic') fname = "key points" titlestr = '%s found %d keypoints' % (fname, len(keypoints)) plt.title(titlestr) plt.show() # cv2.imshow("graykey",gray) # cv2.waitKey() fig.canvas.set_window_title(titlestr) ret, corners = cv2.findCirclesGrid(gray, (w, h), flags=(cv2.CALIB_CB_SYMMETRIC_GRID + cv2.CALIB_CB_CLUSTERING ), blobDetector=detector ) if corners is not None: cv2.drawChessboardCorners(img, (w, h), corners, corners is not None) print("find blob") # # cv2.imshow('findCorners', img) # cv2.waitKey() plt.imshow(img) plt.show()
原文鏈接:https://blog.csdn.net/moonlightpeng/article/details/124002491
相關(guān)推薦
- 2022-12-22 python3中超級好用的日志模塊-loguru模塊使用詳解_python
- 2022-07-26 tensorflow 加載模型時(shí) 報(bào)錯: ValueError: No variables to s
- 2023-01-23 重啟后nvidia-smi命令不可執(zhí)行出現(xiàn)“Make?sure?that?the?latest?NV
- 2022-06-04 python對文檔中元素刪除,替換操作_python
- 2022-06-02 C語言超詳細(xì)梳理排序算法的使用_C 語言
- 2022-07-30 C++深入分析講解函數(shù)與重載知識點(diǎn)_C 語言
- 2022-12-11 React中Redux核心原理深入分析_React
- 2023-05-23 numpy中的掩碼數(shù)組的使用_python
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支