corner estimation

Jul 14, 2013 at 12:18pm
Hi

I hope some people good at maths here so maybe they can solve it.

lets say I am shown a square with four corners and each corner is given a coordinate except for one, which is unknown.

anyone know how to estimate the coordinate for this coordinate, this should work for square at any orientation i.e. (ok a quadrilateral as skewed turns to trapezium) rotation, skewing,.

thanks
Jul 14, 2013 at 12:41pm
You can Try to solve using vector addition and subtraction.
Jul 15, 2013 at 5:35pm
thanks will try that
Jul 15, 2013 at 8:02pm
If you allow non-parallel axes you cannot solve the problem. For example (0,0),(0,1),and (1,1) will yield (1,0) with parallel axes, but it can be (0.3,0.9) or (0.4,0.5) or any other point.
Also, it is important the order of points (0,0),(0,1),and (1,1) will yield (1,0), but (0,0),(1,1),and (0,1) yield (-1,0)
With these assumptions (x1,y1),(x2,y2),(x3,y3) yield (x4,y4) where x4=x3+x1-x2, y4=y1+y3-y2
Jul 16, 2013 at 5:29am
The diagonally opposite points can be assumed to be the ones whose vector's modulus is root two times the moduli of each of the other vectors.
Jul 16, 2013 at 2:54pm
@abhishekm71 Only for squares
Jul 16, 2013 at 3:02pm
ats15 is right. If opposing lines of the shape are not parallel, there is no way to determine the 4th point.


If the lines ARE parallel it's a very simple problem:

m = the missing point
n, k = neighboring points to 'm'
p = opposite point

m-k = n-p

therefore

m = (n-p) + k
Jul 16, 2013 at 9:19pm
had to remove solved so i could reply, but it is solved.

Disch:
so would this work for a trapezium where the there is only pair that are parallel the other is not.

thanks
Jul 16, 2013 at 9:24pm
@asda333:

No. It only works if both pairs are parallel.

It is flat out impossible to find the 4th point on a trapezium.
Jul 16, 2013 at 9:34pm
ok, thanks any ways for the help so far.
;)
Jul 17, 2013 at 3:53am
If you have a specific quadrilateral in mind let us know...
Jul 17, 2013 at 8:10am
add a 3rd dimension to your script. Need to build a library yourselves. But it should work.

Also the area could also be your solution, since area change in a specific rate. All you need is calculus work, lot of it.

connect the three points with every possible combination and times the coordinate by -1, x and y.

using three points to make a centre, then use calculus to calculate the length of the line with missing points (when one line increase, the other decrease at some specific rate)
Last edited on Jul 17, 2013 at 8:18am
Jul 17, 2013 at 12:11pm
I asked because i am writing a program for corner detection and and object is placed on a square surface, which the program detects the corners of the square surface but i have to rotate the surface as well as the object together, which will cause the object to occlude one of the 4 corners and wanted to find a way i could find out the corner that is occluded.

it will be a trapezium as the view is not on top from the side diagonal so it would appear trapezium the smaller being the further away part.

maybe as at the beginning the corner is known and from there the height can be known and maybe using that height to help find the missing corner but there is a problem that when occluded and the trapezium height changes even by a fraction of a millimeter and the previous height will not be of any good.

thanks
Last edited on Jul 17, 2013 at 12:15pm
Jul 17, 2013 at 2:48pm
Why not just keep a copy of the object's pre-rotated coordinates so that you never lose that information?

Seems silly to throw it away and try to recover it when you can just hang on to it from the start.
Jul 19, 2013 at 12:24am
how may i use it to detect the coordinate of the same point after rotation and it is occluded.

I don't throw it away, unless if i can't find any use for it then it will be replaced every frame.

i do store them for the first set of coordinates to build a 3D array.
how shall i use that to help find the occluded corner.

thanks
Jul 19, 2013 at 1:57am
Just my 2 cents worth, I don't know anything about the graphics system you are using, just going on my knowledge of vector algebra :

If the polygon is a square in the original world coordinates, then it is easy to calculate the 4th corner - just subtract the vector from points 1 to 2 from point 3.

When one views this square from an angle, it may look like a trapezium, but it is still a square in world coordinates. So just use the World Coords rather any from a new view

There is a Point In Polygon algorithm that basically draws a ray parallel to an axis (it doesn't matter but that is more efficient to calculate), if the ray intersects the polygon an odd number of times, the point is inside the polygon. In 3D, the ray would have to be coplanar with the polygon, which itself needs to be planar. Could be a bit of effort to get that working in 3D as it is a 2D algorithm.

http://stackoverflow.com/questions/11716268/point-in-polygon-algorithm


Note the concerns mentioned.

asda333 wrote:
I asked because i am writing a program for corner detection and and object is placed on a square surface, which the program detects the corners of the square surface but i have to rotate the surface as well as the object together, which will cause the object to occlude one of the 4 corners and wanted to find a way i could find out the corner that is occluded.


Might have been more helpful if you asked that at the start :-)

One other question : Does your graphics system have any functions for clipping planes? It might well do it for you.

Hope all goes well.


Jul 22, 2013 at 1:06pm
Hi

I have been busy with it for a while

I am tried but it displays as a trapezium so even though it is a square i can only use the 2d coordinates it projects on to the image.

i use opencv and drawing function to display the corners as a trapezium.
so i can't do it as a square.

isn't there a relationship between previous corner and the new corner when rotated so i can use that to estimate next corner.

Jul 23, 2013 at 7:53pm
i got an idea something similar to what disch i will capture the corner where it is most likely to get occluded, write them down so everytime a corner is captured check against the written one and provide the corner for the occluded one.

thanks
Topic archived. No new replies allowed.