资源简介
选择三维点云的点,返回坐标:
H = CLICKA3DPOINT(POINTCLOUD) shows a 3D point cloud and lets the user
% select points by clicking on them. The selected point is highlighted
% and its index in the point cloud will is printed on the screen.
% POINTCLOUD should be a 3*N matrix, represending N 3D points.
% Handle to the figure is returned.
%
% other functions required:
% CALLBACKCLICK3DPOINT mouse click callback function
% ROWNORM returns norms of each row of a matrix
%
% To test this function ...
% pointCloud = rand(3,100)*100;
% h = clickA3DPoint(pointCloud);
%
% now rotate or move the point cloud and try it again.
% (on the figure View menu, turn the Camera Toolbar on, ...)
%
% To turn off the callback ...
% set(h, 'WindowButtonDownFcn','');
代码片段和文件信息
function callbackClickA3DPoint(src eventData pointCloud)
% CALLBACKCLICK3DPOINT mouse click callback function for CLICKA3DPOINT
%
% The transformation between the viewing frame and the point cloud frame
% is calculated using the camera viewing direction and the ‘up‘ vector.
% Then the point cloud is transformed into the viewing frame. Finally
% the z coordinate in this frame is ignored and the x and y coordinates
% of all the points are compared with the mouse click location and the
% closest point is selected.
%
% Babak Taati - May 4 2005
% revised Oct 31 2007
% revised Jun 3 2008
% revised May 19 2009
point = get(gca ‘CurrentPoint‘); % mouse click position
camPos = get(gca ‘CameraPosition‘); % camera position
camTgt = get(gca ‘CameraTarget‘); % where the camera is pointing to
camDir = camPos - camTgt; % camera direction
camUpVect = get(gca ‘CameraUpVector‘); % camera ‘up‘ vector
% build an orthonormal frame based on the viewing direction and the
% up vector (the “view frame“)
zAxis = camDir/norm(camDir);
upAxis = camUpVect/norm(camUpVect);
xAxis = cross(upAxis zAxis);
yAxis = cross(zAxis xAxis);
rot = [xAxis; yAxis; zAxis]; % view rotation
% the point cloud represented in the view frame
rotatedPointCloud = rot * pointCloud;
% the clicked point represented in the view frame
rotatedPointFront = rot * point‘ ;
% find the nearest neighbour to the clicked point
pointCloudIndex = dsearchn(rotatedPointCloud(1:2:)‘ ...
rotatedPointFront(1:2));
h = findobj(gca‘Tag‘‘pt‘); % try to find the old point
selectedPoint = pointCloud(: pointCloudIndex);
if isempty(h) % if it‘s the first click (i.e. no previous point to delete)
% highlight the selected point
h = plot3(selectedPoint(1:) selectedPoint(2:) ...
selectedPoint(3:) ‘r.‘ ‘MarkerSize‘ 20);
set(h‘Tag‘‘pt‘); % set its Tag property for later use
else % if it is not the first click
delete(h); % delete the previously selected point
% highlight the newly selected point
h = plot3(selectedPoint(1:) selectedPoint(2:) ...
selectedPoint(3:) ‘r.‘ ‘MarkerSize‘ 20);
set(h‘Tag‘‘pt‘); % set its Tag property for later use
end
fprintf(‘you clicked on point number %d\n‘ pointCloudIndex);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2361 2009-11-10 14:54 callbackClickA3DPoint.m
文件 1600 2009-11-10 14:52 clickA3DPoint.m
文件 1332 2009-11-10 15:00 license.txt
文件 338 2009-11-10 14:51 rowNorm.m
- 上一篇:MVDR算法进行谱估计
- 下一篇:WCDMA matlab仿真实现
相关资源
- WCDMA matlab仿真实现
- MVDR算法进行谱估计
- 计算图像对比度
- GP matlab 代码
- MATLAB绘制蜂窝网络程序
- 基于小波阈值去噪
- mk检验matlab程序
- matlab模板实现对图像的平均滤波处理
- PSO工具箱使用简介\\test_func.mmatlab程序
- matlab源程序代码遗传算法工具箱\\ge
-
遗传算法工具箱\\genetic\\crtba
se.mma - MATLAB基于肤色模型和模板匹配的人脸
- 船舶回转试验与Z形操舵试验matlab仿真
- 利用MATLAB中Sim+Power+Systems模库时变压器
- KNN分类MatLAB源代码附论文
- RLS自适应滤波器的matlab设计与仿真
- 基于地图工具箱的船舶定位研究matl
- 卫星对地定向动力学模型控制器建模
- 汽车主动悬架控制器建模仿真程序代
- 船舶运动控制器设计仿真程序代码
- 振动仿真matlab程序
- Turbo码matlab程序
- 采用Matlab完成感应电机的矢量控制仿
- 图像融合算法实现 MATLAB版
- matlab中国地图文件
- 单服务器排队模型matlab程序
- 基于树型弱分类器的adaboost演示程序(
- 分类器设计之线性分类器和线性SVM(
- matlab toolbox:Uvi_Wave toolbox
- logistic映射源代码
评论
共有 条评论