2D spline algorithm in OpenCV
Does OpenCV have a method for generating a 2D 'spline' contour? IOW, choose gray-scale pixel values at selected points on a 2D map and have them connected by a smoothed 2-dimensional contour. Output would presumably be gray-scale values in Mat form.
The inputs to a regular spline are a set of point coordinates, and output is a continuous curve that connects the input points.
In this case, the input would be a set of point coordinates -each with a gray-scale value-. The output would be a smoothed gray-scale contour that covers the entire square Mat.
That was tougher to explain than I expected. Hope it was clear. Perhaps that would actually be a 3D spline in that gray-scale value would be the 3rd dimension. But this is for generating a 2D image.
no opencv does not have any splines (or any curve-fitting, which is probably more close to what you wanted.)
also note, that the control points for splines are NOT point coords to be approximated (apart from the 1st and last). i just saw this
https://en.wikipedia.org/wiki/Curve_f...
The easiest curved line is the Bezier curve:
https://en.wikipedia.org/wiki/Bézier_...
It takes 3D points and interpolates between them. I once used Bezier curves to visualize the quaternions as they are operated on, using Z = Z*Z + C as the iterated equation. If you perform intersection of the curve and the quaternion fractal's surface, you can get a normal (derivative) at the intersection point.
Thanks for the helpful replies. I'm surprised that OpenCV has no built in functions for this. I've seen mention of correcting camera spatial distortion, so I thought this would be related.
OpenCV does have adaptive thresholding, but that goes wrong in areas where there are no foreground objects for contrast. It will detect the more pronounced areas of noise as foreground.
I ran across a good illustration of what I'm looking for in the long run. This shows removal of 'curved' background illumination for a telescope image: http://help.imageanalyst.net/workflow...
Unfortunately, that's a specialized commercial program. And I'm looking for something that could adapt to more complex 2D 'light curvatures.' That's why I had envisioned a spline. But perhaps there are other approaches.
You could accelerate the light (bend the light's natural, inertial path) using gravitation. Don't forget that the bending of light's path (the bend angle) is double when using General Relativity, versus the old Newtonian gravitation. Not that it makes much difference, but you might as well try to do it right the first time.
http://www.einstein-online.info/spotl...
Thanks for the suggestion. I'm not actually working with telescope images. The link illustrated something similar as far as light/illumination correction. It sounds like you're referring to spatial distortion, which I don't need to handle in this case. I have a background field with irregular illumination, somewhat like the telescope image but often more complex. If I could find the general 2D curve for the illumination, I could subtract it to even out the image. Easier said than done.
Yes, good luck. :) And spatial distortion (curvature) only explains Newtonian gravity. The addition of time curvature is what makes GR more like reality.
^^ k,k, enough ... ;)
@Martian, so the whole talk about splines was pretty misleading. maybe you can show an example image of your problem,and what you're trying to achieve ?
that's probably, what the question should have been.
Hi Berak, The link that I posted is probably a good example: http://help.imageanalyst.net/workflow... But in this case, instead of telescopes, it's microscopes. Same problem though---irregular illumination, but with variations, like haze or filmy looking areas that sometimes gets misinterpreted as objects.
I didn't think I'd find a specific solution to this so I thought I might be able to 'roll my own' with the spline code.