Domanda

I am working with Android OpenCV .I have a square shape marker image .I have to find out the position of four corners of marker in the live feed with their index's position. I am able to get the position of these four points in the live feed having the frame size 640*480. But the problem with the index's positions those are not fixed ,sometimes i am getting the 0th index on the top left position and sometimes 1th index at that position ... How to solve this problem or is there any alternative for findContour() method.

È stato utile?

Soluzione 2

Do the objects have an intrinsic absolute orientation (i.e. a glove, or an oriented checkerboard) that may change from frame to frame, and you need to recognize it? Or is it only a matter of ensuring that the index ordering is consistent from frame to frame? If the latter, and the relative interframe motion is small, why not just track it - i.e. reassign indices by proximity with the positions of the corners at the previous frame?

Altri suggerimenti

If the shape is quadrilateral, you can use corner sorting approach:

1- Get the mass center.

2- Points that have lower y-axis than mass center are the top points, otherwise they are bottom points.

3- Given two top points, the one with lower x-axis is the top-left. The other is the top-right.

4- Given two bottom points, the one with lower x-axis is the bottom-left. The other is the bottom-right.

Reference with opencv/c++: https://opencv-code.com/tutorials/automatic-perspective-correction-for-quadrilateral-objects/

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top