小编ant*_*nti的帖子

点云库,两点云的强大注册

我需要找到两个三维点云之间的变换和旋转差异.为此,我正在寻找PCL,因为它看起来很理想.

关于干净的测试数据我有迭代最近点工作,但给出了奇怪的结果(虽然我可能已经错误地实现了...)我有pcl::estimateRigidTransformation工作,看起来更好,虽然我认为会更糟糕的数据噪音.

我的问题是:

这两个云会很吵,虽然它们应该包含相同的点,但会有一些差异.处理这个问题的最佳方法是什么?

我应该在两个云中找到相应的功能开始然后使用estimateTransform吗?或者我应该看一个RANSAC删除异常值的函数?是ICP一个更好的方式去estimateRigidTransform

c++ point-clouds point-cloud-library

16
推荐指数
2
解决办法
1万
查看次数

通过共享内存将数据从c ++流式传输到c#

我试图使用共享内存将数据从c ++应用程序流式传输到C#应用程序.根据我发现的例子,我有:

c ++(发送)

    struct Pair {
    int length; 
    float data[3];
};

#include <windows.h>
#include <stdio.h>

struct Pair* p;
HANDLE handle;

float dataSend[3]{ 22,33,44 };

bool startShare()
{
    try
    {
        handle = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(Pair), L"DataSend");
        p = (struct Pair*) MapViewOfFile(handle, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, sizeof(Pair));
        return true;
    }
    catch(...)
    {
        return false;
    }

}


int main()
{

    if (startShare() == true)
    {

            while (true)
            {
                if (p != 0) {

                //dataSend[0] += 1;  // here the …
Run Code Online (Sandbox Code Playgroud)

c# c++ shared-memory

11
推荐指数
1
解决办法
2495
查看次数

pcl :: RANSAC细分,获取云中的所有平面?

我有一个Point Cloud Library功能,可以检测点云中最大的平面.这非常有效.现在我想扩展此功能以分割云中的每个平面并将这些点复制到新的云中(例如,在房间的地板上有一个球体的场景会让我回到地板和墙壁,但是不是球体,因为它不是平面的).如何扩展以下代码以获得所有平面,而不仅仅是最大的平面?(运行时是这里的一个因素,所以我宁愿不在循环中运行相同的代码,每次剥离新的最大平面)

谢谢.

int
main(int argc, char** argv)
{
    pcl::visualization::CloudViewer viewer("viewer1");

    pcl::PCLPointCloud2::Ptr cloud_blob(new pcl::PCLPointCloud2), cloud_filtered_blob(new pcl::PCLPointCloud2);
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered(new pcl::PointCloud<pcl::PointXYZ>), cloud_p(new pcl::PointCloud<pcl::PointXYZ>), cloud_f(new pcl::PointCloud<pcl::PointXYZ>);

    // Fill in the cloud data
    pcl::PCDReader reader;
    reader.read("clouds/table.pcd", *cloud_blob);

    // Create the filtering object: downsample the dataset using a leaf size of 1cm
    pcl::VoxelGrid<pcl::PCLPointCloud2> sor;
    sor.setInputCloud(cloud_blob);
    sor.setLeafSize(0.01f, 0.01f, 0.01f);
    sor.filter(*cloud_filtered_blob);

    // Convert to the templated PointCloud
    pcl::fromPCLPointCloud2(*cloud_filtered_blob, *cloud_filtered);

    std::cerr << "PointCloud after filtering: " << cloud_filtered->width * cloud_filtered->height << " data points." << std::endl;

    pcl::ModelCoefficients::Ptr …
Run Code Online (Sandbox Code Playgroud)

c++ point-cloud-library

7
推荐指数
1
解决办法
5290
查看次数

Change 'handedness' of a Row-major 4x4 transformation matrix

I have transformation and rotation coordinate data that is in a Row-major 4x4 transformation matrix format.

Ux Vx Wx Tx    
Uy Vy Wy Ty    
Uz Vz Wz Tz    
0  0  0  1
Run Code Online (Sandbox Code Playgroud)

The source of the data and the software that I need to send it to have different handed coordinate systems. One is left-handed, the other right.

How can I change the matrix from right to left handed and vice versa? I understand that for transformations you can just …

math transformation matrix

6
推荐指数
1
解决办法
2002
查看次数

过滤流数据以减少噪音,卡尔曼滤波器 c#

我正在将数据从惯性传感器流式传输到 C# 应用程序中。数据有点嘈杂,所以我需要添加一个过滤器来平滑它。我有一个卡尔曼滤波器实现,在给定数组时效果很好,但我无法理解如何在恒定数据流上使用它。

我有:

double sensorData; //the noisy value, constantly updating from another class.
Run Code Online (Sandbox Code Playgroud)

过滤器:

public static double[] noisySine = new double[20] { 40, 41, 38, 40, 45, 42, 43, 44, 40, 38, 44, 45, 40, 39, 37, 41, 42, 70, 44, 42 };
    public static double[] clean = new double[20];

      public static void KalmanFilter(double[] noisy)  
            {                  
                double A = double.Parse("1"); //factor of real value to previous real value
                // double B = 0; //factor of real value to real …
Run Code Online (Sandbox Code Playgroud)

c# streaming kalman-filter

4
推荐指数
2
解决办法
7002
查看次数

使用openCv的Aruco标记,获得3d角坐标?

我正在使用opencv 3.2检测打印的Aruco标记:

aruco::estimatePoseSingleMarkers(corners, markerLength, camMatrix, distCoeffs, rvecs,tvecs);
Run Code Online (Sandbox Code Playgroud)

这将返回标记的平移和旋转矢量.我需要的是标记每个角落的3d坐标.

因为我知道标记长度,我可以做类似的事情

corner1 = tvecs[0] - markerlength /2;
corner2 = tvecs[0] + markerlength /2;
Run Code Online (Sandbox Code Playgroud)

....

但是有更好的方法吗?还是现有的功能?总结一下,我有:

在2d广场的中心的3d点.

那个方格两边的长度.

方形的旋转值.

如何找到角落的三维坐标?

c++ opencv aruco

4
推荐指数
2
解决办法
5187
查看次数

Visual Studio:snprintf 冲突的宏定义

我正在尝试使用 Visual Studio 2017 编译一些非常旧的代码。当我构建它时,我得到以下信息:

     Error  C1189   #error:  Macro definition of snprintf conflicts with Standard Library function declaration
  (compiling source file ordeviceinput_device.cxx)  ordeviceinput   
c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\stdio.h
Run Code Online (Sandbox Code Playgroud)

根据谷歌的说法,这是因为snprintf自从编写此代码(2008 年)以来,Visual Studio 中已添加了 的定义。问题是,我在任何地方都找不到代码中的定义。包含的标题很多,我无法全部搜索。

有没有解决的办法?

还是我需要在旧版本的 VS 中构建?

c++ printf visual-studio

4
推荐指数
1
解决办法
1856
查看次数

如何通过共享内存将 cv::Mat 发送到 python?

我有一个 C++ 应用程序,它通过共享内存将数据发送到 python 函数。这ctypes在 Python 中非常有效,例如双精度和浮点数。现在,我需要cv::Mat在函数中添加一个。

我的代码目前是:

//H

#include <iostream>
#include <opencv2\core.hpp>
#include <opencv2\highgui.hpp>


struct TransferData
{
   double score;
   float other;  
   int num;
   int w;
   int h;
   int channels;
   uchar* data;

};

#define C_OFF 1000
void fill(TransferData* data, int run, uchar* frame, int w, int h, int channels)
{
   data->score = C_OFF + 1.0;
   data->other = C_OFF + 2.0;
   data->num = C_OFF + 3;   
   data->w = w;
   data->h = h;
   data->channels = channels;
   data->data = …
Run Code Online (Sandbox Code Playgroud)

c++ python opencv shared-memory

4
推荐指数
1
解决办法
1175
查看次数

将YAML文件读入C#吗?

我试图将.yaml文件读入C#应用程序,并将数据存储在自定义类中。我正在尝试YamlDotNet从nuget 使用。

该文件粘贴在下面,我拥有的代码(来自YamlDotNet示例)为:

   public void readMapFile(string filepath)
        {
            // Setup the input
            var input = new StringReader(filepath);

            // Load the stream
            var yaml = new YamlStream();
            yaml.Load(input);

            // Examine the stream
            var mapping =
                (YamlMappingNode)yaml.Documents[0].RootNode;

            foreach (var entry in mapping.Children)
            {
                Console.WriteLine(((YamlScalarNode)entry.Key).Value);
            }

            // List all the items
            var items = (YamlSequenceNode)mapping.Children[new YamlScalarNode("aruco_bc_markers")];

           }
    }
Run Code Online (Sandbox Code Playgroud)

但是,这崩溃了,给了我错误:

未处理的异常:System.InvalidCastException:无法将类型为“ YamlDotNet.RepresentationModel.YamlScalarNode”的对象转换为类型为“ YamlDotNet.RepresentationModel.YamlMappingNode”。

我是这种文件读取的新手,被卡住了。我要去哪里错了?谢谢。

%YAML:1.0
---
aruco_bc_dict: ARUCO
aruco_bc_nmarkers: 24
aruco_bc_mInfoType: 1
aruco_bc_markers:
   - { id:0, corners:[ [ -1.2928584814071655e+00, 8.1286805868148804e-01,
       -1.6458697617053986e-01 ], …
Run Code Online (Sandbox Code Playgroud)

c# yaml

3
推荐指数
1
解决办法
8108
查看次数

使用 boost 将二进制文件读入 std::vector?

std::vector<uchar>我有一个使用 boost 将 a 存储到二进制文件中的函数:

void vectorWrite(const string& filename, const std::vector<uchar> dataV)
{

    std::ofstream ofs3(filename, std::ios::out | std::ios::binary);
    boost::archive::binary_oarchive oa3(ofs3);
    oa3 << dataV;
    ofs3.close();

}
Run Code Online (Sandbox Code Playgroud)

这似乎工作正常,但我在逆转该过程时遇到了麻烦。这段代码崩溃了:

    std::vector<uchar> vectorRead(const string& filename)
    {
        std::vector<uchar> v2;
        std::ifstream ifs(filename);
        boost::archive::binary_iarchive ia(ifs);
        ia >> v2;

       return v2;
    }
Run Code Online (Sandbox Code Playgroud)

然后我正在运行:

std::vector<uchar> dataBack = vectorRead("vector.bin");

是不是这么简单呢?我缺少什么?

谢谢。

c++ serialization boost

2
推荐指数
1
解决办法
2356
查看次数