WoodScape数据集中以json格式提供了每帧图像对应的相机参数,json文件在calibration文件夹下,名称与图像名一致;

相机标定参数格式:
{
"extrinsic": {
"quaternion": [
0.5946970238045494,
-0.5837953694518585,
0.39063952590941586,
-0.3910488170060691
],
"translation": [
3.7484,
0.0,
0.6577999999999999
]
},
"intrinsic": {
"aspect_ratio": 1.0,
"cx_offset": 3.942,
"cy_offset": -3.093,
"height": 966.0,
"k1": 339.749,
"k2": -31.988,
"k3": 48.275,
"k4": -7.201,
"model": "radial_poly",
"poly_order": 4,
"width": 1280.0
},
"name": "FV"
}
其中:
车体坐标系:ISO 8855标准

X 轴平行于车辆的 heading 朝前;
Y 轴垂直于 X 轴朝左;
Z 轴垂直于 X, Y 轴朝向车辆的上方;
坐标系原点位于车辆后轴中心点下方的地面上;
相机坐标系
与opencv中所规定的相机坐标系一致,遵循右手定则;
旋转和平移变换关系为从相机坐标系到车体坐标系;
json文件以四元数形式表征旋转矩阵;平移矩阵的单位为m;
四元数转旋转矩阵公式:

