**0**

# Need some suggestions about transforming a projected image

###
#1
Members - Reputation: **196**

Posted 02 April 2014 - 07:14 PM

I have an image outline of lips (please find attached picture) that shows the projection on xy plane when aligned. Now from that projected image is it possible to get the straight look as shown in the bottom of figure? What information do I need to get the straight image at bottom from the aligned image at top.

Please provide me some suggestions.

Thanks in advance.

###
#3
Members - Reputation: **777**

Posted 03 April 2014 - 11:25 AM

Do you have the model itself, of just a flat two dimensional projected version of that mouth?

I will assume that you don't have the model here...

As Stainless is saying, it would be a problem to get right. My initial intuition tells me to make some sort of software that traces the edge of the drawing plus adding a imaginary z coordinate to each "corner" of the mouth. If you get this right, you would theoretically be able to rotate the object afterwards to get the representation you want. Of course, things that are out of sight/obscured won't work, and it may distort the result a bit, but I can picture ways to do what you want, if I am guessing right in what you are asking.

What I am saying is to try to estimate somehow the coordinates in the projected state and reverse that somehow. Basically what is missing is the Z coordinate and distortion due to perspective that you have to reverse. I doubt the perspective has that much impact on such a small scale, however, but I have never experimented with these kinds of things before, just had a lot of thought experiments in my head.

I don't think you can do this 100% without any distortion, but I have a feeling you can still get good results.

###
#5
Members - Reputation: **777**

Posted 03 April 2014 - 12:29 PM

If you only have the model for the projected version, and the model is a big complicated one, I don't think this will be an easy task. Some part of the model that you will need for the straight facing one, will always be obscured or out of the view somehow. That information does simply not exists, thus you have to recreate it somehow. Algorithms for doing so is way more advanced than I can do, but I know there does exist algorithms that fill in the missing parts in a believable way. I think Adobe showcased something a few years back, for instance. Unless you are math savvy, I think this is a tough job, if your model is complicated. It may be feasible if your model is simple, though.

If only you had some 3D representation... But then you would probably not have asked the question here...

**Edited by aregee, 03 April 2014 - 12:31 PM.**

###
#6
Members - Reputation: **128**

Posted 03 April 2014 - 05:42 PM

At first i need to let you know that i am totally new to game developement and that English is not my first language, so it might be that 1. i misunderstood your question or 2. you do not understand my point because i am not able to express it properly in english.

As i have understood it, your problem has a mathematical nature: How can i determine the coordinates of original image with the information given by its projection.

My suggestion is based on two assumptions: 1. The projection results from a rotation around the y-axis and 2. you can to a certain extent estimate the original length of the mouth (the x-coordinate of the right "corner")

The projection of an object can often be described via affine transformations. These affine transformation can be compared to function, you enter a vector and this vector will, according to a specific law, be transformed into another one. Keep in mind that this is only an approximationthat depends on how wellthe original length can be guessed.

We consider the left corner of the mouth as fix in B(0/0/0), while the right corner is moved from A(x_{1}/0/0) to A'(x_{2}/0/z). Now we change our perspective and consider the scene from above, looking at the x/z-plane. The mouths appear as straight lines. Imagine a line that goes through the projected right corner (A') and perpendicularly intersects the line of the original mouth. Then the angle of rotation is cos^{-1} (x_{2}/x_{1}),the inverted cos of the length of the projection (which is given) divided by the original lenght (which you have to estimate). If this approximation delivers you a plausible angle of rotation, which, in combination with some further algebra (there is a general formula for rotations in affine transormations) will help you determine the exact coordinates.

Please excuse my sometimes confusing English and eventual mathematical inaccuracies. It is after midnight and i am extremely tired but this problem caught me and i hope that i could help you.

###
#7
Members - Reputation: **777**

Posted 03 April 2014 - 09:25 PM

BMU: I think you are spot on. That is what I tried to communicate too in my previous post, and while this method will probably work on small scale objects, I don't think you can ever do this in reverse without any distortions (no matter the scale).

The reason I say it may work on small scale, is that the distortion you get, probably won't be that big, and you may be able to do some manual tweaking to get a good result, but on a more complex model, it may be a massive job to reconstruct a 3D model from a 2D one. Remember that when you rotate an object (and apply perspective), you lose some information that is rotated outside of what you can see and even perhaps behind parts of the object too. Take a nose as an example. The nose sticks out. When you rotate, the nose will cover part of the image. Although not exactly the same, you lose information in kind of the same way you do with lossy compression. You can't reverse the operation to get a perfect version of the original alignment, but you may be able to manually tweak the result afterwards somehow, but this will probably be a massive job on a large scale model.