简体   繁体   English

Python CV2 MSER无法正常工作

[英]Python cv2 MSER not working

I have installed cv2 ( opencv-3.0.0 ) on my Windows machine, but unable to access MSER class: 我已经在Windows计算机上安装了cv2opencv-3.0.0 ),但是无法访问MSER类:

import cv2
cv2.MSER()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'MSER'

For cv2 installation, I downloaded and extracted opencv-3.0.0.0.exe and then copied cv2.pyd to Ananconda sitepackage directory. 对于cv2安装,我下载并解压缩了opencv-3.0.0.0.exe ,然后将cv2.pyd复制到Ananconda sitepackage目录。

I see couple of post on internet about using cv2.MSER , but I can't figure out what is the issue with my cv2 . 我在网上看到一些有关使用cv2.MSER ,但是我不知道cv2的问题是什么。

I was refering opencv-2.4 way of using MSER. 我指的是使用MSER的opencv-2.4方法。 From opencv-3.0.0 documentation, it appears that I need to use following: 从opencv-3.0.0文档看来,我需要使用以下内容:

cv2.MSER_create() cv2.MSER_create()

cam = video.create_capture(video_src)
mser = cv2.MSER_create()
while True:
    ret, img = cam.read()
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    vis = img.copy()

    regions = mser.detectRegions(gray, None)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM