RVC  1.14.1
a product by RVBUST.
get noise removal point map
#include <RVC/RVC.h>
#include <iostream>
#include "IO/FileIO.h"
#include "IO/SavePointMap.h"
int main(int argc, char *argv[]) {
// Initialize RVC system.
// Scan all RVC Camera devices.
RVC::Device devices[10];
size_t actual_size = 0;
SystemListDevices(devices, 10, &actual_size, RVC::SystemListDeviceType::All);
// Find whether any RVC Camera is connected or not.
if (actual_size == 0) {
std::cout << "Can not find any RVC Camera!" << std::endl;
return -1;
}
if(devices[0].IsFirmwareMatch() == false){
std::cout << "device firmware mismatch, Please use RVCManager to upgrade the firmware" << std::endl;
return -1;
}
// Create a RVC Camera and choose use left side camera.
RVC::X1 x1 = RVC::X1::Create(devices[0], RVC::CameraID_Left);
// Open RVC Camera.
x1.Open();
// Test RVC Camera is opened or not.
if (!x1.IsOpen()) {
std::cout << "Failed to open camera! Please check whether the camera is connected and make sure it is not occupied and supports X1." << std::endl;
return 1;
}
cap_opt.noise_removal_distance = 0.5; // unit: mm
const std::string save_directory = "./Data/";
MakeDirectories(save_directory);
// Capture a point map and a image with default setting.
if (x1.Capture(cap_opt) == true) {
std::cout << "RVC Camera capture successed!" << std::endl;
// Get point map data (m).
std::string pm_addr = save_directory + "test.ply";
std::cout << "save point map to file: " << pm_addr << std::endl;
pm.Save(pm_addr.c_str(), RVC::PointMapUnit::Meter, true);
// Get image data.
RVC::Image img = x1.GetImage();
std::string img_addr = save_directory + "test.png";
std::cout << "save image to file: " << img_addr << std::endl;
img.SaveImage(img_addr.c_str());
} else {
std::cout << RVC::GetLastErrorMessage() << std::endl;
std::cout << "RVC Camera capture failed!" << std::endl;
}
// Close RVC Camera.
x1.Close();
// Destroy RVC Camera.
// Shutdown RVC System.
return 0;
}