聚热点 juredian

OpenCV python 相片修正 一起帮忙解决难题,拯救 IT 人的一天

import cv2 import numpy as np img=cv2.imread("C:/Users/humaolin/PycharmProjects/pythonProject/camera_cal/calibration1.jpg") gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) objpoints=[] imgpoints=[] img_size=gray.shape[1::-1] ret, corners = cv2.findChessboardCorners(gray, (9,6),None) ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, img_size,None,None) undistort_img = cv2.undistort(img, mtx, dist, None, mtx) cv2.imshow("gq",undistort_img) cv2.waitKey()``` 之上就是我的程式码 下边为出错信息 C:UsershumaolinPycharmProjectspythonProjectvenvScriptspython.exe C:/Users/humaolin/PycharmProjects/pythonProject/123.py Traceback (most recent call last): File "C:/Users/humaolin/PycharmProjects/pythonProject/123.py", line 12, inret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, img_size,None,None) cv2.error: OpenCV(4.5.2) C:UsersrunneradminappDataLocalTemppip-req-build-_8k9tw8nopencvmodulescalib3dsrccalibration.cpp:3694: error: (-215:Assertion failed) nimages > 0 in function "cv::calibrateCameraRO" Process finished with exit code 1

搜索建议: