Hello,

I tried the Spatial Mobilenet file in the examples folder and get the outputs as x, y, and z, but when i try to display the location of (x,y) on the frame (as a big red dot), which i assume should be the top left of the bounding, but nothing was shown so I want to know what and where are x and y (i think my method works as you can see in the img, 2 green dots were displayed as the center of the bounding boxes) and what is the distance i am looking at since z is coordinated with (x,y). One more question is how can i find the z of a specific pair of x and y, in other words, how can i find the distance (z) of a known pixel? And my last question is I was trying to use syntax inPreview.setSize(frame, 480,640) and cv2.resize(frame,(480,640)) to resize the frame instead of 300x300 but did not succeed, do you have any ways to resize the frame?

  • erik replied to this.

    Hi KwinT ,
    The x and y (from spatialCoordinates.x / y) are in milimeters, so they could be outside the image frame.

    If you want to get Z (and perhaps X/Y) in meters of some pixel on depth map, you can just access it with z_in_meters = my_depth_map[y,x], as depth map is a numpy array. Similar approach is used here: https://github.com/luxonis/depthai-experiments/tree/master/gen2-calc-spatials-on-host

    If you want to enlarge the image which wouldn't be the same aspect ratio than AI model (300x300, so 1:1 AR), you can see how to do so here: https://docs.luxonis.com/projects/api/en/latest/tutorials/maximize_fov/#maximizing-fov