Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

312
Views
Rotating coordinates (face landmarks) with origin at top left using canvas

I'm using Google's Cloud Vision API to detect faces and landmarks within them (like eyes, nose and so on).

If the face is rotated, I'd like to correct the rotation so the face and its landmarks are positioned vertically inside a canvas element.

Google provides the coordinates of the landmarks with their origin in the top left, and roll, tilt and pan properties in degrees:

enter image description here

"landmarks": [
        {
          "position": {
            "x": 371.52585,
            "y": 437.1983,
            "z": 0.0012220144
          },
          "type": "LEFT_EYE"
        },
        ...

I can correct the rotation of the image by converting the roll property to radians using ctx.rotate(degrees*Math.PI/180), but how do I rotate the coordinates so they match the rotated image?

My goal is to have the image and the corresponding coordinates as follows:

enter image description here

Cheers

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I can see two ways:

  1. Determine basic face image rotation, rotate it to the upright position and then determine face landmarks once again;

or

  1. Use Mathemetics:

    x1 = x0 * cos(roll)

    y1 = y0 * sin(roll)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!