OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Tue, 17 Mar 2020 08:49:50 -0500fit a circle to a cloud of pointshttp://answers.opencv.org/question/227625/fit-a-circle-to-a-cloud-of-points/ Hi,
how to fit a circle with a cloud of points which can only represent a quarter of the circle ?
Thank youSylvainArdTue, 17 Mar 2020 08:49:50 -0500http://answers.opencv.org/question/227625/contour fitting and segmentation in pythonhttp://answers.opencv.org/question/96469/contour-fitting-and-segmentation-in-python/![lightbox](/upfiles/14659489728339381.jpeg)
The above image shows a light table, with 3 liquidfilled vessels on top. The camera is approx. 30cm apart from the table, and one can see the parallactic effect on the left and right vessel, which is disturbing. Also disturbing are the little wires on each vessel.
One goal is to find the middlepoint (in terms of image coordinate) of the upper rims of each vessel, in the presence of all these disturbances. What I would like to do, is to especially search for circular contours, and so to speak "fit" closed circles to the noisy contours. How can this be done in python?
First I need a kind of model for a circle of variable radius and middlepoint. I think a minimal radius has to be specified, in order to prevent the program from fitting little circles to little noisy spots.
The number of vessels doesnt have to be necessarily three. So somehow the program has to detect the number of circles needed.
I appreciate any idea or suggestion.
bradfieldTue, 14 Jun 2016 19:39:40 -0500http://answers.opencv.org/question/96469/geometric models for lane detection and trackinghttp://answers.opencv.org/question/32957/geometric-models-for-lane-detection-and-tracking/Hi,
I have searched geometric models (e.g.: straight line, circular arc, polinomals, splines etc.) to make some assumptions about the roadâ€™s structure. After I define model, I will fit the extracted features with the geometric model by using different methods like Least Squares Method, Least Median Squares, RANSAC etc.
As a start, I will use straight line for highway scenario and then continue with others (e.g.: spline models for curves). I understand the general idea. I am looking for a clue about how to implement geometric lane models in OpenCV or C++. Any suggestions?
Regards,
Suleymansy456Wed, 07 May 2014 15:26:40 -0500http://answers.opencv.org/question/32957/Fitting lines on small pixel clustershttp://answers.opencv.org/question/78758/fitting-lines-on-small-pixel-clusters/Is there an existing function in OpenCV that allows line-fitting across the major axis of bright pixel clusters? (see below) I want to automate the detection of short filaments in a series of images.
I have tried fitting the minimum bounding box around these features, but with little accuracy. I also found skeletonizing (using the Zhang-Suen method) these features quite difficult, as it seems to connect what used to be distinct pixel clusters.
![image description](/upfiles/1449688205451319.jpg)batlikeWed, 09 Dec 2015 13:12:30 -0600http://answers.opencv.org/question/78758/2D line fitting using RANSAChttp://answers.opencv.org/question/46103/2d-line-fitting-using-ransac/I have a very simple Mat object which is a binary image. All the pixels are 0 except a few which are 1(some of which are inliers and some are outliers). I want to fit a line on these 1 pixels using RANSAC. Is there any built in method to do that or I have to write one?
I am using OpenCV v2.4.8 on Fedora 20 GNU/Linux.kusanFri, 31 Oct 2014 14:23:43 -0500http://answers.opencv.org/question/46103/Detecting overlapping circleshttp://answers.opencv.org/question/43195/detecting-overlapping-circles/Hi all,
This is my first post in this forum, and it could be that i'm totally in the wrong place. But i give it a shot..
I'm a biologist tasked with detecting yeast colonies on a nutrient plate. The colonies are circular and about 3-5 mm in diameter. My problem comes from that several colonies might overlap so that you have shapes consisting of 2-5 partially overlapping circles. I need to detect the position and size of all such circles.
I know nothing about computer vision/pattern recognition, but this is my naive approach so far:
1) Find the edges of the shapes. I do this by calculating the color variance for each pixel and its surrounding neighbours. This gives a map where edges have high values and the background has zero (after some filtering)
2) Find all the individual shapes (connected non-zero regions in the map above)
3) a) For each shape select a random connected subset of the shape (corresponding to a partial circle segment). Fit a circle to these points by least squares. b) Repeat a) several times to get coverage for the whole edge of the shape. c) Cluster the calculated circle geometries from above. The number of clusters should then give the number of overlapping circles and the mean och each cluster should give the geometry.
4) (Optional. Use the input from 3) to perform a constrained heuristic optimization to fine tune the fittings.)
This whole thing works reasonably well if the circles are few and only slightly overlapping, but not well for complex shapes with several circles. It's also slow because of the fitting of random arcs. It also feels like too much of a home made brute force solution and i'm sure there are many more clever ways to do it. For example, could you count the number of times some fitted shape (spline or something) goes from concave to convex as you go along the edge of the shape? That should give the number of circles and their approximate intersection points.
All of this is done in Matlab, but anything else would work as well. Here is an image which shows how the colonies might look: http://medicine.emory.edu/id/labs/lyon/yeast.bmp
Any help is very welcome! Feeling rather lost in this field :)RasmusTue, 30 Sep 2014 01:14:44 -0500http://answers.opencv.org/question/43195/how to fit an ellipse to 2D data with random three points and thire gradient?http://answers.opencv.org/question/44372/how-to-fit-an-ellipse-to-2d-data-with-random-three-points-and-thire-gradient/i need to fit an ellipse to 2D data with random three points and their gradient. and the points is the edge points of one image. i use the Opencv function to calculate the gradient of each point.
i konw the RANSAC algorithm can do this job. and this algorithm can find the inner points fitting the ellipse and reject the noise points. but this algorithm uses five random points and it increases the sample times. so i want to improve this algorithm.
now considering the ellipse property, i find the three random points and their gradient can fit an ellipse. i have done this job combining the RANSAC algorithm. i choose three random points, calculate the ellipse center with their gradient. when i choose the fourth point and add some constraint of the ellipse. lastly, i find the inner points. but it doesnot work well.
so i want to know how to make this job well, especially restraining the fourth point with the ellipse property.
thanks!
this is all the points
![enter image description here][1]
this is the result(the green points is the inner points, the red is the noise, the blue is the center)
![enter image description here][2]
[1]: http://i.stack.imgur.com/7ajsp.jpg
[2]: http://i.stack.imgur.com/FXhEh.jpgqinling123Tue, 14 Oct 2014 21:54:21 -0500http://answers.opencv.org/question/44372/overlay between two Equirectangular/Spherical projectionshttp://answers.opencv.org/question/28729/overlay-between-two-equirectangularspherical-projections/Hello,
<br>I should realize an algorithm/function (in C++) to overlay two Equirectangular/Spherical projections like the following:
[pano1](http://studio-gesi.com/cloudine/pano1.jpg)
<br>[pano2](http://studio-gesi.com/cloudine/pano2.jpg)
Can you address me in doing this?
<br>Does OpenCV already contain something that may be of help?
<br>Naturally Verticals should be preserved while searching the best fitting and modifying just one image (pano2) to overlay in the best way over the other (pano1).
<br>If OpenCV can't do this alone I'd really appreciate if you can anyway point me to the right path.
<br><br>
Thanks in advancepbolognaThu, 20 Feb 2014 11:59:37 -0600http://answers.opencv.org/question/28729/