전체 코드가 없습니다 :OpenCV의 파이썬 AttributeError : '모듈'개체가 어떤 속성 'imshow'
# import the necessary packages
from __future__ import print_function
import cv2
# load the image and convert it to grayscale
image = cv2.imread("jurassic_world.jpg")
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow("preview", image)
# initialize the AKAZE descriptor, then detect keypoints and extract
# local invariant descriptors from the image
detector = cv2.AKAZE_create()
(kps, descs) = detector.detectAndCompute(gray, None)
print("keypoints: {}, descriptors: {}".format(len(kps), descs.shape))
# draw the keypoints and show the output image
cv2.drawKeypoints(image, kps, image, (0, 255, 0))
cv2.imshow("Output", image)
cv2.waitKey(0)
오류 :
Traceback (most recent call last):
File "test_akaze.py", line 8, in <module>
cv2.imshow("preview", image)
AttributeError: 'module' object has no attribute 'imshow'
그래서 내가 대답을 조회하려고했습니다. 이 사이트에 비슷한 질문이다 그러나 나는 그들이 말을하려고 노력하고 도움이되지 않았다 : 여기 (0) 모두 imshow 후 cv2.waitKey을 추가
- 란 무슨 짓을
- (0) &를 0xFF (나는이에 대한 모든 무엇인지 전혀 모른다하지만 난 당신이 64 비트 시스템에 대한 나의 어떤 것을해야 할 어딘가에 읽기)
- 내가 imshow를 주석 한 cv2.waitKey로 변경 , 그 밖의 모든 것은 작동합니다. 나는 원하는 결과를 얻는다. 하지만 imshow는 설치되지 않은 것처럼 보입니다./
죄송합니다. 나는 정말 바보입니다. 그리고 나는 어둠을 찔렀다. 어떤 도움을 주셔서 감사합니다. pkg-config opencv --cflags --libs
의 출력에서
opencv 라이브러리를/usr/include에 복사 한 다음 다시 시도하십시오. –
중요한 모듈과 동일한 파일 이름을 지정했는지 확인하십시오. – user2357112
@JeruLuke : 견적 형식의 스택 추적을 사용하지 마십시오. – user2357112