Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading input Error: "label" property not found in input file. #7761

Closed
wbq13599531791 opened this issue Oct 7, 2023 · 1 comment
Closed

Comments

@wbq13599531791
Copy link

wbq13599531791 commented Oct 7, 2023

Please use the following template to help us solving your issue.

Issue Details

我想用cgal中的classification算法对已经打好标签的ply数据做训练,但是无法读取ply数据到Point_set后,无法读取Point_set中的property_map(已经用CLoudCompare对ply文件添加了SF标签,起名为label)
Describe your issue. Please be specific (compilation error, runtime error, unexpected behavior, wrong results, etc.).

Source Code

int main(int argc, char** argv)
{
    std::string filename(argc > 1 ? argv[1] : CGAL::data_file_path("../data/in/Train-mesh.ply"));
    std::ifstream in(filename.c_str(), std::ios::binary);
    Point_set pts;
    std::cerr << "Reading input" << std::endl;
    in >> pts;
    /*for (int index_p = 0; index_p < pts.size(); index_p++)
    {
        std::cout << pts.normal(index_p) << std::endl;
    }*/
    Imap label_map;
    bool lm_found = false;
    std::string str("Colors");
    std::tie(label_map, lm_found) = pts.property_map<int>(str);

    if (!lm_found)
    {
        std::cerr << "Error: \"label\" property not found in input file." << std::endl;
        return EXIT_FAILURE;
    }
    std::cerr << "Generating features" << std::endl;
    CGAL::Real_timer t;
    t.start();
    Feature_set features;

If your issue arises by using CGAL in your own source code, please provide a minimalist example that we can compile easily to reproduce the bug. If your issue arises from using a CGAL program (demo, example, etc.), please let us know which one. Helping you solving an issue is much easier and efficient if we can reproduce it.

Environment

Win10,64bit
vs2019
Cmake
CGAL5.5.1

  • Operating system (Windows/Mac/Linux, 32/64 bits):
  • Compiler:
  • Release or debug mode:
  • Specific flags used (if any):
  • CGAL version:
  • Boost version:
  • Other libraries versions if used (Eigen, TBB, etc.):
@wbq13599531791 wbq13599531791 changed the title Reading input CGAL error: assertion violation! Expression : parray_ != nullptr File : D:\dev\vcpkg\installed\x64-windows\include\CGAL/Surface_mesh/Properties.h Line : 607 Explanation: Refer to the bug-reporting instructions at https://www.cgal.org/bug_report.html Reading input Error: "label" property not found in input file. Oct 7, 2023
@sloriot
Copy link
Member

sloriot commented Oct 9, 2023

Default operator>>() expect the mesh to be in OFF format. You should use the function CGAL::IO::read_PLY() directly and follow the doc to see how to have colors defined:
https://doc.cgal.org/latest/Surface_mesh/group__PkgSurfaceMeshIOFuncPLY.html#ga3b898d61ab5682756b25c425a8d8ec97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants