1
私は魚眼カメラを使用しています。私はキャリブレーションして、OpenCVまたはPythonで他のライブラリを使用してバレル歪みを修正したいと思います。私は古典的なチェス盤のパターンを使ってさまざまな方法でさまざまな方法を試みました。フィッシュアイキャリブレーションOpenCV Python
私はこのアプローチを以下されています。その後、
# Prepare object points, like (0,0,0), (1,0,0), (2,0,0), ...,(7,5,0)
object_p = np.zeros((self.__ny*self.__nx,3),np.float32)
object_p[:,:2] = np.mgrid[0:self.__nx,0:self.__ny].T.reshape(-1,2) # s,y coordinates
for image_filename in calibration_filenames:
# Read in each image
image = cv2.imread(image_filename)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # RGB is standard in matlibplot
# Convert to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
# Find the chessboard corners
ret, corners = cv2.findChessboardCorners(gray, (self.__nx, self.__ny), None)
# If found, draw corners
if ret == True:
# Store the corners found in the current image
object_points.append(object_p) # how it should look like
image_points.append(corners) # how it looks like
# Draw and display the corners
cv2.drawChessboardCorners(image, (self.__nx, self.__ny), corners, ret)
plt.figure()
plt.imshow(image)
plt.show()
# Do the calibration
ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(object_points, image_points, shape, None, None)
そして、この私の画像を修正するには:
cv2.undistort(image, mtx, dist, None, mtx)
主な問題は、補正が一部の画像との良好な実行しても、非常に敏感である、ということですカメラの場所に。カメラのcmの変化は、非常に異なる補正をもたらす(下記参照)。
私が補正された画像には常にグリッド領域を維持表示するには、このズーム効果を制御することができる方法の任意のアイデア?
この質問はhereのものと似ている可能性があります。
もう少し詳しく説明してください。どうやってやるの? – m33n
歪みのないバレル歪みは、画像の見かけ上の拡大をもたらす。これは、物理的歪曲レンズが、同じ焦点距離を有するピンホールカメラの画像領域の「外側」にあるセンサ光線上に投影するためである。これが、完全に歪んでいない長方形の画像において、有効部分が「蝶」形状を有する理由である。写真はhttps://stackoverflow.com/questions/18742679/how-to-get-all-undistorted-image-with-opencvにあります。 getOptimalNewCameraMatrixを使用して、そこの提案を参照してください。 –