Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6747335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:25:47+00:00 2026-05-26T12:25:47+00:00

I am writing an AR application on iOS and am using CATransform3D transforms on

  • 0

I am writing an AR application on iOS and am using CATransform3D transforms on a UIView.

Through OpenCV, I can get a perspective matrix through the call cvGetPerspectiveTransform(). This returns a 3×3 matrix.

I can’t remember where I found it, but I had sample code that did the following:

//the opencv transform matrix is put into map_matrix
cvGetPerspectiveTransform (src_pnt, dst_pnt, map_matrix);

CATransform3D t = CATransform3DIdentity;

// map over the CATransform3D 4x4 matrix from the opencv 3x3 matrix
t.m11 = cvmGet(map_matrix,0,0); 
t.m12 = cvmGet(map_matrix,1,0); 
t.m14 = cvmGet(map_matrix,2,0); 
t.m21 = cvmGet(map_matrix,0,1); 
t.m22 = cvmGet(map_matrix,1,1); 
t.m24 = cvmGet(map_matrix,2,1); 
t.m41 = cvmGet(map_matrix,0,2); 
t.m42 = cvmGet(map_matrix,1,2); 
t.m44 = cvmGet(map_matrix,2,2); 

myView.layer.transform = t;

However, applying this form causes my view to go crazy and jump all over the place. With a little experimenting, I found that only these three mappings work somewhat:

t.m14 = cvmGet(map_matrix,2,0); //left and right transform
t.m24 = cvmGet(map_matrix,2,1); //up and down transform
t.m21 = cvmGet(map_matrix,0,1); //some kind of skew?

I’ve been reading up on 3d graphics and the transform math, but it’s quite a daunting task.

What would be the correct mapping of the 4×4 matrix from the 3×3 matrix?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:25:48+00:00Added an answer on May 26, 2026 at 12:25 pm

    There may be different problems:

    First, you should try the inverse of your matrix (in case the transform you obtained is actually from destination to source). Use mat.inv(), or swap the parameters sent to getPerspectiveMatrix.

    If it does not solve your problem, you must decompose the 3×3 matrix into rotations and translations and combine it to form a 4×4 matrix. An approximate solution is to delete the last row, and the third column (which correspond to 3D rotation) – but this is only a rough approximation.

    Please check also this very good post about creating perspective transform matrices
    Opencv virtually camera rotating/translating for bird's eye view

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a iphone application using phonegap and ios. I have a weird
I am writing application using c++, in windows. I want to get a thumbnail
I'm writing an iOS application and need to get the duration time for a
I am writing a location based application for iOS 5. The application is using
I'm writing an application to start and monitor other applications in C#. I'm using
I'm writing iOS application. There's a server related to some real estate. I've to
I'm writing an application in PhoneGap that I want to run on iOS, Android,
I am using CoreData in an iOS application. Everything works fine except for fields
I am writing an application for iOS and a requirement I have been given
Hey, Am writing an iOS application and want to build it so it will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.