문제 설명
인수 '%s'에 대해 예상 Ptrcv::UMat 임계값을 지정하는 동안 오류가 발생했습니다. (getting an error while doing thresholding Expected Ptrcv::UMat for argument '%s')
저는 OpenCv에서 내 회색조 이미지의 임계값을 지정하는 중이지만 오류가 표시됩니다(예: TypeError: '%s' 인수에 대한 예상 Ptr
).grey = cv2.cvtColor(o, cv2.COLOR_BGR2GRAY)
thresh1 = cv2.threshold(cv2.UMat(grey),127,255,cv2.THRESH_BINARY)
cv2.imshow("thresh1",thresh1)
cv2.waitKey(0)
cv2.destroyAllWindows()
참조 솔루션
방법 1:
You dont need cv2.UMat(grey), only the image.
import cv2
grey = cv2.cvtColor(o, cv2.COLOR_BGR2GRAY)
a, thresh1 = cv2.threshold(grey, 127, 255,cv2.THRESH_BINARY)
cv2.imshow("thresh1",thresh1)
cv2.waitKey(0)
cv2.destroyAllWindows()
(by Ammar Shabbir、SSR)
참조 문서
- getting an error while doing thresholding Expected Ptrcv::UMat for argument '%s' (CC BY‑SA 2.5/3.0/4.0)