I have 2 pics, and the points, points1 and points2, on both the images. Points 2 are corresponding points of points1. But they are not in order, for example the first value in the points1 is not the corresponding point of the first point in points2. I have found the Epilines of points1 on the image 2. Right now I want to match the corresponding points2 to points1. This can be done if I search for the point on the Epiline. How do I proceed?
Related
Here I have some quads in an image, and now I want to separate them into a single quad. Here is the image of the quads
quads, and each shape like this I call a quad quad( a quad is formed by 4 points). Given that I've already had the coordinates of each line segment. For each line, I have their 2 endpoints, but I don't know which point is endpoint 1 or endpoint 2 endpoints of a line. If 2 lines are intersected, I also have their corner coordinate.
So in general, I have 3 lists:
A list of endpoint 1 coordinates
A list of endpoint 2 coordinates
A list of corner coordinates if 2 lines are intersected
The range of endpoint 1's list and endpoint 2's list is the same, but different to the corner's list.
Could you give me some suggestions to separate the quads? This is the result that I want to achieve desire result
What I have tried:
I tried to get 4 coordinates for each quad:
for i in endpoint 1:
-for j in corners: check if point 1 or point 2 close to the corner, then I have 2 points for a quad check if point 1 or 2 close to corner
-for z in endpoint 2(or endpoint 1 is okay because they have the same range): find a line through a corner and point 2 or point 1, if a corner point belongs to this line, then I will have 3rd point for the quad.
-for g in endpoint 2: check if 3rd point is close to point 1: then 4th point = point 2, otherwise = point 1.
As you can see, there are so many for loops, and it even does not work. If you have any idea or suggestion, please help
Edit: This is the input image input image
I have computed the contours of an object in an image. Now I have a 2D array, each of element representing X & Y coordinates of a contour point.
Now, I want to compute a tangent vector over each point and angle between them (contour point and tangent vector).
My points are ordered. i.e. p[i+1,] is next to p[i,] and my path is closed. i.e. p[0] is next to p[N-1] (If I consider N points. The image of contour points is attached below.
I have done a lot of search but never find any clue. Any help would be highly appreciated. Thanks.
The trivial way is :
Tangent[i] = Normalize(Contour[i+1] - Contour[i-1])
You would simply need to take care of boundary conditions if any!
I have photoed an A4 paper. I didn't take the whole 4 points, only with 2 or 3 points.
If there are 3 points in the photo, I can only get the coordinates of A,B,D and line CD. I can compute the intersection of CD and BC.
photo with 3 points
But if there are 2 points in the photo, I've no idea how to compute the 3rd and 4th point.
photo with 2 point
How can I compute the coordinate of the 4th point.
If I get the 4 points I can use the 4 points to take a perspective transformation with opencv(warpperspective) and rectify the picture.
Now I have a set of contour points. I have ray L which starts at Pn and has an angle of ALPHA clockwise to the horizontal axis. I want to calculate the length of line which starts at Pn and ends at the point that ray L intersects with the contour, in this case is one point between Pn-2 and Pn-3. So how can I efficently and fast calculate this length?
No algorithm can solve this in faster than linear time, since the number of intersections may be linear, and so is the size of the output. I can suggest the following algorithm, which is quite convenient and efficient to implement:
transfer the points to a coordinate system x',y' whose center is Pn and x' is parallel to L. (In practice only the y' coordinate needs to be calculated. This requires 2 multiplication and 2 additions per point).
now find all the intersecting segments by searching for adjacent indices where the y' coordinates changes signs.
Calculate the intersection & length only for these segments
You could just compute the intersection of ray L with all line segments consisting of any pair of neighbouring contour points.
Of course you might want to optimize this process by sorting by distance to Pn or whatever. Depending on the countour (concave shape?) there could be multiple intersections, so you have to choose the right one (inner, outer, ...).
Instea of computing the intersection you also could draw the contour and the ray (e.g. using openCV) and find the point of intersection by using logical and.
In my game I draw the line using two points. I want to calculate the points between the line. Please give any formula for finding points between the two points.
If your two points are A and B then
r(t) = A + t(B - A) , where t is greater than or equal to 0 and less than or equal to 1
is the equation of the line joining A to B, and consequently allows you to find any point lying on the line between them (by using an appropriate value for t).
Does this help??