ransac

HDL_Graph_slam骨头记(2)

删除回忆录丶 提交于 2019-12-03 23:38:49
#include <memory> #include <iostream> #include <ros/ros.h> #include <ros/time.h> #include <pcl_ros/point_cloud.h> #include <std_msgs/Time.h> #include <sensor_msgs/PointCloud2.h> #include <hdl_graph_slam/FloorCoeffs.h> #include <nodelet/nodelet.h> #include <pluginlib/class_list_macros.h> #include <pcl/common/transforms.h> #include <pcl/features/normal_3d.h> #include <pcl/search/impl/search.hpp> #include <pcl/filters/impl/plane_clipper3D.hpp> #include <pcl/filters/extract_indices.h> #include <pcl/sample_consensus/ransac.h> #include <pcl/sample_consensus/sac_model_plane.h> namespace hdl_graph

RANSAC plane fitting coefficients

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to fit a plane to a set of point cloud. I tried using Point Cloud Library (PCL) & it works well. What I need to know is that how can I obtain the coefficients a,b,c of the fitted plane (ax+by+cz+1=0). Is there any straightforward way? I got some insights from here: 3D Least Squares Plane 回答1: See the following planar segmentation tutorial: http://pointclouds.org/documentation/tutorials/planar_segmentation.php Note in particular the use of the pcl::ModelCoefficients data structure. Allocation: pcl::ModelCoefficients::Ptr

Using estimateRigidTransform instead of findHomography

只愿长相守 提交于 2019-12-03 08:30:50
The example in the link below is using findHomography to get the transformation between two sets of points. I want to limit the degrees of freedom used in the transformation so want to replace findHomography with estimateRigidTransform . http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography Below I use estimateRigidTransform to get the transformation between the object and scene points. objPoints and scePoints are represented by vector <Point2f> . Mat H = estimateRigidTransform(objPoints, scePoints, false); Following the method used in

OpenCV - Ransac fitting line

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: What's the best and most efficient way to fit one or more good lines using Ransac with a set of points in an image using OpenCV? Ransac is the most efficient way to fit a line? 回答1: Take a look at Least Mean Square metod . It's faster and simplier than RANSAC. Also take look at OpenCV's fitLine method. RANSAC performs better when you have a lot of outliers in your data, or a complex hypothesis. 回答2: RANSAC is not the most efficient but it is better for a large number of outliers. Here is how to do it using opencv: A useful structure- struct

OpenCV: How to get inlier points using findHomography()/findFundamental() and RANSAC

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: OpenCV does not provide a RANSAC-function per se or at least in such a form that you can just call it and be done with it (e.g. cv::ransac(...) ). All functions/methods that are able to use RANSAC have a flag that enables it. However this is not always useful if you actually want to do something else with the inliers RANSAC computes after you have estimated a homography/fundamental matrix for example create a nice plot in Octave or similar software/library of the points, apply additional algorithms on the remaining set of filtered matches

RANSAC-like implementation for arbitrary 2D sets

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: TL;DR : Is there a C++ implementation of RANSAC or other robust correspondence algorithms that is freely usable with arbitrary 2D point sets? I know that many implementations exist that include or make use of correspondence algorithms such as RANSAC (Random Sampling Consensus). They are often used in computer vision applications and found in libraries such as OpenCV , PCL , etc. The general algorithm is well known and various site lists the different steps. Now, all the "advanced" implementations (done for OpenCV, PCL, etc.) I have found are

Why is RANSAC not working for my code?

匿名 (未验证) 提交于 2019-12-03 00:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to find fundamental matrix between 2 images and then transform them using RANSAC. I first use SIFT to detect keypoints and then apply RANSAC: img1 = cv2.imread("im0.png", 0) # queryImage img2 = cv2.imread("im1.png", 0) # trainImage # Initiate SIFT detector sift = sift = cv2.xfeatures2d.SIFT_create() # find the keypoints and descriptors with SIFT kp1, des1 = sift.detectAndCompute(img1, None) kp2, des2 = sift.detectAndCompute(img2, None) src = np.float32([points.pt for points in kp1]).reshape(-1, 1, 2) dst = np.float32([points.pt

SolvePnPRansac位姿估计算法

