Help us understand the problem. What is going on with this article?

Unity + OpenCV FaceTrackerで点の位置をスケールさせる; How to scale face parts in Unity + OpenCV

More than 1 year has passed since last update.
  • FaceTracker.csに書き足す
        private void ScalePoints(int startIndex, int endIndex, float scale)
        {
            int pointNum = endIndex - startIndex + 1;
            double xSum = 0;
            double ySum = 0;
            for (int i = startIndex; i <= endIndex; i++)
            {
                xSum += points[0][i].x;
                ySum += points[0][i].y;
            }
            double xMean = xSum / pointNum;
            double yMean = ySum / pointNum;

            // scale from mean
            for (int i = startIndex; i <= endIndex; i++)
            {
                double relativeX = points[0][i].x - xMean;
                double relativeY = points[0][i].y - yMean;
                relativeX *= scale;
                relativeY *= scale;
                points[0][i].x = relativeX + xMean;
                points[0][i].y = relativeY + yMean;
            }
        }
  • 平均をとってそこを中心にスケールさせる
  • 片方の眉毛の領域を拡大したい時は、
    • ScalePoints(15, 20, 2.2f);
  • 顔は1つを想定
  • ハマりポイント
    • points[0][i].xと書く必要がある
    • points[i]で二次元ベクトルが取れると思ったが違った
  • 想定通り動くことを確認した
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした