matlab相機定標(biāo)工具箱程序的算法原理上課講義_第1頁
matlab相機定標(biāo)工具箱程序的算法原理上課講義_第2頁
matlab相機定標(biāo)工具箱程序的算法原理上課講義_第3頁
matlab相機定標(biāo)工具箱程序的算法原理上課講義_第4頁
matlab相機定標(biāo)工具箱程序的算法原理上課講義_第5頁
已閱讀5頁,還剩10頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

1、Good is good, but better carries it.精益求精,善益求善。matlab相機定標(biāo)工具箱程序的算法原理CameraCalibrationToolboxforMatlabDescriptionofthecalibrationparametersAftercalibration,thelistofparametersmaybestoredinthematabfileCalib_ResultsbyclickingonSave.Thelistofvariablesmaybeseparatedintotwocategories:Intrinsicparametersande

2、xtrinsicparameters.Intrinsicparameters(cameramodel):TheinternalcameramodelisverysimilartothatusedbyHYPERLINKhttp:/www.ee.oulu.fi/jth/Heikkil伯a(chǎn)andHYPERLINKhttp:/www.ee.oulu.fi/olli/SilvenattheHYPERLINKhttp:/www.ee.oulu.fi/UniversityofOuluinFinland.VisittheironlineHYPERLINKhttp:/www.ee.oulu.fi/jth/cal

3、ibr/Calibration.htmlcalibrationpage,andtheirHYPERLINKhttp:/www.ee.oulu.fi/jth/doc/publicationpage.WespecificallyrecommendtheirCVPR97paper:HYPERLINK/bouguetj/calib_doc/papers/heikkila97.pdfAFour-stepCameraCalibrationProcedurewithImplicitImageCorrection.Thelistofinternalparameters:Focallength:Thefocal

4、lengthinpixelsisstoredinthe2x1vectorfc.Principalpoint:Theprincipalpointcoordinatesarestoredinthe2x1vectorcc.Skewcoefficient:Theskewcoefficientdefiningtheanglebetweenthexandypixelaxesisstoredinthescalaralpha_c.Distortions:Theimagedistortioncoefficients(radialandtangentialdistortions)arestoredinthe5x1

5、vectorkc四個內(nèi)參,包括焦距fc,原點坐標(biāo)cc,相機坐標(biāo)系中x和y軸夾角alpha_c(接近90),幾何畸變系數(shù)kc.Definitionoftheintrinsicparameters:LetPbeapointinspaceofcoordinatevectorXXc=Xc;Yc;Zcinthecamerareferenceframe.Letusprojectnowthatpointontheimageplaneaccordingtotheintrinsicparameters(fc,cc,alpha_c,kc).Letxnbethenormalized(pinhole)imagepro

6、jection:Letr2=x2+y2.Afterincludinglensdistortion,thenewnormalizedpointcoordinatexdisdefinedasfollows:wheredxisthetangentialdistortionvector:Matlab中計算幾何畸變還考慮了切向畸變Therefore,the5-vectorkccontainsbothradialandtangentialdistortioncoefficients(observethatthecoefficientof6thorderradialdistortiontermisthefi

7、fthentryofthevectorkc).ItisworthnoticingthatthisdistortionmodelwasfirstintroducedbyBrownin1966andcalledPlumbBobmodel(radialpolynomial+thinprism).Thetangentialdistortionisduetodecentering,orimperfectcenteringofthelenscomponentsandothermanufacturingdefectsinacompoundlens.Formoredetails,refertoBrownsor

8、iginalpublicationslistedintheHYPERLINK/bouguetj/calib_doc/htmls/ref.htmlreferencepage.Oncedistortionisapplied,thefinalpixelcoordinatesx_pixel=xp;ypoftheprojectionofPontheimageplaneis:Therefore,thepixelcoordinatevectorx_pixelandthenormalized(distorted)coordinatevectorxdarerelatedtoeachotherthroughthe

9、linearequation:whereKKisknownasthecameramatrix,anddefinedasfollows:對應(yīng)于書上的線性映射矩陣AFc(1)和fc(2)分別對應(yīng)于矩陣A中的f/k和f/l,即轉(zhuǎn)化為按照x和y方向上的像素尺寸為單位Inmatlab,thismatrixisstoredinthevariableKKaftercalibration.Observethatfc(1)andfc(2)arethefocaldistance(auniquevalueinmm)expressedinunitsofhorizontalandverticalpixels.Bothc

10、omponentsofthevectorfcareusuallyverysimilar.Theratiofc(2)/fc(1),oftencalledaspectratio,isdifferentfrom1ifthepixelintheCCDarrayarenotsquare.Therefore,thecameramodelnaturallyhandlesnon-squarepixels.Inaddition,thecoefficientalpha_cencodestheanglebetweenthexandysensoraxes.Consequently,pixelsareevenallow

