コード例 #1
0
ファイル: main.cpp プロジェクト: caomw/Point-Cloud-Processing
int main (int argc, char** argv)
{
  PointCloudPtr_RGB cloudA (new PointCloud_RGB);
  loadPointCloud_ply("data/scan_frame2.ply", cloudA);
  PointCloudPtr_RGB cloudB (new PointCloud_RGB);
  loadPointCloud_ply("data/scan_frame3.ply", cloudB);

  PointCloudPtr_RGB planeCloudA(new PointCloud_RGB());
  PointCloudPtr rect_cloudA(new PointCloud());
  PointCloudPtr_RGB remainingCloudA(new PointCloud_RGB());
  pcl::ModelCoefficients coefficientsA;
  PointCloudPtr_RGB planeCloudB(new PointCloud_RGB());
  PointCloudPtr rect_cloudB(new PointCloud());
  PointCloudPtr_RGB remainingCloudB(new PointCloud_RGB());
  pcl::ModelCoefficients coefficientsB;
  detect_table(cloudA, coefficientsA, planeCloudA, rect_cloudA, remainingCloudA);
  detect_table(cloudB, coefficientsB, planeCloudB, rect_cloudB, remainingCloudB);

  /* showPointCloud(planeCloudA, "planeCloudA");
  showPointCloud(remainingCloudA, "remainingCloudA");
  showPointCloud(planeCloudB, "planeCloudB");
  showPointCloud(remainingCloudB, "remainingCloudB");*/

  Eigen::Matrix4f matrix_transformA;
  Eigen::Matrix4f matrix_transformA_r;
  Eigen::Matrix4f matrix_transformB;
  Eigen::Matrix4f matrix_transformB_r;

  getTemTransformMatrix(coefficientsA, matrix_transformA, matrix_transformA_r);
  getTemTransformMatrix(coefficientsB, matrix_transformB, matrix_transformB_r);

  PointCloudPtr_RGB tabletopCloudA(new PointCloud_RGB());
  PointCloudPtr_RGB tabletopCloudB(new PointCloud_RGB());
  getCloudOnTable(remainingCloudA, rect_cloudA, matrix_transformA, matrix_transformA_r, tabletopCloudA);
  getCloudOnTable(remainingCloudB, rect_cloudB, matrix_transformB, matrix_transformB_r, tabletopCloudB);

  //showPointCloud(tabletopCloudA, "tabletopCloudA");
  //showPointCloud(tabletopCloudB, "tabletopCloudB");

  PointCloudPtr_RGB resultA (new PointCloud_RGB);
  PointCloudPtr_RGB resultB (new PointCloud_RGB);
  detect_change(tabletopCloudA, tabletopCloudB, resultA, resultB);

  showPointCloud(resultA, "resultA");
  showPointCloud(resultB, "resultB");
}
コード例 #2
0
void PointsFileSystem::showPointCloud(const std::string& filename)
{
    QModelIndex index = this->index(QString(filename.c_str()));
    if (!index.isValid())
        return;

    showPointCloud(index);

    return;
}
コード例 #3
0
    void ObjectDetectionViewer::onPointCloudReceived(PointCloud<Point>::ConstPtr cloud) {
        posix_time::ptime startTime = posix_time::microsec_clock::local_time();

        Scene::Ptr scene = Scene::fromPointCloud(cloud, config);
        Table::Collection detectedTables = tableDetector.detectTables(scene);
        Object::Collection detectedObjects = objectDetector.detectObjects(scene, detectedTables);

        {
            mutex::scoped_lock(resultMutex);
            this->detectedTables = detectedTables;
            this->detectedObjects = detectedObjects;
        }

        posix_time::time_duration diff = posix_time::microsec_clock::local_time() - startTime;
        processingTime = diff.total_milliseconds();

        showPointCloud(scene->getFullPointCloud());
    }
コード例 #4
0
QModelIndex PointsFileSystem::setRootPath(const QString & root_path)
{
    point_cloud_cache_map_.clear();
    point_cloud_map_.clear();
    checked_indexes_.clear();

    QModelIndex index = FileSystemModel::setRootPath(root_path);
    computeFrameRange();

    if (start_frame_ != -1)
    {
        if (getPointCloud(start_frame_) != NULL)
            showPointCloud(start_frame_);
    }

    MainWindow::getInstance()->getSceneWidget()->centerScene();

    return index;
}
コード例 #5
0
bool PointsFileSystem::setData(const QModelIndex &index, const QVariant &value, int role)
{
    bool is_point_cloud = (filePath(index).right(3) == "pcd");
    if(role == Qt::CheckStateRole)
    {
        if (is_point_cloud)
        {
            if(value == Qt::Checked)
                showPointCloud(index);
            else
                hidePointCloud(index);
        }

        if(hasChildren(index) == true)
            recursiveCheck(index, value);

        emit dataChanged(index, index);

        return true;
    }

    return FileSystemModel::setData(index, value, role);
}
コード例 #6
0
void PointsFileSystem::showPointCloud(int frame)
{
    showPointCloud(getPointsFilename(frame));
}
コード例 #7
0
 void PointCloudViewer::onPointCloudReceived(PointCloud<Point>::ConstPtr cloud) {
     showPointCloud(cloud);
 }