59C实现视差图输出

matlab标定时,需要修改两个文件
1.rect_index.m
px_0 = floor(px2);
py_0 = floor(py2);

if file_id==1
str_dat = sprintf(‘stereo_left.dat’);
else
str_dat = sprintf(‘stereo_right.dat’);
end

fid = fopen(str_dat, ‘w’);

good_points = find((px_0 >= 0) & (px_0 <= (nc-2)) & (py_0 >= 0) & (py_0 <= (nr-2)));

px2 = px2(good_points);
py2 = py2(good_points);

px_0 = px_0(good_points);
py_0 = py_0(good_points);

% fprintf(1,‘px2=%f,py2=%f\n’,px2,py2);
% pdata=reshape([px2;py2],1,[]);
% pdata=[px_0 py_0];
pdata=reshape([px_0;py_0],1,[]);
fwrite(fid,pdata,‘float’);
fclose(fid);

2.rectify_stereo_pair.m
left_file_id=1;
right_file_id=2;

% Pre-compute the necessary indices and blending coefficients to enable quick rectification:
[Irec_junk_left,ind_new_left,ind_1_left,ind_2_left,ind_3_left,ind_4_left,a1_left,a2_left,a3_left,a4_left] = rect_index(zeros(ny,nx),R_L,fc_left,cc_left,kc_left,alpha_c_left,KK_left_new,left_file_id);
[Irec_junk_left,ind_new_right,ind_1_right,ind_2_right,ind_3_right,ind_4_right,a1_right,a2_right,a3_right,a4_right] = rect_index(zeros(ny,nx),R_R,fc_right,cc_right,kc_right,alpha_c_right,KK_right_new,right_file_id);

修改完成之后,执行rectify_stereo_pair,此时rect_index,78,79行打印的是海思需要的fx,fy数据,保存成.dat格式,使用海思DPU TOOL工具,转成海思需要的.dat格式类型,此时生成的就是海思所需查找表的标定文件。

你可能感兴趣的:(海思平台开发,59C,深度图,视差图,matlab)