Distances of two different points in x y z coordinates
Hello guys I need to get X Y Z distances between 2 different points. Here is an example of what I want to do: I want to find the distances between the X Y and Z coordinates of two different corners of a room ceiling. I want to do this wirelessly. IR or different sensors or camera with using calibration pattern (I don't know). Distance between points and raspberry (or me) ia maximum 10 meter. How can I get the X Y and Z distances between this 2 points?
Re: Distances of two different points in x y z coordinates
orgey wrote: ↑Wed Nov 06, 2019 12:47 pmHello guys I need to get X Y Z distances between 2 different points. Here is an example of what I want to do: I want to find the distances between the X Y and Z coordinates of two different corners of a room ceiling. I want to do this wirelessly. IR or different sensors or camera with using calibration pattern (I don't know). Distance between points and raspberry (or me) ia maximum 10 meter. How can I get the X Y and Z distances between this 2 points?
The maths needed to calculate the distance between 2 points in a 3d space with the proportions of a room is surely a simple application of Pythagoras or similar?
The bigger challenge seems to be getting the 2 sets of coordinates as a basis for the calculation.
Re: Distances of two different points in x y z coordinates
That's what I asked about . I mean calculations ares simple and I don't need the real positions of the points. For example one of the points can be considered as a origin (0,0,0) or anything , it is not important. The important think is x2x1,y2y1 and z2z1. I just need these informations. Btw, thank you for the reply .
Re: Distances of two different points in x y z coordinates
Does it have to be fully automated ?orgey wrote: ↑Wed Nov 06, 2019 12:47 pmHello guys I need to get X Y Z distances between 2 different points. Here is an example of what I want to do: I want to find the distances between the X Y and Z coordinates of two different corners of a room ceiling. I want to do this wirelessly. IR or different sensors or camera with using calibration pattern (I don't know). Distance between points and raspberry (or me) ia maximum 10 meter. How can I get the X Y and Z distances between this 2 points?
Re: Distances of two different points in x y z coordinates
What do you mean? Sorry I don't get it.gordon77 wrote: ↑Wed Nov 06, 2019 2:51 pmDoes it have to be fully automated ?orgey wrote: ↑Wed Nov 06, 2019 12:47 pmHello guys I need to get X Y Z distances between 2 different points. Here is an example of what I want to do: I want to find the distances between the X Y and Z coordinates of two different corners of a room ceiling. I want to do this wirelessly. IR or different sensors or camera with using calibration pattern (I don't know). Distance between points and raspberry (or me) ia maximum 10 meter. How can I get the X Y and Z distances between this 2 points?
Re: Distances of two different points in x y z coordinates
Does it need to do all the measurements by itself, or can you do some/ or all of it ?
If the latter I was thinking you could use a laser measure. eg https://www.screwfix.com/p/magnussonim ... urer/1406x
Point it at the first corner. You now know the distance to it from you, and you can measure the angles, both in declination and azimuth. Now repeat for the second and you should now have enough data to do the maths.
If the latter I was thinking you could use a laser measure. eg https://www.screwfix.com/p/magnussonim ... urer/1406x
Point it at the first corner. You now know the distance to it from you, and you can measure the angles, both in declination and azimuth. Now repeat for the second and you should now have enough data to do the maths.
Re: Distances of two different points in x y z coordinates
Not a trivial problem.
A level or higher mathematics would be useful to understand how these techniques work although you may get through treating libraries as black boxes that give you numbers. You would be relying a lot on examples though.
You should start by defining what accuracy you need.
Some techniques:
The camera centre and the two vectors to the targets you have a triangle.
Measuring the diameter of the ball targets gives you a measure of distance on each of two sides of the triangle so you can calculate the other side which is the distance between the centre of the balls.
Shaper Origin uses some variant of 5. to find precise location of a router tool relative to known patterns on tapes stuck onto the workpiece. Watch it in action.
https://www.shapertools.com/enus/store
OpenCV has library functions to camera calibration and photogrammetry
https://becominghuman.ai/stereo3dreco ... 13907d1ab5
https://docs.opencv.org/2.4/modules/cal ... ction.html
A level or higher mathematics would be useful to understand how these techniques work although you may get through treating libraries as black boxes that give you numbers. You would be relying a lot on examples though.
You should start by defining what accuracy you need.
Some techniques:
 Locate the walls/ ceiling/floor with LIDAR?
 Laser range finder (triangulation)
 Ultrasonic distance sensor?
 Photogrammetry (3D structure from 2D photos)
 Camera calibration techniques where you compute the camera position relative to a known pattern such as a checkerboard or barcodes
The camera centre and the two vectors to the targets you have a triangle.
Measuring the diameter of the ball targets gives you a measure of distance on each of two sides of the triangle so you can calculate the other side which is the distance between the centre of the balls.
Shaper Origin uses some variant of 5. to find precise location of a router tool relative to known patterns on tapes stuck onto the workpiece. Watch it in action.
https://www.shapertools.com/enus/store
OpenCV has library functions to camera calibration and photogrammetry
https://becominghuman.ai/stereo3dreco ... 13907d1ab5
https://docs.opencv.org/2.4/modules/cal ... ction.html
Re: Distances of two different points in x y z coordinates
It shouldn't be too hard  Assuming it's the distance between the two corners which is wanted.
Park a laser distance sensor on a tripod, adjust its tilt until the laser beam can be swung to hit the two corners. Measure the two distances and use the angle swung to calculate the distance between the two corners.
If it's more than that the OP might have to explain exactly what they want and what "X Y Z distances between 2 different points" means because it seems impossible to calculate having only three points of reference.
Re: Distances of two different points in x y z coordinates
I mentioned two types of laser distance sensor.
True it would be a lot simpler to target the corners by eye and read the angles from transducers.
I don't know how well a laser triangulation sensor will read in a corner. Maybe put an irregular tetrahedron (diagonally sectioned cube) in the corner to provide a flat surface to read off.
Alternatively do the ranging to the walls to get x,y,z distances and calculate from those. Any three points on a wall define the plane of the wall. The corner is the intersection of three planes.
Re: Distances of two different points in x y z coordinates
Actually, its probably a reasonable assumption that the walls are vertical so a horizontal sweep of a distance sensor of any type could give you the walls and a range straight up could give the ceiling which gets you the corners.
It all depends what accuracy is needed because walls aren't perfectly vertical or flat and ceilings and floors aren't perfectly level and flat either.
It all depends what accuracy is needed because walls aren't perfectly vertical or flat and ceilings and floors aren't perfectly level and flat either.
Re: Distances of two different points in x y z coordinates
If you have an iphone, check out the Measure App. It works by using the camera. Essentially, you move/scan the iphone in front of what you want to measure, and based on how the image changes on the screen, the algorithm is capable to 'calculate' some dimensions. Pretty slick, but a lot of image processing and calculations. Yes, you can try something like that ... let us know once you figure that out
The method the iPhone uses is based on photogrammetry ... too difficult to do by yourself. Your best bet is to find some online/free library.
The method the iPhone uses is based on photogrammetry ... too difficult to do by yourself. Your best bet is to find some online/free library.
Re: Distances of two different points in x y z coordinates
I tried the measurements of my room using the distance to the points and the 2 angles as I described above and it appeared to work !!.
Here's the code and a picture which I hope explains it. It doesn't use walls or floor as reference.
The bad news is the laser wouldn't measure the distance, presumably due to the angle. so I had to use a tape.
I measured the angles by mounting the laser on a camera tripod which shows the angles.
Here's the code and a picture which I hope explains it. It doesn't use walls or floor as reference.
The bad news is the laser wouldn't measure the distance, presumably due to the angle. so I had to use a tape.
I measured the angles by mounting the laser on a camera tripod which shows the angles.
Code: Select all
#!/usr/bin/env python3
import math
#============================================================
# ENTER DATA HERE...
a = 2.70 # distance to first point
e = 25.00 # elevation angle (in degs) to first point
h = 5.00 # longtitude angle (in degs) to first point
b = 2.65 # distance to second point
f = 28.00 # elevation angle (in degs) to second point
j = 45.00 # longtitude angle (in degs) to second point
#============================================================
e = e * 0.01745329252 # convert to radians
h = h * 0.01745329252 # convert to radians
y1 = math.sin(e) * a
c = y1/math.tan(e)
x1 = c * math.sin(h)
z1 = x1/math.tan(h)
f = f * 0.01745329252 # convert to radians
j = j * 0.01745329252 # convert to radians
y2 = math.sin(f) * b
d = y2/math.tan(f)
x2 = d * math.sin(j)
z2 = x2/math.tan(j)
print ("X1 = ",x1," Y1 = ",y1," Z1 = ",z1)
print ("X2 = ",x2," Y2 = ",y2," Z2 = ",z2)
print ("X1X2 = ",x1x2," Y1Y2 = ",y1y2," Z1Z2 = ",z1z2)
t = math.sqrt((x1x2)*(x1x2) + (z1z2)*(z1z2))
u = math.sqrt((t*t) + (y1y2)*(y1y2))
print ("DISTANCE BETWEEN POINTS = ", u)
 Attachments

 ROOM.jpg (111.3 KiB) Viewed 2218 times
Re: Distances of two different points in x y z coordinates
Guys, thank you all for your replies. I am an electrial engineer, I am really good at math . What I want is get the x y and z coordinates of 2 different points. Or I can assume that one point as a referance and get the x y z coordinates of the other point (x2x1,y2y1 and z2z1 x1=y1=z1=0). I can put measurement devices to the points, but I can't take them back, so the devices or items must be cheap (calibrated pattern or cheap sensors). The main device that I will take the measurement may be the phone or the raspberry pi or a different device. I have no restrictions on that device. I hope I was able to explain my wishes correctly. Thank you all
Re: Distances of two different points in x y z coordinates
You still haven't indicated what sort of accuracy you need for this measurement. That's critical.
The other key parameter is what distances you need to measure.
You can measure anything with triangulation, so long as you have at least one known distance.
The other key parameter is what distances you need to measure.
You can measure anything with triangulation, so long as you have at least one known distance.
Re: Distances of two different points in x y z coordinates
With no restrictions, use LIDAR or something similar and scan the entire room. That will allow the creation of a virtual model of the room from which anything can be determined with reference to anything else.
Maybe investigate what archaeologists use for 3D scanning.
Re: Distances of two different points in x y z coordinates
I don't think ". I have no restrictions on that device." means "money no object".
Still, this is cool if can afford it. Measure whatever you want.
https://www.youtube.com/watch?v=KUdbrFOJlO0
Or
https://www.youtube.com/watch?v=aq4NLmiJHwk
Still, this is cool if can afford it. Measure whatever you want.
https://www.youtube.com/watch?v=KUdbrFOJlO0
Or
https://www.youtube.com/watch?v=aq4NLmiJHwk
Re: Distances of two different points in x y z coordinates
If it has to be cheap you could try 2 cameras, probably usb so 2 will work on a pi, and determine the distances to the points, from the difference between the images after you have calibrated. You could then use my earlier method with measured angles.
Re: Distances of two different points in x y z coordinates
Good point. If two cameras are rigidly mounted and calibrated you can get accurate real world angles of points in the images. You can measure sizes of known targets and calculate distance from size. Place a ball in the corners you ant to measure and find the centre and diameter to get vector and range.
If you can move the cameras by accurate angles you can calibrate between the views.
You may be able to use Hough transforms to find the straight line joins between walls, ceiling and floor and from those lines you could calculate the intersection points that give the corners of a room.
OpenCV has the functions for all that.
Re: Distances of two different points in x y z coordinates
I was thinking more of a rangefinder type setup to measure the distance. See image below which has the cameras set to coincide at 1m and you could measure the distance by the displacement beyond that. The tripod handle is at 1m and the cupboards behind at 2m.
Measuring the angles from the pictures could work as well.
Measuring the angles from the pictures could work as well.
 Attachments

 range.jpg (27.58 KiB) Viewed 2000 times
Re: Distances of two different points in x y z coordinates
Certainly that sort of 3D from stereo can be done.
As with any triangulation method the accuracy reduces as the separation reduces and the angle becomes very acute.
I think there's a tradeoff because wider separation improves the angle but also changes the view which can make feature matching harder.
As with any triangulation method the accuracy reduces as the separation reduces and the angle becomes very acute.
I think there's a tradeoff because wider separation improves the angle but also changes the view which can make feature matching harder.
Re: Distances of two different points in x y z coordinates
I need to calculate distance between 2 spesific objects (Actually 2 different cables end point distance in 3d coordinate systems). Can I do this with Hottscan or can I just measure the room dimensions?PiGraham wrote: ↑Fri Nov 08, 2019 1:53 pmI don't think ". I have no restrictions on that device." means "money no object".
Still, this is cool if can afford it. Measure whatever you want.
https://www.youtube.com/watch?v=KUdbrFOJlO0
Or
https://www.youtube.com/watch?v=aq4NLmiJHwk
Re: Distances of two different points in x y z coordinates
Can you give us some indication of dimensions of the room, and distance to and between points ?
Re: Distances of two different points in x y z coordinates
I thought you had agreed with me when I wrote "The maths needed to calculate the distance between 2 points in a 3d space with the proportions of a room is surely a simple application of Pythagoras or similar?"
Re: Distances of two different points in x y z coordinates
I have no direct knowledge of hotscan or similar products, but given it captures a detailed 3D map of rooms and allows arbitrary measurements between 3D points from that scan you should be able to measure to the ends of cables.orgey wrote: ↑Tue Nov 12, 2019 5:51 amI need to calculate distance between 2 spesific objects (Actually 2 different cables end point distance in 3d coordinate systems). Can I do this with Hottscan or can I just measure the room dimensions?PiGraham wrote: ↑Fri Nov 08, 2019 1:53 pmI don't think ". I have no restrictions on that device." means "money no object".
Still, this is cool if can afford it. Measure whatever you want.
https://www.youtube.com/watch?v=KUdbrFOJlO0
Or
https://www.youtube.com/watch?v=aq4NLmiJHwk
In principle it would be possible to measure along any 3D path, for example following the path of an intended cable installation to find out how much cable ( other materials) you would need to route around the walls, around obstacles etc. I have no idea if the software provided has such a feature.