匿名 (未验证) 提交于 2019-12-03 00:38:01
SolvePnPRansac是PnP位姿估计鲁棒算法的一种,下面是Opencv 接口函数的描述 /* max 注释 * 函数功能:用ransac的方式求解PnP问题 * * 参数: * [in] _opoints 参考点在世界坐标系下的点集;float or double * [in] _ipoints 参考点在相机像平面的坐标;float or double * [in] _cameraMatrix 相机内参 * [in] _distCoeffs 相机畸变系数 * [out] _rvec 旋转矩阵 * [out] _tvec 平移向量 * [in] useExtrinsicGuess 若果求解PnP使用迭代算法,初始值可以使用猜测的初始值(true),也可以使用解析求解的结果作为初始值(false)。 * [in] iterationsCount Ransac算法的迭代次数,这只是初始值,根据估计外点的概率,可以进一步缩小迭代次数;(此值函数内部是会不断改变的),所以一开始可以赋一个大的值。 * [in] reprojectionErrr Ransac筛选内点和外点的距离阈值,这个根据估计内点的概率和每个点的均方差(假设误差按照高斯分布)可以计算出此阈值。 * [in] confidence 此值与计算采样(迭代)次数有关。此值代表从n个样本中取s个点

RANSAC(随机抽样一致算法)

匿名 (未验证) 提交于 2019-12-02 23:59:01
1. 算法介绍 可以从一组包含“局外点”的观测数据集中,通过迭代方式估计数学模型的参数。它是一种不确定的算法――它有一定的概率得出一个合理的结果;为了提高概率必须提高迭代次数。 最小二乘法不能找到有局外点的直线,原因是最小二乘法尽量去适应包括局外点在内的所有点。 2.概述 RANSAC通过反复选择数据中的一组随机子集来达成目标。被选取的子集被假设为局内点,并用下述方法进行验证: 1.首先我们先随机假设一小组局内点为初始值。然后用此局内点拟合一个模型,此模型适应于假设的局内点,所有的未知参数都能从假设的局内点计算得出。 2.用1中得到的模型去测试所有的其它数据,如果某个点适用于估计的模型,认为它也是局内点,将局内点扩充。 3.如果有足够多的点被归类为假设的局内点,那么估计的模型就足够合理。 4.然后,用所有假设的局内点去重新估计模型,因为此模型仅仅是在初始的假设的局内点估计的,后续有扩充后,需要更新。 5.最后,通过估计局内点与模型的错误率来评估模型。 整个这个过程为迭代一次,此过程被重复执行固定的次数,每次产生的模型有两个结局: 1、要么因为局内点太少,还不如上一次的模型,而被舍弃。 2、要么因为比现有的模型更好而被选用。 4.算法优缺点 其实核心就是随机性和假设性。随机性用于减少计算了,那个循环次数就是利用正确数据出现的概率。所谓的假设性,就是说随机抽出来的数据我都认为是正确的

RANSAC(随机抽样一致性)算法在sift中的应用

跟風遠走 提交于 2019-12-02 06:02:12
RANSAC简介 ransac是RANdom SAmple Consensus的简称,它是根据一组包含异常数据的样本数据集,通过迭代的方法计算出数据的数学模型参数,得到有效样本数据的非确定性的算法。它于1981年由 Fischler和Bolles最先提出。 对于RANSAC算法有一个基本的假设:样本中包含正确数据(inliers,符合模型的数据)和异常数据(Outliers,不符合模型的数据),即数据集中含有噪声。这些异常数据可能是由于错误的测量、错误的假设、错误的计算等产生的。同时RANSAC也假设, 给定一组正确的数据,存在可以计算出符合这些数据的模型参数的方法。 RANSAC算法的输入是一组观测数据(往往含有较大的噪声或无效点),一个用于解释观测数据的参数化模型以及一些可信的参数。RANSAC通过反复选择数据中的一组随机子集来达成目标。被选取的子集被假设为局内点,并用下述方法进行验 1.有一个模型适应于假设的局内点,即所有的未知参数都能从假设的局内点计算得出。 2.用1中得到的模型去测试所有的其它数据,如果某个点适用于估计的模型,认为它也是局内点。 3.如果有足够多的点被归类为假设的局内点,那么估计的模型就足够合理。 4.然后,用所有假设的局内点去重新估计模型(譬如使用最小二乘法),因为它仅仅被初始的假设局内点估计过。 5.最后,通过估计局内点与模型的错误率来评估模型。