久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

OPENCV:Calibratecamera 2 重投影錯誤和自定義計(jì)算的不

OPENCV: Calibratecamera 2 reprojection error and custom computed one not agree(OPENCV:Calibratecamera 2 重投影錯誤和自定義計(jì)算的不同意)
本文介紹了OPENCV:Calibratecamera 2 重投影錯誤和自定義計(jì)算的不同意的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我有一個 python 腳本,它使用 calibratecamera2 方法從棋盤的幾個視圖中校準(zhǔn)相機(jī).成功校準(zhǔn)后,我會追蹤所有原始點(diǎn)并繪制一些圖并再次計(jì)算重投影誤差.令我驚訝的是,opencv 計(jì)算的重投影誤差和我的有點(diǎn)不同.我覺得很奇怪.我是否以錯誤的方式計(jì)算它?

I have a python script that uses the calibratecamera2 method to calibrate a camera from a few views of a checker board. After a successful calibration I go after all original points and do some plots and compute again the re-projection error. My surprise is that the reprojection error computed by opencv and mine are a bit different. I found it strange. Am I computing it in a wrong way?

obj_points = []# 3d point in real world space. List of arrays
img_points = []# 2d points in image plane. List of arrays

...

ret, camera_matrix, dist_coeffs, rvecs, tvecs = cv2.calibrateCamera(obj_points, img_points, (w, h), camera_matrix, dist_coeffs, rvecs, tvecs, calib_flags +cv2.CALIB_USE_INTRINSIC_GUESS, criteria)
print "Final reprojection error opencv: ", ret   #Compute mean of reprojection error
tot_mean_error=0
mean_error_image = 0
for i in xrange(len(obj_points)):
    reprojected_points, _ = cv2.projectPoints(obj_points[i], rvecs[i], tvecs[i], camera_matrix, dist_coeffs)
    reprojected_points=reprojected_points.reshape(-1,2)
    mean_error_image=np.sum(np.sum(np.abs(img_points[i]-reprojected_points)**2,axis=-1)**(1./2))/np.alen(reprojected_points)
    tot_mean_error +=mean_error_image

mean_error=tot_mean_error/len(obj_points)
print "Mean reprojection error: ", mean_error

最終重投影錯誤opencv:0.571030279037

Final reprojection error opencv: 0.571030279037

平均重投影誤差:0.438696960449

Mean reprojection error: 0.438696960449

推薦答案

我計(jì)算錯誤/不同.我正在使用這種公式:

I was computing it wrong/differently. I was using this kind of formula:

但是opencv用的是這個:

But opencv uses this one:

所以,如果有人感興趣,代碼現(xiàn)在看起來像:

So, if anyone is interested the code looks now like:

#Compute mean of reprojection error
tot_error=0
total_points=0
for i in xrange(len(obj_points)):
    reprojected_points, _ = cv2.projectPoints(obj_points[i], rvecs[i], tvecs[i], camera_matrix, dist_coeffs)
    reprojected_points=reprojected_points.reshape(-1,2)
    tot_error+=np.sum(np.abs(img_points[i]-reprojected_points)**2)
    total_points+=len(obj_points[i])

mean_error=np.sqrt(tot_error/total_points)
print "Mean reprojection error: ", mean_error

最終重投影錯誤opencv:0.571030279037

Final reprojection error opencv: 0.571030279037

平均重投影誤差:0.571030718956

Mean reprojection error:0.571030718956

這篇關(guān)于OPENCV:Calibratecamera 2 重投影錯誤和自定義計(jì)算的不同意的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How should I verify a log message when testing Python code under nose?(在鼻子下測試 Python 代碼時,我應(yīng)該如何驗(yàn)證日志消息?)
Patch __call__ of a function(修補(bǔ)函數(shù)的 __call__)
How to call self in a mock method of an object in Python?(如何在 Python 中對象的模擬方法中調(diào)用 self?)
Mocking only a single method on an object(僅模擬對象上的單個方法)
Mocking a subprocess call in Python(在 Python 中模擬子進(jìn)程調(diào)用)
Checking call order across multiple mocks(檢查多個模擬的調(diào)用順序)
主站蜘蛛池模板: 99热热99| 亚洲男人的天堂网站 | 国产欧美一区二区三区免费 | 高清视频一区二区三区 | 国产精品精品久久久 | 久久久久一区二区三区 | 亚洲国产精品激情在线观看 | 日韩欧美一级片 | 91高清免费 | 亚洲欧美中文日韩在线v日本 | 中文字幕欧美在线观看 | 亚洲电影一区 | 国产一级视频免费播放 | 亚洲xxxxx | av福利网站| 亚洲日韩中文字幕一区 | 看片网站在线 | 午夜影院在线观看 | 天堂在线中文字幕 | 久久久久久久久久影视 | 91中文字幕在线 | 国产精品毛片一区二区三区 | 高清国产一区二区 | 午夜免费视频 | 午夜伦理影院 | 成人一区av偷拍 | 免费视频一区二区 | 成人亚洲片 | www九色| 午夜欧美| www.久| 欧美激情网站 | 高清久久 | 日本一区二区三区四区 | 国产精品成人一区二区三区 | 91视频网址 | 一区观看 | 国产高清一区二区 | 狠狠涩 | 九九色综合| 91精品国产91久久久久久吃药 |