相关疑难解决方法(0)

导入语句python3的更改

我不理解pep-0404的以下内容

在Python 3中,包中的隐式相对导入不再可用 - 仅支持绝对导入和显式相对导入.此外,星型导入(例如来自x import*)仅允许在模块级代码中使用.

什么是相对进口?在python2中允许星形导​​入的其他地方?请举例说明.

python python-3.x

157
推荐指数
4
解决办法
10万
查看次数

TypeError:找不到必需参数'outImg'(pos 6)

当我运行我的python代码

import numpy as np
import cv2
import matplotlib.pyplot as plt

img1 = cv2.imread('/home/shar/home.jpg',0)          # queryImage
img2 = cv2.imread('/home/shar/home2.jpg',0) # trainImage

# Initiate SIFT detector

sift = cv2.xfeatures2d.SIFT_create()
# find the keypoints and descriptors with SIFT
kp1, des1 = sift.detectAndCompute(img1,None)
kp2, des2 = sift.detectAndCompute(img2,None)

# BFMatcher with default params
bf = cv2.BFMatcher()
matches = bf.knnMatch(des1,des2, k=2)

# Apply ratio test
good = []
for m,n in matches:
    if m.distance < 0.75*n.distance:
        good.append([m])

# cv2.drawMatchesKnn expects list of lists as matches. …
Run Code Online (Sandbox Code Playgroud)

python opencv opencv3.0

39
推荐指数
2
解决办法
4万
查看次数

AttributeError:'module'对象没有属性'ORB'

当我运行我的python代码

import numpy as np
import cv2
import matplotlib.pyplot as plt

img1 = cv2.imread('/home/shar/home.jpg',0)          # queryImage
img2 = cv2.imread('/home/shar/home2.jpg',0) # trainImage

# Initiate SIFT detector
orb = cv2.ORB()

# find the keypoints and descriptors with SIFT
kp1, des1 = orb.detectAndCompute(img1,None)
kp2, des2 = orb.detectAndCompute(img2,None)
# create BFMatcher object
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)

# Match descriptors.
matches = bf.match(des1,des2)

# Sort them in the order of their distance.
matches = sorted(matches, key = lambda x:x.distance)

# Draw first 10 matches.
img3 …
Run Code Online (Sandbox Code Playgroud)

python opencv opencv3.0

19
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×3

opencv ×2

opencv3.0 ×2

python-3.x ×1