大家好、
我使用 TDA4平台和 SDK 08.04。
我的摄像头是 FoV 119。
分辨率为1920x1080。
因为摄像机的 FOV 为119。
它需要查找表来消除失真。
请访问 e2e.ti.com/.../faq-tda4vm-how-to-create-a-ldc-mesh-lut-for-fisheye-distortion-correction-on-tda4
我从相机公司获得了相机失真表(distortion_table_FOV _ ParaxialHeight_RealHeight.xlsx)。
e2e.ti.com/.../distortion_5F00_table_5F00_fov_5F00_ParaxialHeight_5F00_RealHeight.xlsx
spec_file.txt 从 distortion_table_fov_ParaxialHeight_RealHeight.xlsx 的 A 和 C 列获取。
/* spec_file.txt */
e2e.ti.com/.../7418.spec_5F00_file.txt
gen_run.m、gen_lut.m 和 spec_file.txt 放置在同一目录中。
对于我的摄像机、Pit_in_mm 为0.003
F_IN_mm 对于我的摄像头为2.29
/* gen_run.m */
s = 2; m = 4; pitch_in_mm = 0.003; f_in_mm = 2.29; W = 1920; H = 1080; hc = W/2; vc = H/2; Wmesh = ceil(W / 2^m) * 2^m; Hmesh = ceil(H / 2^m) * 2^m; gen_lut("spec_file.txt", pitch_in_mm, f_in_mm, Wmesh, Hmesh, hc, vc, s, m);
/* gen_lut.m */
function [] = gen_lut(spec_file, pitch_in_mm,f_in_mm, W, H, hc, vc,s ,m) f = f_in_mm/pitch_in_mm ; [h_p , v_p] = meshgrid( 0:W, 0:H); [h_d,v_d] = xyz2distorted(h_p,v_p, f/s, hc, vc,spec_file, pitch_in_mm); h_delta = round((h_d-h_p) * 8); v_delta = round((v_d-v_p) * 8); mh = h_delta(1:2^m:end, 1:2^m:end)'; mv = v_delta(1:2^m:end, 1:2^m:end)'; dlmwrite('mesh.txt', [mh(:), mv(:)], 'delimiter', ' '); function [h_d, v_d] = xyz2distorted(x, y, z, hc, vc, spec_file, pitch_in_mm) [phi, r] = cart2pol(x-hc, y-vc); theta = atan2(r, z); lut = read_spec(spec_file, pitch_in_mm); r = interp1(lut(:,1), lut(:,2), theta); [h_d, v_d] = pol2cart(phi, r); h_d = h_d + hc; v_d = v_d + vc; function lut = read_spec(spec_file, pitch_in_mm) lut0 = dlmread(spec_file); theta = lut0(:,1)/180*pi; lut = [theta, lut0(:,2)/pitch_in_mm];
我在 Octave 上运行 gen_run.m。
它生成 mesh.txt。
/* mesh.txt */
/*生成 mesh.txt.bin */
Jason:~μ C/processor_sdk_vision_03_08_00_00/vision_sdk/apps/tools/LDC_mesh_table_convert$./convert.sh mesh.txt 1920 1080 16.
/* bin 至 win 10上的头文件、获取 mesh_lut_fov119.h */
D:\bin2c>bin2c.exe mesh.txt.bin mesh_lut_fov119.h fov119
/* mesh_lut_fov119.h */
e2e.ti.com/.../mesh_5F00_lut_5F00_fov119.h
我修改了 vision_apps\modules_src\app_LDC_modules.c
LCD_LUT_1920_1080替换为 FOV119DCC_CFG。
#include "app_ldc_module.h" #include "ldc_lut_1920x1080.h" #include "mesh_lut_fov119.h" //static uint8_t g_ldc_lut[] = LDC_LUT_1920_1080; static uint8_t g_ldc_lut[] = FOV119DCC_CFG;
当运行 run_app_tidl_od_cam.sh 时、它将导致分段故障。
我想问题是 FOV119DCC_CFG 的大小。
FOV119DCC_CFG 的大小仅为35328。
但 LCD_LUT_1920_1080的大小为537664。
如何生成537664尺寸查找表?
我是否有任何步进错误?
此致
-Jason