Ich verwende PCL-Bibliothek, um ein einzelnes .ply-Modell zu visualisieren. Wie kann ich die Anzahl der Frames pro Sekunde (FPS) drucken, die unten links im Fenster angezeigt wird?PCL Druck aktuelle FPS
Hier ist mein einfacher Code. Wir brauchen nur so etwas wie cout<<print(current_fps);
#include <iostream>
//#include <unistd.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/point_cloud.h>
#include <pcl/console/parse.h>
#include <pcl/common/transforms.h>
#include <pcl/visualization/pcl_visualizer.h>
// Main function
int main(int argc, char **argv)
{
// Fetch point cloud filename in arguments | Works with PLY files
std::vector<int> filenames;
filenames = pcl::console::parse_file_extension_argument(argc, argv, ".ply");
// Load file | Works with PLY files
pcl::PointCloud<pcl::PointXYZRGB>::Ptr source_cloud (new pcl::PointCloud<pcl::PointXYZRGB>());
pcl::io::loadPLYFile(argv[filenames[0]], *source_cloud);
// Visualization
printf("\n Point cloud colors :\n"
" \t white \t = \t original point cloud \n");
pcl::visualization::PCLVisualizer viewer(" Point Cloud Datsets Visualizer");
viewer.setBackgroundColor(0.05, 0.05, 0.05, 0); // Set background to a dark grey
// Define R,G,B colors for the point cloud
pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(source_cloud);
// We add the point cloud to the viewer and pass the color handler
viewer.addPointCloud(source_cloud, rgb, "original_cloud");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "original_cloud");
//******************************
std::vector<Point, Eigen::aligned_allocator<Point>> points = source_cloud->points;
//******************************
while (!viewer.wasStopped()) { // Display the visualizer until the 'q' key is pressed
viewer.spinOnce();
}
return 0;
} // End main()
Ein Beispiel ist hier: Wie kann ich es wirklich zum Drucken verwenden? https://github.com/PointCloudLibrary/pcl/blob/ad85f523e1b3b2f9ae2b29a2099a9df2471985e2/visualization/src/pcl_visualizer.cpp#L4445 –
Dieser Problembericht wurde nur einen Tag vor Ihrer Frage eingereicht. Offenbar ist dieser Wert derzeit nicht verfügbar: https://github.com/PointCloudLibrary/pcl/issues/1944 –