Git Product home page Git Product logo

Comments (16)

preethamam avatar preethamam commented on May 24, 2024 1

@oqilipo just in case if you need the full program to produce the exact issue that I have raised. Here I have attached it: Full program and data.zip.

from matgeom.

oqilipo avatar oqilipo commented on May 24, 2024

Are you still looking for a solution?

from matgeom.

preethamam avatar preethamam commented on May 24, 2024

Yes, I am.

from matgeom.

dlegland avatar dlegland commented on May 24, 2024

Hi @oqilipo!
I've been in contact with preethamam by mail;
I have just had a quick look at the problem, but could not dig very deep... If you have time to check it, you're welcome!
I think I can have a closer look on Friday.

from matgeom.

oqilipo avatar oqilipo commented on May 24, 2024

@preethamam
Can you upload the data or some example data?

from matgeom.

oqilipo avatar oqilipo commented on May 24, 2024

What does the variable 'axes' contain in your code snippet?

mat1 = eulerAnglesToRotation3d(deg,axes);

I extended the example of orientedBox3d a little bit. Maybe this helps:

clearvars; close all

[v, f] = sphereMesh;
phi=-360+720*rand;
theta=-360+720*rand;
psi=-360+720*rand;
angles = [phi, theta, psi];
rotMat = eulerAnglesToRotation3d(angles);
rotMat(1:3,4) = randi([-100,100],3,1);
pts = transformPoint3d(bsxfun(@times, v, randi([1,10],1,3)), rotMat);
box3d = orientedBox3d(pts);
figure; drawPoint3d(pts, '.'); hold on;
axis equal;
h = drawCuboid(box3d);
set(h, 'facecolor', 'none');


pts2 = transformPoint3d(pts, inv(createTranslation3d(box3d(1:3))*eulerAnglesToRotation3d(box3d(7:9))));
figure; drawPoint3d(pts2, '.'); hold on;
axis equal;

from matgeom.

preethamam avatar preethamam commented on May 24, 2024

@oqilipo, axes is 'ZYX'. Here is the data: Data.zip. Please let me know if anything is required.

from matgeom.

oqilipo avatar oqilipo commented on May 24, 2024

Hi preethamam
Please provide the point cloud as MAT file stored in a simple array.
Thank you

from matgeom.

preethamam avatar preethamam commented on May 24, 2024

@oqilipo here is the data: Data.zip

from matgeom.

oqilipo avatar oqilipo commented on May 24, 2024

Maybe this is what you want to do?

clearvars; close all

load('Data.mat')

% Target points
pts3 = figure3_tgtLocation;
ell3d3 = equivalentEllipsoid(pts3);

% Source points
pts1 = figure1_srcLocation;
ell3d1 = equivalentEllipsoid(pts1);

% Transform source to target
TFM1to3 = ...
    createTranslation3d(ell3d3(1:3))*eulerAnglesToRotation3d(ell3d3(7:9))*...
    inv(createTranslation3d(ell3d1(1:3))*eulerAnglesToRotation3d(ell3d1(7:9)));
pts1to3 = transformPoint3d(pts1, TFM1to3);

figure('color','w');
drawPoint3d(pts3, '.b')
hold on
drawPoint3d(pts1to3, '.g');
axis equal
legend({'target';'source2target'})

Capture

from matgeom.

preethamam avatar preethamam commented on May 24, 2024

@oqilipo what was wrong with oriented box 3D? Could you please help me with how can it be done with oriented box 3D? Because I feel it is easier to visualize the orientation of the box than an ellipsoid.

from matgeom.

dlegland avatar dlegland commented on May 24, 2024

Hi there,

I played a bit with the data, and here are few thoughts:

  • the 2D projections of the two point clouds are nearly square. Therefore, it may bevery likely that resulting bounding boxes differ by a 90 degree rotation around an axis close to the vertical. I suspect there is such a difference in the result of "orientedBox3d" for the two point clouds
  • using equivalent ellipsoid may sometimes be more "robust", in the sense that it is less dependent on extreme values. In point cloud 2 ('target'), there is a point with very low z-coordinates. This induces a large difference in oriented box, with the effect is negligible with ellipsoid
  • However, I agree that the example is easier to visualize using oriented box than ellipsoid...
  • I tried the same approach as @oqilipo for computing "TFM1to3" , but using angles of oriented boxes instead. I got an unwanted rotation by 180 degrees, making the final boxes to overlap, but not the points...

It seems to be difficult to find a generic and robust way to register point clouds based on global features alone... Maybe a more global algorihtm such a Iterative Closest Point could by more effective in this case?

Best,
David

from matgeom.

preethamam avatar preethamam commented on May 24, 2024

Hello Everybody,

Thank you for the suggestions and answers!

The intention of using the oriented box 3D for source and target point clouds is to move them as much closer into the same coordinate reference. Then, later to use Iterative Closest Point to fine register them. This has two advantages, to help ICP and to create ground-truth orientations that can train deep learning-based models.

I used the code posted by @oqilipo and plotted the ellipsoids. Here is what I got:

image
image

Why are some points are outside after fitting an equivalent ellipsoid? Also, it was quite difficult to understand the orientations of the axes. Shouldn't they be almost parallel to the XYZ axes, as the point clouds are already?

When I plot the point clouds, I see they are already close to each other in this example.

image

Would you please let me know if there are any other robust ways to align the point clouds parallel to XYZ axes?

from matgeom.

oqilipo avatar oqilipo commented on May 24, 2024

You may use equivalentEllipsoid for the registration of the source to the target (this is a sufficient prealligment for an rICP) and afterwards you use orientedbox3d to create a transformation to align the data with the XYZ planes. However, the latter might not be necessary.

from matgeom.

preethamam avatar preethamam commented on May 24, 2024

But, why are some points are outside after fitting an equivalent ellipsoid? How to understand the orientations of the axes. Shouldn't they be almost parallel to the XYZ axes, as the point clouds are already?

from matgeom.

oqilipo avatar oqilipo commented on May 24, 2024

equivalentEllipsoid uses a PCA. See Wikipedia for more information.

from matgeom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.