2
我已將此發佈到雅虎的opencv組,沒有運氣。非平面鑽井平臺的OpenCV攝像機標定
我從3D校準裝置拍攝的一張照片中得到一組圖像/對象點,而不使用棋盤格。我使用了Bouguet相機校準工具箱的Matlab中的數據,它工作正常!我試圖擺脫Matlab(也許我不應該)。
我的代碼是下面,我不斷收到這個錯誤 「\的OpenCV-2.3.1 \模塊\ calib3d \ SRC \ calibration.cpp:3161:錯誤:(-215)NI> = 0」
我一直在嘗試使用opencv 2.3.1 python包裝。此外,我定義的初始相機矩陣非常接近Matlab工具箱中的計算值。我有一種感覺,將Matlab代碼轉換爲python比將它運行起來更容易,但我希望有人能證明這是錯誤的。預先感謝您的幫助。約翰
import cv2
import numpy as np
obj_points = [[-9.7,3.0,4.5],[-11.1,0.5,3.1],[-8.5,0.9,2.4],[-5.8,4.4,2.7], [-4.8,1.5,0.2],[-6.7,-1.6,-0.4],[-8.7,-3.3,-0.6],[-4.3,-1.2,-2.4],[-12.4,-2.3,0.9], [-14.1,-3.8,-0.6],[-18.9,2.9,2.9],[-14.6,2.3,4.6],[-16.0,0.8,3.0],[-18.9,-0.1,0.3], [-16.3,-1.7,0.5],[-18.6,-2.7,-2.2]]
img_points = [[993.0,623.0],[942.0,705.0],[1023.0,720.0],[1116.0,645.0],[1136.0,764.0],[1071.0,847.0],[1003.0,885.0],[1142.0,887.0],[886.0,816.0],[827.0,883.0],[710.0,636.0],[837.0,621.0],[789.0,688.0],[699.0,759.0],[768.0,800.0],[697.0,873.0]]
obj_points = np.array(obj_points)
img_points = np.array(img_points)
w = 1680
h = 1050
size = (w,h)
camera_matrix = np.zeros((3, 3))
camera_matrix[0,0]= 2200.0
camera_matrix[1,1]= 2200.0
camera_matrix[2,2]=1.0
camera_matrix[2,0]=750.0
camera_matrix[2,1]=750.0
dist_coefs = np.zeros(4)
results = cv2.calibrateCamera(obj_points, img_points,size, camera_matrix, dist_coefs)
這個環節就是回答OpenCV 2.3 camera calibration
這正是「矢量矢量」給我帶來的問題 – hokiebird 2012-05-02 20:51:38