What kind of operators do I need to detect a curve from a discrete set ( pixels ) or 3D vertices on a lattice? I have this problem that I'm trying to solve: I would like to vectorize a set of points in $\mathbb{R^2}$ or $\mathbb{R^3}$, which means that I have pixels on an image or vertex on a lattice.
Before even bothering about how to represent a curve, a bezier, and what is the most appropriate way of doing that I need to detect the control points for said curve and in general I need to detect where the curve curves - sorry for the bad catch here - , twists, or even curves more then before so I need to add a steeper control point .
Of course the derivative comes to mind, the problem is that in school I have never used a derivative on a discrete set, and here I have 2D pixels and 3D vertex.
There is an operator that I can use do detect such variations and use it with linear algebra objects such as vectors and matrices ?
 A: One simple calculation that might help is to find, for each point $(x,y)$ in your set, the centroid of your set’s points that lie in a small neighborhood of $(x,y)$.
If $(x,y)$ is a point on a straight line segment, the centroid of of all the points on that line segment near $(x,y)$ is $(x,y)$. If $(x,y)$ is on a curve (a C-shaped one, not one that doubles back like an S), however, the centroid of the points on the curve near $(x,y)$ will not be $(x,y)$, but will instead be somewhere away from $(x,y)$ towards the concave side of the curve.
Find the points $(i,j)$ that are in your set and within a certain distance of $(x,y)$. Call that set of points $N(x,y)$, for “neighborhood.” You can use a simple notion of distance between $(x,y)$ and $(i,j)$ like $|x-i|+|y-j|$. Then average the $x$-coordinates and the $y$-coordinates separately, for these points $(i,j)$ to get a neighborhood centroid $(\hat{i},\hat{j})$. The further $(\hat{i},\hat{j})$ is from $(x,y)$, the more “C-shaped” the curve is near the point $(x,y)$. You can put control points at the places where this calculation gives you a local maximum difference from $(x,y)$.
You’ll have to experiment to see what works best in terms of neighborhood size. You want neighborhoods big enough to contain some visible curvature, but not so big as to contain S-shapes or other complications. You may want to repeat the calculation at different scales.
There are discrete analogs of derivatives (differences), and there are more mathematical treatments for feature detection in general: You could look here for ideas and links.
You might also have more luck asking this question on stackoverflow.com or some forum with a focus on computer graphics or computer vision algorithms. There are also software products that help convert raster images to vector images. If you google “vectorize raster image” you might find useful stuff.
