- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
校准:
我已经在 Matlab 中使用这个视觉工具箱校准了相机。我使用棋盘图像来这样做。校准后我得到了 cameraParams其中包含:
Camera Extrinsics
RotationMatrices: [3x3x18 double]
TranslationVectors: [18x3 double]
和
Camera Intrinsics
IntrinsicMatrix: [3x3 double]
FocalLength: [1.0446e+03 1.0428e+03]
PrincipalPoint: [604.1474 359.7477]
Skew: 3.5436
目标:我用这台相机记录了一些运动物体的轨迹。每个对象对应于帧中的单个点。现在,我想投影这些点,以便获得俯 View 。
请注意,我希望变换的所有这些点都在同一平面上。
例如:[xcor_i,ycor_i]
-101.7000 -77.4040
-102.4200 -77.4040
代码(引用:https://stackoverflow.com/a/27260492/3646408 和下面@Dima 的回答):
function generate_homographic_matrix()
%% Calibrate camera
% Define images to process
path=['.' filesep 'Images' filesep];
list_imgs=dir([path '*.jpg']);
list_imgs_path=strcat(path,{list_imgs.name});
% Detect checkerboards in images
[imagePoints, boardSize, imagesUsed] = detectCheckerboardPoints(list_imgs_path);
imageFileNames = list_imgs_path(imagesUsed);
% Generate world coordinates of the corners of the squares
squareSize = 27; % in units of 'mm'
worldPoints = generateCheckerboardPoints(boardSize, squareSize);
% Calibrate the camera
[cameraParams, imagesUsed, estimationErrors] = estimateCameraParameters(imagePoints, worldPoints, ...
'EstimateSkew', true, 'EstimateTangentialDistortion', true, ...
'NumRadialDistortionCoefficients', 3, 'WorldUnits', 'mm');
%% Compute homography for peripendicular plane to checkerboard
% Detect the checkerboard
im=imread(['.' filesep 'Images' filesep 'exp_19.jpg']); %exp_19.jpg is the checkerboard orthogonal to the floor
[imagePoints, boardSize] = detectCheckerboardPoints(im);
% Compute rotation and translation of the camera.
[Rc, Tc] = extrinsics(imagePoints, worldPoints, cameraParams);
% Rc(rotation of the calibration view w.r.t the camera) = [x y z])
%then the floor has rotation Rf = [z x -y].(Normal vector of the floor goes up.)
Rf=[Rc(:,3),Rc(:,1),Rc(:,2)*-1];
% Translate it to the floor
H=452;%distance btw origin and floor
Fc = Rc * [0; H; 0];
Tc = Tc + Fc';
% Combine rotation and translation into one matrix:
Rf(3, :) = Tc;
% Compute the homography between the checkerboard and the image plane:
H = Rf * cameraParams.IntrinsicMatrix;
save('homographic_matrix.mat','H')
end
%% Transform points
function [x_transf,y_transf] =transform_points(xcor_i,ycor_i)
% creates a projective2D object and then transforms the points forward to
% get a top-view
% xcor_i and ycor_i are 1d vectors comprising of the x-coordinates and
% y-coordinates of trajectories.
data=load('homographic_matrix.mat');
homo_matrix=data.H;
tform=projective2d(inv(homo_matrix));
[x_transf,y_transf] = transformPointsForward(tform,xcor_i,ycor_i);
end
引用 OReilly Learning OpenCV Pg 412 中的文字:“一旦我们有了单应矩阵和我们希望的高度参数集,我们就可以然后拆下棋盘,开着小车转一圈,做一个鸟瞰视频道的……”这是我本质上希望实现的目标。
最佳答案
阿布舍克
我不完全明白你想做什么。您的点在一个平面上吗?您是否正在尝试创建该平面的鸟瞰图?
如果是这样,那么您需要知道外部参数 R 和 t,它们描述了该平面与相机之间的关系。获得 R 和 t 的一种方法是在平面上放置一个棋盘,然后使用 extrinsics
函数。
之后,您可以按照 question you cited 中的说明进行操作得到单应性。一旦你有了单应性,你就可以创建一个 projective2D
对象,并使用它的 transformPointsForward
方法来转换你的点。
关于matlab - 校准图像以获得位于同一平面上的点的俯 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34461821/
使用 Kinect for Windows SDK,校准相机的最简单方法是什么? 我找到了这篇可爱的博文 http://nicolas.burrus.name/index.php/Research/K
我最初在 OpenCV 论坛上发布了这个,但不幸的是,我没有得到太多的意见/回复,所以我在这里发布是希望有人可能有方向建议? 我正在使用 Bumblebee XB3 立体相机,它有 3 个镜头。我花了
当移动很远的距离时,比如去另一个城市,关闭 GPS,打开它需要很长时间才能找到第一个正确的点。 因此,如果我通过示例注册到 gps 提供程序,则可能需要 10 分钟才能收到第一个 onLocation
在我的应用中,我使用加速度计来控制游戏中的角色。现在我只允许纵向,所以用户必须向右或向左倾斜设备才能移动角色。到目前为止一切正常。我现在想要完成的是“校准”加速度计以考虑用户正在玩的当前倾斜度。假设用
我使用 2 个 CANON EOS60d 作为立体设置来进行摄影测量。我正在使用 OpenCV 使用高精度 Circlegrid 校准模式校准两个相机。我正在使用信号发生器同时触发两个相机,早些时候我
我花了很长时间才让函数在 OpenCV 中运行,所以我想知道我的总体计划是否有意义,然后再深入研究尝试实现它的细节。 (2.3.1、Windows 7、C++)如果有任何建议,我将不胜感激。 问题:
我注意到 h2o.ai 套件的一个相对较新的添加,能够执行补充 Platt Scaling 以改进输出概率的校准。 (请参阅 calibrate_model in h2o manual 。)不过,在线
我正在尝试在 STM32F042 微 Controller 上读取 VDDA。我在 VDD 为 3.29V 时得到了意想不到的结果。我一定缺少一些基本的东西。 输出: VREFINT=1917; VR
请原谅我对编码完全陌生。首先,出于该项目的目的,我正在使用 Python 绑定(bind)到 OpenCV 的库。 我的相机已针对显示鱼眼失真进行了校准。我分别获得了 K 和 D 的以下值,即固有相机
如何使用 Netbeans 8.1 进行 JDK 校准。我用谷歌搜索了一些并找到了这个链接 here . It says "choose Profile > Advanced Commands > R
我目前正在开发增强现实应用程序。目标设备是光学透视 HMD,我需要校准其显示器以实现虚拟对象的正确注册。我用过那个implementation of SPAAM对于 android 来说,结果对于我的
我是一名优秀的程序员,十分优秀!