我在我的形象上打下了圈子,我想找到圈子和具体轮.点。
How would I go about finding the intersecting points between a contour and a circle?
增 编
我在我的形象上打下了圈子,我想找到圈子和具体轮.点。
How would I go about finding the intersecting points between a contour and a circle?
增 编
Ok, here is an idea of how you could do it:
If you know the center of the circle and the radius, also if the contour that you have is obtained with CV_CHAIN_APPROX_NONE :
Translates all the points from the chain code into points.
then you can simply go through all the points of the sequence and see which ones have a distance from the center of the circle equal to the radius.(there can be more than 2 intersections)
如果无法与CV_CHAIN_APPROX_NONE取得座椅,那么,你可以按顺序检查每座两点,并处理在外面(距离高于rad)和内(距离低于rad)或圈子(l)的两点。 届时,你将知道这两个要点之间的交叉点,你可以通过解决两个方程式系统来找到:
- 点在两点修建的线路上
- 点距圆环形中心,等于半径
If by any chance you don t know where the circle is or it s radius than you can get it s contour with cvFindContours
and then go through each set of 2 points from the other contour and use :
double cvPointPolygonTest(
const CvArr* contour,
CvPoint2D32f pt,
int measure_dist
);
In particular, if the argument measure_dist is nonzero then the function returns the distance to the nearest contour edge; that distance is 0 if the point is inside the contour and positive if the point is outside. If the measure_dist argument is 0 then the return values are simply + 1, – 1, or 0 depending on whether the point is inside, outside, or on an edge (or vertex), respectively. Th e contour itself can be either a sequence or an n-by-1 two-channel matrix of points.
从这里看,有2点,1个在外,1个在圈内,1个在圈内,1个在圈子上。 同样,足以计算确切点。
PS:如果两条交织物至少相互交错,你就可以优化算法。 可通过<条码>cvMinAreaRect2查阅。
I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...
I have been searching for sample code creating iterator for my own container, but I haven t really found a good example. I know this been asked before (Creating my own Iterators) but didn t see any ...
Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...
I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?
Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...
Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?