11、edtobenon-rectangular.Someauthorsrefertothattypeofmodelasaffinedistortionmodel.Inadditiontocomputingestimatesfortheintrinsicparametersfc,cc,kcandalpha_c,thetoolboxalsoreturnsestimatesoftheuncertaintiesonthoseparameters.Thematlabvariablescontainingthoseuncertaintiesarefc_error,cc_error,kc_error,alpha

12、_c_error.Forinformation,thosevectorsareapproximatelythreetimesthestandarddeviationsoftheerrorsofestimationFc_error,cc_error,kc_error,alpha_c_error這四個變量記錄四個內(nèi)參的不確定度,大小設(shè)定為三倍標(biāo)準(zhǔn)差.Hereisanexampleofoutputofthetoolboxafteroptimization:Inthiscasefc=657.30254;657.74391andfc_error=0.28487;0.28937,cc=302.71656;

13、242.33386,cc_error=0.59115;0.55710,.ImportantConvention:Pixelcoordinatesaredefinedsuchthat0;0isthecenteroftheupperleftpixel注意:圖像左上角默認(rèn)為原點0;0左下角為0;ny-1右上角為nx-1;0右下角為nx-1;ny-1oftheimage.Asaresult,nx-1;0iscenteroftheupperrightcornerpixel,0;ny-1isthecenterofthelowerleftcornerpixelandnx-1;ny-1isthecentero

14、fthelowerrightcornerpixelwherenxandnyarethewidthandheightoftheimage(fortheimagesofthefirstexample,nx=640andny=480).Onematlabfunctionprovidedinthetoolboxcomputesthatdirectpixelprojectionmap.Thisfunctionisproject_points2.m.Thisfunctiontakesinthe3Dcoordinatesofasetofpointsinspace(inworldreferenceframeo

15、rcamerareferenceframe)andtheintrinsiccameraparameters(fc,cc,kc,alpha_c),andreturnsthepixelprojectionsofthepointsontheimageplane.Seetheinformationgiveninthefunction函數(shù)project_points2.m將相機坐標(biāo)系下的三維點陣按照內(nèi)參轉(zhuǎn)化成圖像平面上的二位點陣.Theinversemapping:Theinverseproblemofcomputingthenormalizedimageprojectionvectorxnfromth

16、epixelcoordinatex_pixelisveryusefulinmostmachinevisionapplications.However,becauseofthehighdegreedistortionmodel,thereexistsnogeneralalgebraicexpressionforthisinversemap(alsocallednormalization).Inthetoolboxhowever,anumericalimplementationofinversemappingisprovidedintheformofafunction:normalize.m.He

17、reisthewaythefunctionshouldbecalled:xn=normalize(x_pixel,fc,cc,kc,alpha_c).Inthatsyntax,x_pixelandxnmayconsistofmorethanonepointcoordinates.Foranexampleofcall,seethematlabfunctioncompute_extrinsic_init.m.Reducedcameramodels:Currentlymanufacturedcamerasdonotalwaysjustifythisverygeneralopticalmodel.Fo

18、rexample,itnowcustomarytoassumerectangularpixels,andthusassumezeroskew(alpha_c=0).It一般情況下,相機坐標(biāo)系中的坐標(biāo)軸正交,alpha_c就可以默認(rèn)為0;在非廣角鏡頭中,一般徑向畸變模型到4階就足夠了(好的鏡頭2階就夠了),而且切向畸變可以忽略isinfactadefaultsettingofthetoolbox(theskewcoefficientnotbeingestimated).Furthermore,theverygeneric(6thorderradial+tangential)distortionm

19、odelisoftennotconsideredcompletely.Forstandardfieldofviews(nonwide-anglecameras),itisoftennotnecessary(andnotrecommended)topushtheradialcomponentofdistortionmodelbeyondthe4thorder(i.e.keepingkc(5)=0).Thisisalsoadefaultsettingofthetoolbox.Inaddition,thetangentialcomponentofdistortioncanoftenbediscard

20、ed(justifiedbythefactthatmostlensescurrentlymanufactureddonothaveimperfectionincentering).The4thordersymmetricradialdistortionwithnotangentialcomponent(thelastthreecomponentofkcaresettozero)isactuallythedistortionmodelusedbyHYPERLINK/bouguetj/calib_doc/htmls/ref.htmlZhang.Anotherverycommondistortion

21、modelforgoodopticalsystemsornarrowfieldofviewlensesisthesecondordersymmetricradialdistortionmodel.Inthatmodel,onlythefirstcomponentofthevectorkcisestimated,whiletheotherfouraresettozero.Thismodelisalsocommonlyusedwhenafewimagesareusedforcalibration(toolittledatatoestimateamorecomplexmodel).Asidefrom

22、distortionsandskew,othermodelreductionsarepossible.Forexample,whenonlyafewimagesareusedforcalibration(e.g.one,twoorthreeimages)theprincipalpointccisoftenverydifficulttoestimatereliably.Itisknowntobeoneofthemostdifficultpartofthenativeperspectiveprojectionmodeltoestimate(ignoringlensdistortions).Ifth

