Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

3D Object Recognition Using Global Descriptor (Ensemble of Shape Functions) via PCL

Abierto
#5,770 25 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
cpp

Línea de trabajo

Comience con el código proporcionado de main(), traverseDirectory() y calculateESFDescriptor(), y luego reproduzca el comportamiento con un directorio que contenga varios archivos .pcd. Siga la iteración del directorio y el procesamiento de descriptores para determinar dónde se detiene la ejecución; el trabajo estará terminado cuando se haya identificado la causa y el programa procese todos los archivos elegibles, con su comportamiento verificado en el escenario proporcionado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

kind: bug module: features

I am developing a system for 3D object recognition using the point cloud library. I want to apply an ESF descriptor to a data set that I have stored locally. I am giving the folder containing data to the program as an argument. I am attaching the code for reference.


#include <pcl/io/pcd_io.h>
#include <pcl/features/esf.h>
#include <pcl/visualization/histogram_visualizer.h>
#include <pcl/visualization/pcl_plotter.h>
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/console/print.h>
#include <boost/filesystem.hpp>
#include <boost/range/iterator_range.hpp>
#include <flann/flann.h>
#include <fstream>

typedef std::pair<std::string, std::vector<float> > esf_model;


void calculateESFDescriptor(const boost::filesystem::path &path){
    pcl::console::print_highlight ("Executing function: calculateESFDescriptor() \n");

    // const boost::filesystem::path &path = base_dir/it->path().filename();

    // Cloud for storing the object.
    pcl::PointCloud<pcl::PointXYZ>::Ptr object(new pcl::PointCloud<pcl::PointXYZ>);
    // Object for storing the ESF descriptor.
    pcl::PointCloud<pcl::ESFSignature640>::Ptr descriptor(new pcl::PointCloud<pcl::ESFSignature640>);

    // Note: you should have performed preprocessing to cluster out the object
    // from the cloud, and save it to this individual file.

    // Read a PCD file from disk.
    if (pcl::io::loadPCDFile<pcl::PointXYZ>(path.string(), *object) != 0)
    {
        pcl::console::print_highlight ("Unable to read .pcd file from the directory\n");
        // return -1;
    }

    // ESF estimation object.
    pcl::ESFEstimation<pcl::PointXYZ, pcl::ESFSignature640> esf;
    esf.setInputCloud(object);

    esf.compute(*descriptor);

    // Writing esf description file to disk
    std::string output_file_name = path.string().substr(0, path.string().find_last_of('.')) + "_esf.pcd";
    pcl::io::savePCDFileASCII (output_file_name, *descriptor);
    std::cerr << "Saved data points to " << output_file_name << std::endl;
    // return (0);
}


/** \brief Load a set of ESF features that will act as the model (training data)
  * \param argc the number of arguments (pass from main ())
  * \param argv the actual command line arguments (pass from main ())
  * \param extension the file extension containing the ESF features
  */
void traverseDirectory(const boost::filesystem::path &base_dir, const std::string &extension){
    pcl::console::print_highlight ("Executing function: traverseDirectory() \n");

    if (!boost::filesystem::exists(base_dir) && !boost::filesystem::is_directory(base_dir)){
        pcl::console::print_highlight ("Quitting as the directory does not exists.\n");
        return;
    }

    int i = 0;

    for (boost::filesystem::directory_iterator it (base_dir); it != boost::filesystem::directory_iterator (); ++it)
    {
        if (boost::filesystem::is_directory(it->status()))
        {
            std::stringstream ss;
            ss << it->path ();
            pcl::console::print_highlight ("Loading %s \n", ss.str().c_str());
            traverseDirectory(it->path(), extension);
        }   


        // Calculate ESF Descriptor for each file
        if (boost::filesystem::is_regular_file(it->status()) && boost::filesystem::extension(it->path())==extension)
        {
            calculateESFDescriptor(base_dir/it->path().filename());
            pcl::console::print_highlight ("Loop execution: %d\n", i++);
        }
        // continue;
    }
}

int main(int argc, char** argv)
{   
    if (argc < 2)
    {
        PCL_ERROR ("Need at least two parameters! Syntax is: %s [model_directory] [options]\n", argv[0]);
        return (-1);
    }   

    std::string extension(".pcd");
    transform(extension.begin(), extension.end(), extension.begin(), (int(*)(int))tolower);

    // std::vector<esf_model> models;

    // Traversing directory to find all .pcd files and applying esf descriptor to each file
    traverseDirectory(argv[1], extension);
    return (0);
}

The problem is that the function calculateESFDescriptor() runs only once and then the program shuts down without any error, whereas I have multiple .pcd files in the directory and the function should execute for all the files in the directory. I want to calculate the ESF descriptor for all the files to compare them with user-given input at a later stage to calculate the accuracy. I cannot debug where I am making the mistake due to which the program cannot execute for all the files in the directory. The program runs for the whole directory when I comment out the following line. calculateESFDescriptor(base_dir/it->path().filename());

The question is if it is possible to compute descriptor for the whole directory at once or do I have to give each file as input and run the program for each file separately?

Lenguaje dominante
C++
Estrellas
11.2k
Forks
4.7k
Merge medio
5 d 8 h
PR fusionados (30 d)
10

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PointCloudLibrary/pcl

Todos los issues de PointCloudLibrary/pcl

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.