Hi all,
I use TDA4 platform and SDK 08.04.
My camera is FOV 119.
The resolution is 1920x1080.
Because camera is FOV 119.
It need a look up table to remove distortion.
I refer e2e.ti.com/.../faq-tda4vm-how-to-create-a-ldc-mesh-lut-for-fisheye-distortion-correction-on-tda4
I got camera distortion table(distortion_table_fov_ParaxialHeight_RealHeight.xlsx) from camera company.
distortion_table_fov_ParaxialHeight_RealHeight.xlsx
spec_file.txt get from the column A and C of distortion_table_fov_ParaxialHeight_RealHeight.xlsx .
/* spec_file.txt */
0.1 0.00511412 0.2 0.01022824 0.3 0.01534235 0.4 0.02045645 0.5 0.02557053 0.6 0.0306846 0.7 0.03579866 0.8 0.04091269 0.9 0.04602669 1 0.05114067 1.1 0.05625461 1.2 0.06136852 1.3 0.06648239 1.4 0.07159622 1.5 0.07671 1.6 0.08182374 1.7 0.08693742 1.8 0.09205105 1.9 0.09716463 2 0.10227814 2.1 0.10739159 2.2 0.11250497 2.3 0.11761828 2.4 0.12273152 2.5 0.12784468 2.6 0.13295776 2.7 0.13807075 2.8 0.14318366 2.9 0.14829648 3 0.15340921 3.1 0.15852184 3.2 0.16363437 3.3 0.16874679 3.4 0.17385911 3.5 0.17897132 3.6 0.18408342 3.7 0.1891954 3.8 0.19430726 3.9 0.199419 4 0.20453061 4.1 0.2096421 4.2 0.21475345 4.3 0.21986466 4.4 0.22497573 4.5 0.23008666 4.6 0.23519745 4.7 0.24030808 4.8 0.24541856 4.9 0.25052889 5 0.25563905 5.1 0.26074905 5.2 0.26585889 5.3 0.27096855 5.4 0.27607804 5.5 0.28118735 5.6 0.28629648 5.7 0.29140543 5.8 0.29651419 5.9 0.30162276 6 0.30673113 6.1 0.31183931 6.2 0.31694728 6.3 0.32205505 6.4 0.32716261 6.5 0.33226995 6.6 0.33737708 6.7 0.342484 6.8 0.34759068 6.9 0.35269714 7 0.35780337 7.1 0.36290937 7.2 0.36801513 7.3 0.37312064 7.4 0.37822592 7.5 0.38333094 7.6 0.38843571 7.7 0.39354022 7.8 0.39864448 7.9 0.40374847 8 0.40885219 8.1 0.41395564 8.2 0.41905882 8.3 0.42416171 8.4 0.42926433 8.5 0.43436666 8.6 0.43946869 8.7 0.44457044 8.8 0.44967188 8.9 0.45477303 9 0.45987386 9.1 0.46497439 9.2 0.47007461 9.3 0.4751745 9.4 0.48027408 9.5 0.48537333 9.6 0.49047225 9.7 0.49557083 9.8 0.50066908 9.9 0.50576699 10 0.51086455 10.1 0.51596176 10.2 0.52105862 10.3 0.52615512 10.4 0.53125126 10.5 0.53634703 10.6 0.54144243 10.7 0.54653746 10.8 0.55163211 10.9 0.55672637 11 0.56182025 11.1 0.56691374 11.2 0.57200683 11.3 0.57709952 11.4 0.58219181 11.5 0.58728369 11.6 0.59237516 11.7 0.59746621 11.8 0.60255684 11.9 0.60764704 12 0.61273681 12.1 0.61782615 12.2 0.62291506 12.3 0.62800351 12.4 0.63309152 12.5 0.63817908 12.6 0.64326618 12.7 0.64835282 12.8 0.653439 12.9 0.6585247 13 0.66360993 13.1 0.66869469 13.2 0.67377895 13.3 0.67886273 13.4 0.68394602 13.5 0.68902881 13.6 0.6941111 13.7 0.69919288 13.8 0.70427415 13.9 0.7093549 14 0.71443513 14.1 0.71951484 14.2 0.72459402 14.3 0.72967266 14.4 0.73475076 14.5 0.73982832 14.6 0.74490533 14.7 0.74998178 14.8 0.75505768 14.9 0.76013301 15 0.76520777 15.1 0.77028196 15.2 0.77535557 15.3 0.7804286 15.4 0.78550104 15.5 0.79057289 15.6 0.79564414 15.7 0.80071478 15.8 0.80578482 15.9 0.81085424 16 0.81592305 16.1 0.82099123 16.2 0.82605879 16.3 0.83112571 16.4 0.83619199 16.5 0.84125763 16.6 0.84632262 16.7 0.85138696 16.8 0.85645064 16.9 0.86151366 17 0.866576 17.1 0.87163767 17.2 0.87669867 17.3 0.88175897 17.4 0.88681859 17.5 0.89187751 17.6 0.89693574 17.7 0.90199325 17.8 0.90705006 17.9 0.91210615 18 0.91716151 18.1 0.92221615 18.2 0.92727006 18.3 0.93232323 18.4 0.93737566 18.5 0.94242734 18.6 0.94747827 18.7 0.95252843 18.8 0.95757784 18.9 0.96262647 19 0.96767433 19.1 0.9727214 19.2 0.97776769 19.3 0.98281319 19.4 0.98785789 19.5 0.99290179 19.6 0.99794488 19.7 1.00298716 19.8 1.00802861 19.9 1.01306924 20 1.01810905 20.1 1.02314801 20.2 1.02818614 20.3 1.03322341 20.4 1.03825984 20.5 1.0432954 20.6 1.0483301 20.7 1.05336394 20.8 1.05839689 20.9 1.06342897 21 1.06846016 21.1 1.07349046 21.2 1.07851986 21.3 1.08354835 21.4 1.08857594 21.5 1.09360261 21.6 1.09862836 21.7 1.10365319 21.8 1.10867708 21.9 1.11370003 22 1.11872204 22.1 1.1237431 22.2 1.12876321 22.3 1.13378236 22.4 1.13880054 22.5 1.14381774 22.6 1.14883397 22.7 1.15384921 22.8 1.15886347 22.9 1.16387673 23 1.16888898 23.1 1.17390023 23.2 1.17891047 23.3 1.18391969 23.4 1.18892788 23.5 1.19393504 23.6 1.19894117 23.7 1.20394625 23.8 1.20895028 23.9 1.21395326 24 1.21895518 24.1 1.22395604 24.2 1.22895582 24.3 1.23395453 24.4 1.23895215 24.5 1.24394868 24.6 1.24894411 24.7 1.25393845 24.8 1.25893168 24.9 1.26392379 25 1.26891479 25.1 1.27390466 25.2 1.2788934 25.3 1.283881 25.4 1.28886746 25.5 1.29385277 25.6 1.29883693 25.7 1.30381992 25.8 1.30880175 25.9 1.31378241 26 1.31876189 26.1 1.32374018 26.2 1.32871728 26.3 1.33369319 26.4 1.33866789 26.5 1.34364139 26.6 1.34861367 26.7 1.35358473 26.8 1.35855457 26.9 1.36352317 27 1.36849054 27.1 1.37345666 27.2 1.37842153 27.3 1.38338514 27.4 1.38834749 27.5 1.39330857 27.6 1.39826838 27.7 1.40322691 27.8 1.40818416 27.9 1.41314011 28 1.41809476 28.1 1.42304811 28.2 1.42800015 28.3 1.43295087 28.4 1.43790027 28.5 1.44284834 28.6 1.44779508 28.7 1.45274048 28.8 1.45768453 28.9 1.46262723 29 1.46756857 29.1 1.47250855 29.2 1.47744715 29.3 1.48238439 29.4 1.48732023 29.5 1.49225469 29.6 1.49718776 29.7 1.50211943 29.8 1.50704968 29.9 1.51197853 30 1.51690596 30.1 1.52183197 30.2 1.52675654 30.3 1.53167968 30.4 1.53660137 30.5 1.54152162 30.6 1.54644041 30.7 1.55135774 30.8 1.55627361 30.9 1.561188 31 1.56610092 31.1 1.57101235 31.2 1.57592228 31.3 1.58083073 31.4 1.58573767 31.5 1.5906431 31.6 1.59554701 31.7 1.60044941 31.8 1.60535028 31.9 1.61024961 32 1.61514741 32.1 1.62004366 32.2 1.62493836 32.3 1.6298315 32.4 1.63472308 32.5 1.63961309 32.6 1.64450152 32.7 1.64938838 32.8 1.65427364 32.9 1.65915731 33 1.66403938 33.1 1.66891985 33.2 1.6737987 33.3 1.67867594 33.4 1.68355155 33.5 1.68842553 33.6 1.69329788 33.7 1.69816858 33.8 1.70303763 33.9 1.70790503 34 1.71277077 34.1 1.71763484 34.2 1.72249724 34.3 1.72735796 34.4 1.73221699 34.5 1.73707433 34.6 1.74192998 34.7 1.74678391 34.8 1.75163614 34.9 1.75648666 35 1.76133545 35.1 1.76618251 35.2 1.77102783 35.3 1.77587142 35.4 1.78071325 35.5 1.78555334 35.6 1.79039166 35.7 1.79522822 35.8 1.800063 35.9 1.80489601 36 1.80972723 36.1 1.81455665 36.2 1.81938428 36.3 1.82421011 36.4 1.82903413 36.5 1.83385632 36.6 1.8386767 36.7 1.84349525 36.8 1.84831195 36.9 1.85312682 37 1.85793984 37.1 1.862751 37.2 1.8675603 37.3 1.87236774 37.4 1.87717329 37.5 1.88197697 37.6 1.88677876 37.7 1.89157865 37.8 1.89637665 37.9 1.90117273 38 1.90596691 38.1 1.91075916 38.2 1.91554948 38.3 1.92033787 38.4 1.92512432 38.5 1.92990882 38.6 1.93469137 38.7 1.93947196 38.8 1.94425058 38.9 1.94902723 39 1.9538019 39.1 1.95857457 39.2 1.96334526 39.3 1.96811394 39.4 1.97288062 39.5 1.97764528 39.6 1.98240791 39.7 1.98716852 39.8 1.99192709 39.9 1.99668363 40 2.00143811 40.1 2.00619053 40.2 2.01094089 40.3 2.01568918 40.4 2.02043539 40.5 2.02517951 40.6 2.02992155 40.7 2.03466148 40.8 2.03939931 40.9 2.04413502 41 2.04886861 41.1 2.05360008 41.2 2.0583294 41.3 2.06305659 41.4 2.06778162 41.5 2.0725045 41.6 2.07722521 41.7 2.08194375 41.8 2.0866601 41.9 2.09137427 42 2.09608624 42.1 2.10079601 42.2 2.10550357 42.3 2.11020891 42.4 2.11491203 42.5 2.11961291 42.6 2.12431155 42.7 2.12900794 42.8 2.13370207 42.9 2.13839394 43 2.14308353 43.1 2.14777084 43.2 2.15245586 43.3 2.15713859 43.4 2.16181901 43.5 2.16649711 43.6 2.1711729 43.7 2.17584635 43.8 2.18051747 43.9 2.18518624 44 2.18985266 44.1 2.19451671 44.2 2.19917839 44.3 2.20383769 44.4 2.2084946 44.5 2.21314912 44.6 2.21780123 44.7 2.22245093 44.8 2.2270982 44.9 2.23174304 45 2.23638544 45.1 2.24102539 45.2 2.24566289 45.3 2.25029792 45.4 2.25493047 45.5 2.25956053 45.6 2.26418811 45.7 2.26881318 45.8 2.27343574 45.9 2.27805577 46 2.28267328 46.1 2.28728825 46.2 2.29190066 46.3 2.29651052 46.4 2.30111781 46.5 2.30572253 46.6 2.31032465 46.7 2.31492418 46.8 2.31952111 46.9 2.32411542 47 2.3287071 47.1 2.33329614 47.2 2.33788255 47.3 2.34246629 47.4 2.34704737 47.5 2.35162578 47.6 2.3562015 47.7 2.36077453 47.8 2.36534485 47.9 2.36991245 48 2.37447733 48.1 2.37903947 48.2 2.38359887 48.3 2.38815551 48.4 2.39270938 48.5 2.39726047 48.6 2.40180877 48.7 2.40635428 48.8 2.41089697 48.9 2.41543684 49 2.41997388 49.1 2.42450808 49.2 2.42903942 49.3 2.4335679 49.4 2.4380935 49.5 2.44261621 49.6 2.44713603 49.7 2.45165293 49.8 2.45616692 49.9 2.46067797 50 2.46518608 50.1 2.46969123 50.2 2.47419341 50.3 2.47869262 50.4 2.48318883 50.5 2.48768205 50.6 2.49217224 50.7 2.49665942 50.8 2.50114355 50.9 2.50562463 51 2.51010266 51.1 2.5145776 51.2 2.51904946 51.3 2.52351823 51.4 2.52798388 51.5 2.5324464 51.6 2.53690579 51.7 2.54136203 51.8 2.54581511 51.9 2.55026502 52 2.55471174 52.1 2.55915526 52.2 2.56359556 52.3 2.56803264 52.4 2.57246649 52.5 2.57689708 52.6 2.5813244 52.7 2.58574845 52.8 2.59016921 52.9 2.59458666 53 2.5990008 53.1 2.6034116 53.2 2.60781906 53.3 2.61222316 53.4 2.61662389 53.5 2.62102123 53.6 2.62541517 53.7 2.6298057 53.8 2.6341928 53.9 2.63857646 54 2.64295666 54.1 2.6473334 54.2 2.65170665 54.3 2.6560764 54.4 2.66044264 54.5 2.66480535 54.6 2.66916452 54.7 2.67352014 54.8 2.67787218 54.9 2.68222064 55 2.6865655 55.1 2.69090675 55.2 2.69524436 55.3 2.69957833 55.4 2.70390864 55.5 2.70823528 55.6 2.71255823 55.7 2.71687747 55.8 2.72119299 55.9 2.72550477 56 2.72981281 56.1 2.73411708 56.2 2.73841756 56.3 2.74271425 56.4 2.74700713 56.5 2.75129622 56.6 2.75558145 56.7 2.75986282 56.8 2.76414031 56.9 2.76841389 57 2.77268356 57.1 2.7769493 57.2 2.78121109 57.3 2.78546892 57.4 2.78972277 57.5 2.79397262 57.6 2.79821846 57.7 2.80246027 57.8 2.80669803 57.9 2.81093173 58 2.81516135 58.1 2.81938688 58.2 2.8236083 58.3 2.82782558 58.4 2.83203872 58.5 2.8362477 58.6 2.8404525 58.7 2.8446531 58.8 2.84884949 58.9 2.85304165 59 2.85722956 59.1 2.8614132 59.2 2.86559256 59.3 2.86976763 59.4 2.87393837 59.5 2.87810478 59.6 2.88226684 59.7 2.88642453 59.8 2.89057783 59.9 2.89472672 60 2.89887119 60.1 2.90301122 60.2 2.9071468 60.3 2.91127789 60.4 2.9154045 60.5 2.91952659 60.6 2.92364414 60.7 2.92775715 60.8 2.9318656 60.9 2.93596946 61 2.94006871 61.1 2.94416334 61.2 2.94825334 61.3 2.95233867 61.4 2.95641933 61.5 2.96049529 61.6 2.96456654 61.7 2.96863306 61.8 2.97269482 61.9 2.97675181 62 2.98080402 62.1 2.98485142 62.2 2.98889399 62.3 2.99293171 62.4 2.99696457 62.5 3.00099255 62.6 3.00501562 62.7 3.00903378 62.8 3.01304699 62.9 3.01705524 63 3.02105851 63.1 3.02505679 63.2 3.02905005 63.3 3.03303826 63.4 3.03702143 63.5 3.04099942 63.6 3.04497223 63.7 3.04893993 63.8 3.05290249 63.9 3.05685989 64 3.06081212 64.1 3.06475916 64.2 3.06870099 64.3 3.07263759 64.4 3.07656893 64.5 3.080495 64.6 3.08441578 64.7 3.08833126 64.8 3.0922414 64.9 3.09614619 65 3.10004561 65.1 3.10393965 65.2 3.10782827 65.3 3.11171146 65.4 3.11558921 65.5 3.11946148 65.6 3.12332827 65.7 3.12718955 65.8 3.1310453 65.9 3.1348955 66 3.13874013 66.1 3.14257917 66.2 3.1464126 66.3 3.1502404 66.4 3.15406255 66.5 3.15787903 66.6 3.16168982 66.7 3.1654949 66.8 3.16929425 66.9 3.17308785 67 3.17687567 67.1 3.1806577 67.2 3.18443392 67.3 3.1882043 67.4 3.19196884 67.5 3.19572749 67.6 3.19948025 67.7 3.2032271 67.8 3.20696801 67.9 3.21070296 68 3.21443193 68.1 3.21815491 68.2 3.22187187 68.3 3.22558279 68.4 3.22928764 68.5 3.23298642 68.6 3.23667909 68.7 3.24036565 68.8 3.24404606 68.9 3.2477203 69 3.25138836 69.1 3.25505021 69.2 3.25870584 69.3 3.26235522 69.4 3.26599833 69.5 3.26963515 69.6 3.27326567 69.7 3.27688985 69.8 3.28050767 69.9 3.28411913 70 3.28772419 70.1 3.29132284 70.2 3.29491505 70.3 3.2985008 70.4 3.30208008 70.5 3.30565286
The gen_run.m, gen_lut.m and spec_file.txt put into same directory.
pitch_in_mm is 0.003 for my camera
f_in_mm is 2.29 for my camera
/* 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];
I run gen_run.m on Octave.
It generate mesh.txt.
/* mesh.txt */
/* generate mesh.txt.bin */
jason:~/PROCESSOR_SDK_VISION_03_08_00_00/vision_sdk/apps/tools/LDC_mesh_table_convert$ ./convert.sh mesh.txt 1920 1080 16
/* bin to header file on WIN 10, get mesh_lut_fov119.h */
d:\bin2c>bin2c.exe mesh.txt.bin mesh_lut_fov119.h fov119
/* mesh_lut_fov119.h */
I modified vision_apps\modules_src\app_ldc_modules.c
The LCD_LUT_1920_1080 replace with 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;
It will cause segmentation fault when run run_app_tidl_od_cam.sh.
I think, the problem is the size of FOV119DCC_CFG.
The size of FOV119DCC_CFG only is 35328.
But the size of LCD_LUT_1920_1080 is 537664.
How can I generate a 537664 size look up table?
Do I have any step error?
Best regards
-Jason