Computer Vision News - April 2016
Trick Clockwise or anticlockwise, that is the question! COMPUTER VISION NEWS 14 You are developing an image analysis software . It has an interface where the user has to click around an area. In the image to the right, the user-selected points are marked in blue. For a specific algorithm in your software (e.g. tracking user behaviour) you need to know whether the points were marked in clockwise or anticlockwise direction . How can this be done? We will show two ways (one of which uses high school mathematics) to find the order in which the points were selected. We will start by assuming that the points were created forming a convex polygon (a convex polygon is defined as a polygon with all its interior angles measuring less than 180°). In the first method we use the vector Cartesian product. Cartesian product of two vectors A and B measures the degree of perpendicularity of two vectors. If you imagine that each edge of your polygon is a vector in the x-y plane of a 3- d xyz space, then the cartesian product of two successive vector would be a vector in the Z axis. If the product vector has a positive value in the Z axis, then points are marked in clockwise direction (as shown in the graph on the right). Otherwise, if vector in Z is negative, it means that the points are in anti-clockwise direction. The following example will make things clearer. Let’s assume that the points are marked in clockwise direction (as indicated in the figure to the left). We will select three arbitrary points, adjacent one to another; in our example, the points are [353 166], [484 193] and [527 263]; the resulting vectors (marked in orange) are A =[484, 193, 0] B =[353, 116, 0]. Note that we added a Z-component which is zero for every vector, since we refer to the image as a x-y plane.
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=