convex-hull

qhull Library - C++ Interface

感情迁移 提交于 2019-12-09 04:19:41
问题 The qhull library ( qhull.org) has several examples to start in his website, but all the information regarding to the C++ is not very useful to me. I am trying to make a simple convex Hull of 3D points that I read from a file, I can´t use the technique that is suggested in the website of calling the qhull.exe as an external application because I need to make several convex hull from some modifications that I made in the data points. I can´t find a simple example for doing this, can someone

How can I animate intermediate steps for a convex hull algorithm?

不问归期 提交于 2019-12-09 01:21:28
问题 I'm trying to make some kind of animation so that a user can understand or see the steps taken in finding the convex hull for a point set. For example, let's say I'm using this code below for Graham Scan, what are some ways to animate the line additions and removals? Even for a lot of points, it takes time to process and then plots them all almost immediately, and I'm unsure how to help the user experience what's going on... function GrahamScan(points) { points.sort(function(a, b){return a.x

Extract Characters using convex Hull coordinates - opencv - python

丶灬走出姿态 提交于 2019-12-08 19:39:28
问题 I have character images like this: Using following code I could get contours and convex hull, then I could draw convex for each character. import cv2 img = cv2.imread('test.png', -1) ret, threshed_img = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), 127, 255, cv2.THRESH_BINARY) image, contours, hier = cv2.findContours(threshed_img, cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE) for cnt in contours: # get convex hull hull = cv2.convexHull(cnt) cv2.drawContours(img, [hull], -1, (0, 0, 255), 1)

CGAL: convex hull of points with info

一曲冷凌霜 提交于 2019-12-08 02:41:34
问题 I have a vector of 2D points (N elements) in the plane. I want to make the convex hull of these points. After that, I want to retrieve the vector index of each vertex in the convex hull, how can I do this? I know that, there is such possibility for triangulation by making use of vector<pair<Point_2, unsigned> > , but when I use paired point in making convex hull, it produces a bunch of errors. This is the related piece of code that I use: #include <iostream> #include <CGAL/Exact_predicates

cvConvexityDefects in OpenCV 2.X / C++?

血红的双手。 提交于 2019-12-06 14:50:06
问题 I'm using OpenCV 2.2 and I need to determine convexity defects of a convex hull. I can't find anything on convexity defects in the documentation which makes me wonder if it is still supported in OpenCV 2.X or if it was renamed? Anyways, I tried using the C function CvSeq* cvConvexityDefects(const CvArr* contour, const CvArr* convexhull, CvMemStorage* storage=NULL ) However, I'm not able to convert my std::vector<Point> hull into CvArr . The CvArr parameters to cvConvexityDefects should be 1

Plot convex hull given by quickhull algorithm in R (convhulln function)

纵然是瞬间 提交于 2019-12-06 14:48:01
问题 I need to plot the convex hull given by quickhull algorithm in R. Here is an example. library(geometry) x1 <- rnorm(100, 0.8, 0.3) y1 <- rnorm(100, 0.8, 0.3) ConVexHull<-convhulln(cbind(x1,y1),"FA") ConVexHull$hull gives a m-by-dimension index matrix of which each row defines a dim-dimensional “triangle”. I know how to plot using chull function but I am not sure if chull gives the same hull as given by convhulln Plot_ConvexHull<-function(xcoord, ycoord, lcolor){ hpts <- chull(x = xcoord, y =

Picture Convex hull in 3D Scatter Plot

心已入冬 提交于 2019-12-06 14:09:39
问题 I followed the tutorial about 3D visualization using the package "rgl" here So I was able to draw a 3D Scatter Plot with "iris" data and create an ellipsoid surrounding 95 % of the data points: library("rgl") data(iris) x <- sep.l <- iris$Sepal.Length y <- pet.l <- iris$Petal.Length z <- sep.w <- iris$Sepal.Width plot3d(x, y, z, col="blue", box = FALSE, type ="s", radius = 0.15) ellips <- ellipse3d(cov(cbind(x,y,z)), centre=c(mean(x), mean(y), mean(z)), level = 0.95) plot3d(ellips, col =

How to calculate the convex hull with boost from arrays instead of setting each point separately?

孤人 提交于 2019-12-06 11:35:53
问题 I am new to boost and "heavy" templating. I have played since days now and tried to pass arrays to the amazing boost::geometry::convex_hull function. Without luck. I prepared the following example: #include <boost/geometry.hpp> #include <boost/geometry/geometries/polygon.hpp> #include <boost/geometry/geometries/adapted/boost_tuple.hpp> #include <boost/geometry/geometries/register/point.hpp> #include <iostream> using namespace std; namespace bg = boost::geometry; BOOST_GEOMETRY_REGISTER_BOOST

Convex Hull in O(n) time if each coordinate of each point is a rational number

北城余情 提交于 2019-12-06 07:34:54
Show that the convex hull of n points in the plane can be computed in O(n) time if each coordinate of each point is a rational number of the form p/q , with bounded values for p and q. Note: This is a homework problem. I can just think of using Jarvis March by somehow avoiding the scan of all points. Maybe this can be done by throwing rays in fixed directions (using the rational condition) to check where the next point exists . Don't use Jarvis March since it has time complexity of O(nh) . In the worst case, h may be as large as n . Note that h is the number of points on the hull. Instead, you

Convex Hull and SciPy

 ̄綄美尐妖づ 提交于 2019-12-04 23:31:54
问题 I'm trying to use scipy (0.10.1) for a quick hack to visualize the convex hull. I can get the convex hull using the following code: vecs = [[-0.094218, 51.478927], [-0.09348, 51.479364], [-0.094218, 51.478927], ... [-0.094218, 51.478927], [-0.094321, 51.479918], [-0.094218, 51.478927], [-0.094222, 51.478837], [-0.094241, 51.478388], [-0.094108, 51.478116], [-0.09445, 51.480279], [-0.094256, 51.478028], [-0.094326, 51.500511]] hull = scipy.spatial.Delaunay(vecs).convex_hull the resulting array