void getRotation(double *Quaternion, double *rt_mat)
{
//q:[x, y, z, w]
rt_mat[0] = 1 - 2 * (Quaternion[1] * Quaternion[1]) - 2 * (Quaternion[2] * Quaternion[2]);
rt_mat[1] = 2 * Quaternion[0] * Quaternion[1] - 2 * Quaternion[2] * Quaternion[3];
rt_mat[2] = 2 * Quaternion[0] * Quaternion[2] + 2 * Quaternion[1] * Quaternion[3];
rt_mat[3] = 2 * Quaternion[0] * Quaternion[1] + 2 * Quaternion[2] * Quaternion[3];
rt_mat[4] = 1 - 2 * (Quaternion[0] * Quaternion[0]) - 2 * (Quaternion[2] * Quaternion[2]);
rt_mat[5] = 2 * Quaternion[1] * Quaternion[2] - 2 * Quaternion[0] * Quaternion[3];
rt_mat[6] = 2 * Quaternion[0] * Quaternion[2] - 2 * Quaternion[1] * Quaternion[3];
rt_mat[7] = 2 * Quaternion[1] * Quaternion[2] + 2 * Quaternion[0] * Quaternion[3];
rt_mat[8] = 1 - 2 * (Quaternion[0] * Quaternion[0]) - 2 * (Quaternion[1] * Quaternion[1]);
}
相机坐标系到车体坐标系的变换矩阵为:
cv::Mat Trans = (cv::Mat_<double>(4, 4) << R[0], R[1], R[2],T[0],
R[3], R[4], R[5], T[1],
R[6], R[7], R[8], T[2],
0, 0, 0, 1);
车体坐标系到相机坐标系的变换矩阵为:
cv::Mat invT = Trans.inv();
chi = sqrt( X ** 2 + Y ** 2)
theta = arctan2( chi, Z ) = pi / 2 - arctan2( Z, chi )
rho(theta) = k1 * theta + k2 * theta ** 2 + k3 * theta ** 3 + k4 * theta ** 4
rho = rho(theta)
u’ = rho * X / chi if chi != 0 else 0
v’ = rho * Y / chi if chi != 0 else 0
u = u’ + cx + width / 2 - 0.5
v = v’ * aspect_ratio + cy + height / 2 - 0.5
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
exe应该在我打开页面时运行。异步进程需要运行。有什么方法可以在ruby中使用两个参数异步运行exe吗?我已经尝试过ruby命令-system()、exec()但它正在等待过程完成。我需要用参数启动exe,无需等待进程完成是否有任何rubygems会支持我的问题? 最佳答案 您可以使用Process.spawn和Process.wait2:pid=Process.spawn'your.exe','--option'#Later...pid,status=Process.wait2pid您的程序将作为解释器的子进程执行。除
我有一些Ruby代码,如下所示:Something.createdo|x|x.foo=barend我想编写一个测试,它使用double代替block参数x,这样我就可以调用:x_double.should_receive(:foo).with("whatever").这可能吗? 最佳答案 specify'something'dox=doublex.should_receive(:foo=).with("whatever")Something.should_receive(:create).and_yield(x)#callthere
我正在为一个项目制作一个简单的shell,我希望像在Bash中一样解析参数字符串。foobar"helloworld"fooz应该变成:["foo","bar","helloworld","fooz"]等等。到目前为止,我一直在使用CSV::parse_line,将列分隔符设置为""和.compact输出。问题是我现在必须选择是要支持单引号还是双引号。CSV不支持超过一个分隔符。Python有一个名为shlex的模块:>>>shlex.split("Test'helloworld'foo")['Test','helloworld','foo']>>>shlex.split('Test"
我不确定传递给方法的对象的类型是否正确。我可能会将一个字符串传递给一个只能处理整数的函数。某种运行时保证怎么样?我看不到比以下更好的选择:defsomeFixNumMangler(input)raise"wrongtype:integerrequired"unlessinput.class==FixNumother_stuffend有更好的选择吗? 最佳答案 使用Kernel#Integer在使用之前转换输入的方法。当无法以任何合理的方式将输入转换为整数时,它将引发ArgumentError。defmy_method(number)
两者都可以defsetup(options={})options.reverse_merge:size=>25,:velocity=>10end和defsetup(options={}){:size=>25,:velocity=>10}.merge(options)end在方法的参数中分配默认值。问题是:哪个更好?您更愿意使用哪一个?在性能、代码可读性或其他方面有什么不同吗?编辑:我无意中添加了bang(!)...并不是要询问nobang方法与bang方法之间的区别 最佳答案 我倾向于使用reverse_merge方法:option
我有一个只接受一个参数的方法:defmy_method(number)end如果使用number调用方法,我该如何引发错误??通常,我如何定义方法参数的条件?比如我想在调用的时候报错:my_method(1) 最佳答案 您可以添加guard在函数的开头,如果参数无效则引发异常。例如:defmy_method(number)failArgumentError,"Inputshouldbegreaterthanorequalto2"ifnumbereputse.messageend#=>Inputshouldbegreaterthano
有时我需要处理键/值数据。我不喜欢使用数组,因为它们在大小上没有限制(很容易不小心添加超过2个项目,而且您最终需要稍后验证大小)。此外,0和1的索引变成了魔数(MagicNumber),并且在传达含义方面做得很差(“当我说0时,我的意思是head...”)。散列也不合适,因为可能会不小心添加额外的条目。我写了下面的类来解决这个问题:classPairattr_accessor:head,:taildefinitialize(h,t)@head,@tail=h,tendend它工作得很好并且解决了问题,但我很想知道:Ruby标准库是否已经带有这样一个类? 最佳
我没有找到太多关于如何执行此操作的信息,尽管有很多关于如何使用像这样的redirect_to将参数传递给重定向的建议:action=>'something',:controller=>'something'在我的应用程序中,我在路由文件中有以下内容match'profile'=>'User#show'我的表演Action是这样的defshow@user=User.find(params[:user])@title=@user.first_nameend重定向发生在同一个用户Controller中,就像这样defregister@title="Registration"@user=Use
对于作为String#tr参数的单引号字符串文字中反斜杠的转义状态,我觉得有些神秘。你能解释一下下面三个例子之间的对比吗?我特别不明白第二个。为了避免复杂化,我在这里使用了'd',在双引号中转义时不会改变含义("\d"="d")。'\\'.tr('\\','x')#=>"x"'\\'.tr('\\d','x')#=>"\\"'\\'.tr('\\\d','x')#=>"x" 最佳答案 在tr中转义tr的第一个参数非常类似于正则表达式中的括号字符分组。您可以在表达式的开头使用^来否定匹配(替换任何不匹配的内容)并使用例如a-f来匹配一