23、isisthecase,itissometimesbetter(andrecommended)tosettheprincipalpointatthecenteroftheimage(cc=(nx-1)/2;(ny-1)/2)andnotestimateitfurther.Finally,infewrareinstances,itmaybenecessarytorejecttheaspectratiofc(2)/fc(1)fromtheestimation.Althoughthisfinalmodelreductionstepispossiblewiththetoolbox,itisgenera

24、llynotrecommendedastheaspectratioisofteneasytoestimateveryreliably.Formoreinformationonhowtoperformmodelselectionwiththetoolbox,visittheHYPERLINK/bouguetj/calib_doc/htmls/example.htmlpagedescribingthefirstcalibrationexample.CorrespondencewithHeikkilnotation:IntheoriginalHYPERLINK/bouguetj/calib_doc/

25、papers/heikkila97.pdfHeikkilpaper,theinternalparametersappearwithslightlydifferentnames.Thefollowingtablegivesthecorrespondencebetweenthetwonotationschemes:OurnotationHeikkilnotationfc(1)f.Du.sufc(2)f.Dvcc(1)u0cc(2)v0alpha_c0kc(1)f3.k1kc(2)f5.k2kc(3)f2.p1kc(4)f2.p2kc(5)0AfewcommentsonHeikkilmodel:Sk

26、ewisnotestimated(alpha_c=0).Itmaynotbeaproblemasmostcamerascurrentlymanufactureddonothavecenteringimperfections.Theradialcomponentofthedistortionmodelisonlyuptothe4thorder.Thisissufficientformostcases.Thefourvariables(f,Du,Dv,su)replacingthe2x1focalvectorfcareingeneralimpossibletoestimateseparately.

27、Itisonlypossibleiftwoofthosevariablesareknown(forexamplethemetricfocalvaluefandthescalefactorsu).SeeHYPERLINK/bouguetj/calib_doc/papers/heikkila97.pdfHeikkilpaperformoreinformation.CorrespondencewithRegWillsonsnotation:InhisoriginalHYPERLINK/afs/user/rgw/www/TsaiCode.htmlimplementationoftheTsaicamer

28、acalibrationalgorithm,HYPERLINK/rgw/RegWillsonusesadifferentnotationforthecameraparameters.Thefollowingtablegivesthecorrespondencebetweenthetwonotationschemes:OurnotationWillsonsnotationfc(1)f.sx/dpxfc(2)f/dpycc(1)Cxcc(2)Cyalpha_c0Willsonusesafirstorderradialdistortionmodel(withanadditionalconstantk

29、appa1)thatdoesnothaveaneasyclosed-formcorespondencewithourdistortionmodel(encodedwiththecoefficientskc(1),.,kc(5).However,weincludedinthetoolboxafunctioncalledwillson_convertthatconvertstheentiresetofWillsonsparametersintoourparameters(includingdistortion).Thisfunctioniscalledinanotherfunctionwillso

30、n_readthatdirectlyloadsinacalibrationresultfilegeneratedbyWillsonscodeandcomputesthesetparameters(intrinsicandextrinsic)followingournotation(tousethatfunction,firstsetthematlabvariablecalib_filetothenameoftheoriginalwillsoncalibrationfile).AfewextracommentsonWillsonsmodel:SimilarlytoHeikkilmodel,the

31、skewisnotincludedinthemodel(alpha_c=0).SimilarlytoHeikkilmodel,thefourvariables(f,sx,dpx,dpy)replacingthe2x1focalvectorfcareingeneralimpossibletoestimateseparately.Itisonlypossibleiftwoofthosevariablesareknown(forexamplethemetricfocalvaluefandthescalefactorsx).Extrinsicparameters:Rotations:Asetofn_i

32、ma3x3rotationmatricesRc_1,Rc_2,.,Rc_20(assumingn_ima=20).Translations:A外部參數(shù)Rc和Tc同時注意n_ima好像是圖片的數(shù)量(對一個鏡頭進行參數(shù)估計的圖片數(shù)量)setofn_ima3x1vectorsTc_1,Tc_2,.,Tc_20(assumingn_ima=20).Definitionoftheextrinsicparameters:Considerthecalibrationgrid#i(attachedtotheithcalibrationimage),andconcentrateonthecamerarefere

33、nceframeattahedtothatgrid.Withoutlossofgenerality,takei=1.Thefollowingfigureshowsthereferenceframe(O,X,Y,Z)attachedtothatcalibrationgid.LetPbeapointspaceofcoordinatevectorXX=X;Y;Zinthegridreferenceframe(referenceframeshownonthepreviousfigure).LetXXc=Xc;Yc;ZcbethecoordinatevectorofPinthecamerareferenceframe.ThenXXandXXcarerelatedtoeachotherthroughthefollowingrigidmotionequation:XXc=Rc_1*XX+Tc_1XXc=Rc_1*XX+Tc_1世界坐標(biāo)系到相機坐標(biāo)系的投影,用兩個外部參數(shù)矩陣Inparticular,thetransla

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論