android ndk - Project Tango Point Cloud strange crash, and dense depth map -


i trying use project tango c api, application crashed no error if number of point cloud more ~6.5k (after testing) following code

    int width = mimagesource->getdepthimagesize().x;     int height = mimagesource->getdepthimagesize().y;     double fx = mimagesource->calib.intrinsics_d.projectionparamssimple.fx;     double fy = mimagesource->calib.intrinsics_d.projectionparamssimple.fy;     double cx = mimagesource->calib.intrinsics_d.projectionparamssimple.px;     double cy = mimagesource->calib.intrinsics_d.projectionparamssimple.py;      memset(inputrawdepthimage->getdata(memorydevice_cpu), -1, sizeof(short)*width*height);     (int = 0; < xyz_ij->xyz_count; i++) {         float x = xyz_ij->xyz[i*3][0];         float y = xyz_ij->xyz[i*3][1];         float z = xyz_ij->xyz[i*3][2];         if (z < epsilon || (x < epsilon && -x < epsilon) || (y < epsilon && -y < epsilon) || x != x || y != y || z != z)             continue;         int x_2d = (int)(fx*x/z+cx);         int y_2d = (int)(fy*y/z+cy);         if (x_2d >=0 && x_2d < width && y_2d >= 0 && y_2d < height && (x_2d != 0 || x_2d != 0)) {             inputrawdepthimage->getdata(memorydevice_cpu)[x_2d + y_2d*width] = (short) (z*1000);         } else {             continue;         }     } 

however, if use for (int = 0; < xyz_ij->xyz_count && < 6500; i++) works fine. wondering if there upper bound access point cloud c api or did wrong?

(width 320, height 180, , other intrinsics loaded tango api)

in addition, google mentioned use nearest- neighbor filter dense depth map in bottom of page, there interface in tango api this? or suggest open source implementation it.

i wondering if there anyway "pull" colored image(1280x720) in onxyzijavailable because need dense synchronized colored point cloud. need apply external matrix align both coordinate frame, or need subsample color image (assume coordinate system same)?

thank advice!

in code looks depth sample coordinates...

for (int = 0; < xyz_ij->xyz_count; i++) {     float x = xyz_ij->xyz[i*3][0];     float y = xyz_ij->xyz[i*3][1];     float z = xyz_ij->xyz[i*3][2]; 

...you should using index of i, not i*3. 2d array don't have manage stride higher dimension yourself.

the sdk not provide call fill in locations no depth samples, because there many approaches different tradeoffs. wikipedia page on nearest neighbor search reasonable place start. there interface flann in opencv.

the sdk deliver latest color image you. if want prior image (e.g. timestamp close depth samples) have manage yourself. because can never color image @ same timestamp depth samples (as same camera used in different modes both), theoretically should apply extrinsic pose align them. in practice if motion small on 0.5 frame time or less between timestamps, think people going ignore it.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -