简体   繁体   中英

C#: 3D Bitmap transformation in Windows Store App

In my Windows Store App, Id like to do a 3D transformation to an image and blit it onto another image. The image should be transformed in a way so that the four corners end up on four predefined coordinates in the second image. Example: A user can copy his own image into a photo of a poster hanging on a wall, where the photo is not taken at a 90 degree angle.

Is there a framework for doing these kinds of 3D transformation or can someone show me how to do this with matrices-math? I have a basic understanding of how a transformation matrix can work, but how to calculate one myself is beyond my knowledge.

Btw for blitting Im using the WriteableBitmapEx framework.

There is a Projection property on every UIElement , which for basic 3D transforms you set to a PlaneProjection object (which has properties like RotationX , RotationY and RotationZ ):

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.uielement.projection.aspx

If you want to apply complex math, you can set it to Matrix3DProjection :

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.media.matrix3dprojection.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM