Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by WavePlant · Jul 22, 2020 at 10:02 AM · matrixtransformationalgebra

How to invert an 8x8 matrix or calculate 8DOF homography

Hi, I'm trying to write my own distortion tool. I have 2 sets of corners and want to solve for the transformation matrix between them. I found I can do that by solving the system below for H but it means I need to invert an 8x8 matrix. How do I do that? or otherwise how do I find the transformation matrix from the points? alt text

Edit: I'm trying to find the 4x4 matrix H=[h11, ..., h32] that transformed 4 given pairs of 2d points. Once I have it I can use it to transform all of a mesh's vertices and get a distorted mesh (I'll do it by extending BaseMeshEffects). So I need to invert the large matrix on the left & Left-multiply the inverse by the vector on the right to get H's coefficients. alt text

solvefor8dofhomography.png (46.4 kB)
4pointstransform.png (5.3 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Jul 22, 2020 at 11:46 AM

Well I'm not sure what you actually want to do here. However to invert a 8x8 matrix (or any sized matrix) you can use my GaussMatrixF which is just an arbitrary sized matrix which can be solved by Gaussian elimination. It's meant to be setup as an augmented matrix and it will solve the first square part of the matrix into an identity matrix. So to solve an 8x8 matrix you would need to create a 8x16 matrix (8 rows, 16 columns) and place you original matrix in the left half. Fill the right half with the 8x8 identity matrix and call Solve. It's explained here.

Something like this:

 var gm = GaussMatrixF(16, 8);
 gm.rows[0].cols[0] = x1;
 gm.rows[0].cols[1] = y1;
 // [ ... ]
 // fill your whole 8x8 matrix
 // [ ... ]
 
 // initialize second half with identity matrix
 for(int r = 0; r < 8 r++)
 {
     for(int c = 0; c < 8 c++)
     {
         if (r == c)
             gm.rows[r].cols[8+c] = 1;
         else
             gm.rows[r].cols[8+c] = 0;
     }
 }
 
 if (gm.Solve())
 {
     // access inverted matrix by reading back columns index 8 to 15
 }

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image WavePlant · Jul 23, 2020 at 06:59 AM 0
Share

Thanks! This is a good start, I'll try extending this to support matrix multiplication as well.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

204 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Rewriting Cellular Automata C# to JS 1 Answer

Is it possible to change the offset of a texture based on another textures UV? 0 Answers

Forward Kinematics with Denavit Hartenberg 0 Answers

Instantiating game objects in spiral pattern 0 Answers

InvalidCastException 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges