问题描述
我正在进行一个对象跟踪项目,该项目是从激光雷达传感器(Pepperl-Fuchs R2000)获取数据(毫米和振幅的距离).使用OpenGL和C ++,我正在linux机器中显示数据.
现在,我想根据距离对点进行聚类.我不知道如何将所有群集放在c ++中的单独容器中?我有可能将OpenGL的输出数据用作OpenCV中的输入数据进行对象跟踪吗?
I am working on a project for object tracking, where I am getting data (distance in mm and amplitude) from a Lidar sensor(Pepperl-Fuchs R2000).Using OpenGL and C++ I am displaying data in linux machine.
Now I want to group the points in clusters based on distance.I don't know how to put all the clusters in separate containers in c++?Is there any possibility that I can use output data from OpenGL as an input data in OpenCV for object tracking?
推荐答案
您应将OpenGL数据转换为OpenCV结构. OpenCV中有一些内置的功能可以共享数据,请查看此处.您也可以将OpenGL点复制到OpenCV Mat
或OpenCV cv::Point3f
的向量中.如何执行操作取决于表示点的OpenGL结构.如果必须将矩阵从OpenGL转换为OpenCV,请考虑到OpenGL按列大顺序存储矩阵,而OpenCV按行大顺序存储矩阵.
You should transform the OpenGL data into OpenCV structures. There are some built-in functions in OpenCV to share data, look here. You also may copy the OpenGL points into a OpenCV Mat
, or a vector of OpenCV cv::Point3f
. How to do it depends on the OpenGL structure your points are represented in. If you have to convert matrices from OpenGL into OpenCV, take into account that OpenGL stores matrices in column-major order, whereas OpenCV does row-major order.
然后,OpenCV提供了一些(有限的)集群解决方案.根据您的应用程序,k均值可能有效,但是我建议您也考虑其他群集技术,例如QuickShift或DBSCAN.
Then, OpenCV provides some (limited) clustering solutions.Depending on your application, k-means may work, but I'd suggest you also look at other clustering techniques, such as QuickShift or DBSCAN.
这篇关于使用OpenGL在C ++中进行数据聚类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!