File Exchange

image thumbnail


version (3.15 KB) by Babak Taati
Select a point from a 3D point cloud by clicking on it.


Updated 10 Nov 2009

View License

Lets the user select a point from a 3D point cloud by clicking on it. The selected point is highlighted and its index is printed.

This is a useful tool if you work with 3D point clouds. You can change the mouse click callback function so instead of highlighting the selected point other operations are done.

The math is pretty simple:

First, 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.

Comments and Ratings (23)

Thank you very much.

waqas ali

st zhang


Ivo (view profile)

Amin Memari

So useful for me. thanks compatriot

Bin Hu

Bin Hu (view profile)

Very useful. Thanks!

Excellent work, very useful.... thanks


Masoud (view profile)

Nice work!


Anton Semechko


Shane (view profile)


Shane (view profile)


Exactly what was needed. Great work.

This is very useful. I need to output the coordinates of the point to use elsewhere, do you know how I can do that? I tried guidata but it didn't work.


simple and useful


David (view profile)

great job


Jveer (view profile)

thank you. that worked great. re-rating.

Babak Taati

to Jveer:

>> set(gcf,'WindowButtonDownFcn','');

better: change ClickA3DPoint.m so it returns a handle to the figure and use that instea of gcf.


Jveer (view profile)

useful but once activated, how can you disactivate it?

Ditza Fargeon

This is really nice function

Adam Nolan

handy template for working with 3D Plot selection


minor change (typo fix)

minor changes (style, wording, etc)

update: use 'dsearchn' for nearest neighbour search.

update: the callback function now takes an input argument. So PointCloud no longer needs to be global.

adding the file RowNorm.m to the zip file (required)

I added file RowNorm.m to the zip file. It's a one line m file!

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor