I've got a basic setup using an Asus Xtion Pro Live sensor with the sensor suspended at 3m above ground looking straight down. I'm trying to work out the visible bounds in meters.
Here's a diagram to illustrate this:
I know the FOV angles:
Field of View
58° H, 45° V, 70° D (Horizontal, Vertical, Diagonal)
I though about using a bit of trig to work it out. If I take the HFOV, half it and imagine the right angled triangle formed, I could could use the tangent (opposite / adjacent), knowing the angle to work out the opposite side:
opposite = adjacent * tan(29)
opposite = 3m * tan(29)
opposite ~= 2.66m
Just to test, I've also put together a very basic program using Processing and SimpleOpenNI to measure: mark two points, get the 3D coordinates and compute distance.
import SimpleOpenNI.*;
SimpleOpenNI ni;
PVector m1,m2,p1,p2;
PVector[] realWorldMap;
void setup(){
size(640,480);stroke(0,192,0);
ni = new SimpleOpenNI(this);
if(!ni.enableDepth()) exit();
ni.alternativeViewPointDepthToImage();
}
void draw(){
ni.update();
realWorldMap = ni.depthMapRealWorld();
image(ni.depthImage(),0,0);
if(m1 != null && m2 != null) line(m1.x,m1.y,m2.x,m2.y);
if(p1 != null && p2 != null) text("distance :"+(int )(p1.dist(p2)*.1)+" cm",5,15);
}
void mouseReleased(){
if(!keyPressed){
m1 = new PVector(mouseX,mouseY);
p1 = realWorldMap[mouseY*640 + mouseX];
}else{
m2 = new PVector(mouseX,mouseY);
p2 = realWorldMap[mouseY*640 + mouseX];
}
}
void keyPressed(){
if(key == ' ') m1 = m2 = p1 = p2 = null;
}
I've got ~2.6 as the widest measurements, but I'm slightly confused because I thought that the opposite side is only half of the frustrum's base width, so was expecting ~5.3m. Are my assumptions wrong ? If so, what am I doing wrong/what's the correct way to calculate this ?
I've also used the Kinect tag, because the same principle applies for the kinect sensor as well