LiangliangNan / Easy3D

A lightweight, easy-to-use, and efficient C++ library for processing and rendering 3D data
GNU General Public License v3.0
1.37k stars 245 forks source link

how to automate the RANSAC primitive extraction and how to use it in python project. #175

Closed vedantpatel41 closed 9 months ago

vedantpatel41 commented 9 months ago

Hello there!

I hope this message finds you well. I'm currently working on a 3D reconstruction project, and I'm in need of RANSAC primitive extraction from Mapple. I'm running reconstructions on multiple files and aiming to automate this process.

I'd greatly appreciate your guidance on how to integrate RANSAC primitive extraction into my project. If you have any insights or recommendations on how I can achieve automation, I would be grateful for your assistance.

LiangliangNan commented 9 months ago

The basic usage is

    auto cloud = dynamic_cast<PointCloud *>(model);
    auto normals = cloud->get_vertex_property<vec3>("v:normal");
    if (!normals) {
        std::cerr << "Plane extraction using RANSAC requires normal information but it is not available" << std::endl;
        return false;
    }

    PrimitivesRansac algo;
    algo.add_primitive_type(PrimitivesRansac::PLANE);  // Tell the algorithm to extract planes only (you can also add other types)

    // you can try different parameters of RANSAC (usually you don't need to tune them)
    const int num = algo.detect(cloud, 200, 0.005f, 0.02f, 0.8f, 0.001f);
    if (num > 0) {
        std::cout << num << " primitives extracted" << std::endl;
        ... Then the results are stored as per-point properties:
             - "v:primitive_type"  (one of PLANE, SPHERE, CYLINDER, CONE, TORUS, and UNKNOWN)
             - "v:primitive_index" (-1, 0, 1, 2...). -1 meaning a vertex does not belong to any primitive (thus its primitive_type must be UNKNOWN.
    }

image

Please check the example at tutorials/Tutorial_703_Cloud_PlaneExtraction and also point_cloud_ransac.h for more details.

zeyadmahmoudd commented 3 months ago

Dear Sir, Hope all is well with you. I had a question, Can I Ransac Plane Extraction inside Mapple GUI?

LiangliangNan commented 3 months ago

Yes. Please check out the "Primitive extraction" menu under "Point cloud".

Best,

Liangliang


From: Zeyad Mahmoud @.> Sent: Saturday, July 27, 2024 1:42:14 AM To: LiangliangNan/Easy3D @.> Cc: Liangliang Nan @.>; State change @.> Subject: Re: [LiangliangNan/Easy3D] how to automate the RANSAC primitive extraction and how to use it in python project. (Issue #175)

Dear Sir, Hope all is well with you. I had a question, Can I Ransac Plane Extraction inside Mapple GUI?

— Reply to this email directly, view it on GitHubhttps://github.com/LiangliangNan/Easy3D/issues/175#issuecomment-2253206240, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADWOVCFRQCKKH755TSJWZL3ZOKC7NAVCNFSM6AAAAABCIPHWNSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJTGIYDMMRUGA. You are receiving this because you modified the open/close state.Message ID: @.***>

LiangliangNan commented 3 months ago

See the menu on the top (instead of the rendering panels on the left) :)

Best,

Liangliang


From: Zeyad Mahmoud @.> Sent: Monday, July 29, 2024 5:40:27 PM To: LiangliangNan/Easy3D @.> Cc: Liangliang Nan @.>; State change @.> Subject: Re: [LiangliangNan/Easy3D] how to automate the RANSAC primitive extraction and how to use it in python project. (Issue #175)

Screenshot.2024-07-29.at.10.38.19.AM.png (view on web)https://github.com/user-attachments/assets/5430401a-ad48-4e11-baf2-f480756e1a85 I can't find Primitive Extraction under points, or there is another menu called pointclouds not points? Because I can't find it. Thanks for your time and effort.

— Reply to this email directly, view it on GitHubhttps://github.com/LiangliangNan/Easy3D/issues/175#issuecomment-2255466664, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADWOVCFU3WT5VHSZXT6JEYDZOYEYXAVCNFSM6AAAAABCIPHWNSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJVGQ3DMNRWGQ. You are receiving this because you modified the open/close state.Message ID: @.***>