I want to ask a question that initially seemed to me quite simple, but in the end it turned out that it's difficult to do. The question is: how to translate the coordinates of OpenCV point into Unity coordinates (Vector2). I have a video from the camera on which I recognize the face, and only if the person is in an oval border, the user can take a photo (like FaceApp do). The problem is that I draw oval with LineRenderer and I can not compare the coordinates of its points, with the coordinates of the points on the face, because these are the coordinates of the OpenCV Point. What decision will be best for me??
Asked
Active
Viewed 441 times
1 Answers
1
I assume with OpenCV Point
you meant the System.Drawing.Point
(see docs)? If you are using that variable you can convert it as follows:
public static Vector2 ToVector2(Point point)
{
return new Vector2(point.X, point.Y);
}

Jurjen
- 1,376
- 12
- 19
-
No))The coordinate of this point is in the axes of the OpenCV. In contrast to the Unity axes, the y-axis is directed downwards. Therefore, the question arose of bringing the coordinates to a general view, in order that calculations could be made. As I understand it, the coordinates are considered locally, relative to the object in which the video stream is rendered, but this helps a little))) – Алексей Волович Apr 06 '17 at 13:27