Skip to content

Conversation

Tabjones
Copy link
Contributor

I started the PR mentioned in #392 so you can see the changes, i'll test the function tomorrow and let you know. You can wait to merge until some tests are performed.
Cheers

@xlz
Copy link
Member

xlz commented Sep 21, 2015

I don't think you need to use C++11 features for this.

@Tabjones
Copy link
Contributor Author

what you mean ? the use of STL array is overkill ?!

@xlz
Copy link
Member

xlz commented Sep 21, 2015

the use of STL array is overkill

Yes

@Tabjones
Copy link
Contributor Author

Ok, you are probably right, i'll remove std::array.
Those pointers will leak yes and also the idx is wrong as you said, will probably cause segfault.
Didn't have time to test/fix those, but i noticed them.

Also i was thinking that probably it is more efficient to create a function that computes coordinates of a single point, given the indexs. something like this:
void computeCoordinate (Frame* undistorted, Frame* registered, int row, int col, float& x, float& y, float& z, float& rgb) So that the user can fill the point cloud with a single loop. Returning an array would force the user to reloop them all in his program to fill PointXYZRGB data.
Also more user-safe in terms of memory leaks, cause the user would not have to use float*.

If you agree i'll modify it accordingly

@xlz
Copy link
Member

xlz commented Sep 21, 2015

Starting with a basic one should be good.

void getPointXYZRGB(Frame* undistorted, Frame* registered, int row, int col, float& x, float& y, float& z, unsigned int& rgb)

@Tabjones
Copy link
Contributor Author

Tried it and it looks acceptable.
screenshot from 2015-09-22 10 44 15

Had to convert rgb into float, so that it can be directly assigned to pcl::PointXYZRGB::rgb.
There's lot of noise around borders and color-depth registration doesnt look precise, but i'm satisfied for now.

@floe
Copy link
Contributor

floe commented Sep 22, 2015

Noise around borders is a known artifact of TOF cameras AFAIK. The registration might also get a bit better once #379 has been merged.

floe added a commit that referenced this pull request Sep 22, 2015
First prototype of computeCoordinates of point cloud
@floe floe merged commit 4cf31d6 into OpenKinect:master Sep 22, 2015
@moonsh
Copy link

moonsh commented Sep 23, 2015

Firstly thanks for your hard work.
I would like to access X,Y,Z values so I made code like this

for (int xi = 0; xi < 512; xi++)
{
    for (int yi = 0; yi < 424; yi++)
    {
registration->getPointXYZRGB(&undistorted, &registered, xi, yi, X, Y, Z, RGB);
SaveFile2 << "v   " << X << "   " << Y << "   " << Z << std::endl;
    }
}

After that I saved in Obj file and I opened it in cloudcompare. However the result is not good.
Is this right approach to access XYZ values ?

@Tabjones
Copy link
Contributor Author

i think you inverted rows and columns: i mean what you called xi should iterate through rows, i.e. the height (424). Something like this:

  for (int r=0; r<424; ++r)
    for (int c=0; c<512; ++c)
      registration->getPointXYZRGB(undistorted, registered, r,c, x,y,z,rgb);

@moonsh
Copy link

moonsh commented Sep 23, 2015

Thanks . Here I have one more question. Image described by points is not dense and even rough. Is it maximum resolution kinect v2 can do ? or is there anyway to Increase resolution ?

@Tabjones
Copy link
Contributor Author

Yes it is not dense, cause it could contain NaN values.
About resolution, I believe that is the sensor provided resolution for depth (512x424), because that is the actual resolution of the IR camera.
In principle you could increase resolution by performing upsampling and/or other smoothing filters of the depth image, but of course you'll have to reapply a modified registration of color-depth again.

If that is what you need there's another package (that uses libfreenect2) that does exactly this upsampling, giving you point clouds at quarter-hd or full hd (1920x1200). https://github.com/code-iai/iai_kinect2, definitely worth a try.
Cheers

@moonsh
Copy link

moonsh commented Sep 24, 2015

Ah I see ! Sorry for annoying you again . How about RGB values ? For visualization, R,G and B values are needed separately but here I can get only rgb value .

@Tabjones
Copy link
Contributor Author

umh, not sure but you could try unpacking as described here http://docs.pointclouds.org/1.7.0/structpcl_1_1_point_x_y_z_r_g_b.html

@moonsh
Copy link

moonsh commented Oct 23, 2015

1

Here is result I got but some problem is exist . As you can see some points are missing in above figure. What factors makes this missing points? too near ? or Am I taking point data too quick ?

@xlz
Copy link
Member

xlz commented Oct 26, 2015

@moonsh Maybe reflection is too strong and exceeds the sensing limit. Some of the low quality data is also removed from output.

I have also seen flat surface with patches without data. I wonder if there is any way to get around this. Maybe you can try using a filter to lower IR intensity.

@xlz xlz mentioned this pull request Oct 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants