海思魚眼矯正

2021-09-28 05:17:42 字數 3193 閱讀 7025

檢視具體晶元的gdc 硬體規格,主要看以下引數:

一般魚眼矯正是在vi的擴充套件通道

即:初始化vi模組後:

vi_ext_chn_attr_s   stextchnattr;

vi_chn viextchn = vi_ext_chn_start;

size_s stdstsize;

s32ret = hi_mpi_vi_getchnattr(vipipe, vichn, &stchnattr);

if (hi_success != s32ret)

stextchnattr.s32bindchn = vichn; //擴充套件通道繫結vi通道

stextchnattr.encompressmode = stchnattr.encompressmode;

stextchnattr.enpixformat = stchnattr.enpixelformat;

stextchnattr.stframerate.s32srcframerate = stchnattr.stframerate.s32srcframerate;

stextchnattr.stframerate.s32dstframerate = stchnattr.stframerate.s32dstframerate;

stextchnattr.stsize.u32width = stchnattr.stsize.u32width;

stextchnattr.stsize.u32height = stchnattr.stsize.u32height;

stextchnattr.u32depth = 0;

stextchnattr.endynamicrange = stchnattr.endynamicrange;

stextchnattr.ensource = vi_ext_chn_source_tail;

stdstsize.u32width = stchnattr.stsize.u32width;

stdstsize.u32height = stchnattr.stsize.u32height;

/* start vi dev extern chn */

s32ret = hi_mpi_vi_setextchnattr(vipipe, viextchn, &stextchnattr);

if (hi_success != s32ret)

/*enable ext-channel*/

s32ret = hi_mpi_vi_enablechn(vipipe,viextchn);

if (hi_success != s32ret)

使能vi擴充套件通道後,將後面的繫結關係繫結在vi擴充套件通道上,例如:

vi -----viext-----vpss-----venc

之後設定魚眼屬性:

fisheye_attr_s      stfisheyeattr;

stfisheyeattr.benable = hi_true;

stfisheyeattr.blmf = hi_false;

stfisheyeattr.bbgcolor = hi_false;

stfisheyeattr.u32bgcolor = color_rgb_blue;

stfisheyeattr.s32horoffset = 0;

stfisheyeattr.s32veroffset = 0;

stfisheyeattr.u32trapezoidcoef = 10;

stfisheyeattr.s32fanstrength = 300;

stfisheyeattr.enmountmode = fisheye_wall_mount;

stfisheyeattr.u32regionnum = 1;

stfisheyeattr.astfisheyeregionattr[0].enviewmode = fisheye_view_180_panorama;

stfisheyeattr.astfisheyeregionattr[0].u32inradius = 0;

stfisheyeattr.astfisheyeregionattr[0].u32outradius = 1200;

stfisheyeattr.astfisheyeregionattr[0].u32pan = 180;

stfisheyeattr.astfisheyeregionattr[0].u32tilt = 165;

stfisheyeattr.astfisheyeregionattr[0].u32horzoom = 4095;

stfisheyeattr.astfisheyeregionattr[0].u32verzoom = 4095;

stfisheyeattr.astfisheyeregionattr[0].stoutrect.s32x = 0;

stfisheyeattr.astfisheyeregionattr[0].stoutrect.s32y = 0;

stfisheyeattr.astfisheyeregionattr[0].stoutrect.u32width = stdstsize.u32width;

stfisheyeattr.astfisheyeregionattr[0].stoutrect.u32height = align_down(stdstsize.u32height, 2);

s32ret = hi_mpi_vi_setextchnfisheye(vipipe,viextchn,&stfisheyeattr);

if (hi_success != s32ret)

具體引數設定參看gdc除錯指南

實時魚眼校正

魚眼校正在opencv裡面有,比較複雜,主要思想是用棋盤首先對魚眼校正,儲存相關引數到xml中 後續校正的時候,直接用xml中儲存的引數,不需要計算,過程較複雜,在速度上如果用opencl或cuda實現也滿足需要 才用該方法,速度沒得說,如果後面需要全景拼接,也是可以在opengl中實現的 因為兩張...

魚眼相機成像模型

魚眼鏡頭一般是由十幾個不同的透鏡組合而成的,在成像的過程中,入射光線經過不同程度的折射,投影到尺寸有限的成像平面上,使得魚眼鏡頭與普通鏡頭相比起來擁有了更大的視野範圍。下圖表示出了魚眼相機的一般組成結構。最前面的兩個鏡頭發生折射,使入射角減小,其餘的鏡頭相當於乙個成像鏡頭,這種多元件的構造結構使對魚...

魚眼相機標定模型

camera calibration是計算camera的extrinsic 外參 和 intrinsic 內參 的過程。一旦你標定完成了乙個camera,你即可從2維影象中去恢復3維影象。你同樣可以在在乙個魚眼相機中獲得未失真的影象。為了將3維世界座標系的點關聯到2維影象座標系中,必須獲取相機的外部...