OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Thu, 02 Apr 2020 10:57:38 -0500Is the output of approxPolyDP(c) a subset of the input contour c?http://answers.opencv.org/question/228419/is-the-output-of-approxpolydpc-a-subset-of-the-input-contour-c/I'm determining corner points using an approximated version of contour **c**, then try to find the index of the found corner in the original contour using **numpy.where()**.
But for some points no index can be found, meaning the point seems not to be in the original contour.
As I understand the underlying DP-algorithm, no new points are added, is that correct?
Cheers!TheCakeLoverThu, 02 Apr 2020 10:57:38 -0500http://answers.opencv.org/question/228419/ellipse approximation of blob using contours moments : confusing orientation anglehttp://answers.opencv.org/question/75181/ellipse-approximation-of-blob-using-contours-moments-confusing-orientation-angle/ Dear all,
I want to draw the ellipse approximating an isolated blob (the largest contour found with findContours). Using the formulas of paper :http://goo.gl/yvcUO5 for the major and minor axes I obtain consistent axes lengths. However using the formula to compute the orientation angle from the same paper( and which I find almost everywhere) I obtain odd results. This is the formula : theta = 0.5*atan (2*mu11 / (mu20-mu02)) ;
As long as the blob (which represents a human silhouette) is not close to horizontal, the formula returns a consistent value of the orientation angle but as soon as the blob becomes almost horizontal the sign of the orientation angle is flipped suddenly. I know the reason of such a behavior. If we refer to the formula above : when the blob is not horizontal mu20 is smaller than mu02. This is true while the blob starts climbing (falling) counter clockwise until it reaches an orientation of about 45 degrees. When it reaches that value the pxels distribution of the blob becomes horizontal rather than vertical and mu20 becomes larger than mu02 which implies inversion of the angle's sign. I don't know if this formula is correct.
Thanks a lot for your help.louniceMon, 02 Nov 2015 11:07:20 -0600http://answers.opencv.org/question/75181/What is the best way to approximate a contour with a warped rectange?http://answers.opencv.org/question/59314/what-is-the-best-way-to-approximate-a-contour-with-a-warped-rectange/I have some images containing plates and each image has a file that contains a list of points around the plate. The points were chosen manually by some persons, so there is no rule (like chose the four corners or something like that). I want to extract the plates from the images, but I have met some problems in choosing the best approach for finding the closer quadrilateral that describes the plate.
I have tried to do a `minAreaRect` on the contour, but his is often returning a very different quadrilateral that has a lot of background and/or the plate is inclined (like italic) in some direction.
I have tried to do `approxPolyDP` and it seems that it returns a much more close contour (that is expected to be so), but here the problem is about the approximation error (epsilon): if it is too small, I get a contour that has more than 4 corners; if it is too large, I may receive a contour that has 3 corners, or that has cut a part of the plate. [I have tried to apply here the `minAreaRect` on those cases, but it seems that I arrive in the same situation as in the first try]
I am willing to apply the `approxPolyDP` in a recursive mode: if the approximation has not 4 corners I will increase the error and apply once more the function. But is this the way to go? Isn't there a function that may approximate the contour with the closest quadrilateral? Or is there another suggestion in achieving this?
----------
After many requests, I finally add the images.
Supposing I have an image like this ![image description](/upfiles/14425794758853707.jpg) or like this one ![image description](/upfiles/1442579555157008.jpg). Do a simple binarization to find some plates contour. It should have many points, and especially on the corners there are more than one point. If you do something interesting, please let me know :)thdrksdfthmnWed, 08 Apr 2015 06:18:57 -0500http://answers.opencv.org/question/59314/Best color difference or distance approximation?http://answers.opencv.org/question/65946/best-color-difference-or-distance-approximation/Currently, a standard way of comparing colors is using "Delta E" metric in CIELab [[Color-difference](https://en.wikipedia.org/wiki/Color_difference)] which is based on Euclidean distance in CIELab color space.
However, for certain applications using the distance metric intensively "Delta E" metric could be a bit slow (e.g. RGB2Lab conversion is necessary, floating point operations can be costly, etc.).
Is there a "good enough approximation" of color difference or distance?
Ex.
* Weighted Manhattan distance (L1 distance) (in RGB) (as suggested [here](http://stackoverflow.com/questions/9018016/how-to-compare-two-colors))
* Hue Manhattan distance (L1 distance) (in HSV) (as suggested [here](http://stackoverflow.com/questions/9018016/how-to-compare-two-colors))
* Any other suggestions?mkcThu, 09 Jul 2015 20:45:57 -0500http://answers.opencv.org/question/65946/Approximating a set of points from a binary imagehttp://answers.opencv.org/question/59145/approximating-a-set-of-points-from-a-binary-image/My task is to plot a line that reppresents the approximation (linerar I guess) to a set of points.
Example:
![image description](/upfiles/14282855632031481.jpg)
-draw a line that best fits the white points from this image.
I am aware of functions such as fitLine but how can I use them when I represent images as Mat?
exzampSun, 05 Apr 2015 21:02:59 -0500http://answers.opencv.org/question/59145/Comparing……Freeman chain code and polygonal approximationhttp://answers.opencv.org/question/30051/comparingfreeman-chain-code-and-polygonal-approximation/speaking of two kinds of method in finding contours in an image
-- Freeman chain code and polygonal approximation
through Comparing ……
what are the main advantages and disadvantages of each other? YorkSun, 16 Mar 2014 23:44:03 -0500http://answers.opencv.org/question/30051/