Log in or register to post comments

Image deformation

February 4, 2014 - 2:19am #1

Hi,

I've followed the following posts :  image access, camera target patch and camera pstch for unity3D

I've succeeded to get the camera image and i've copied it into a GUITexture. Then I've collected the coins position  of my target Image into the ScreenView.
 
My questions are :
 
 1 - How can I pass from this to that ?
 
 2 - Is it a good way to get the image that I want or does it exist a best way to do that?
 
 
Thanks by advance for your reply.
AttachmentSize
Binary Data bytes
Binary Data bytes

Image deformation

September 11, 2014 - 2:35am #7

hey

I am also tring to do the same. but my aproach was of elecman, but i didnt even succed to get the target image from the entire scene. It will be of great help if you can tell me what is your approach on this and how to wrap the texture on the 3d model. thanks in advance.

Image deformation

September 8, 2014 - 3:10am #6

That's because the target transform component has a localScale set to the Target dimensions; so, in the local reference frame of the target, the target width is actually spanning between -0.5 (left border) and +0.5 (right border).

Same for the height, except that you need to divide by the aspect ratio of the target, because the localScale is uniformly set, but the image target is a rectangle (where height = width / aspect ratio).

Hope it makes sense.

 

Image deformation

September 8, 2014 - 3:02am #5

Hi,

 

I'm following the steps from How can I get target screen coordinates, but I can't undestand why using:

 

// We define a point in the target local reference 
// we take the bottom-left corner of the target, 
// just as an example
// Note: the target reference plane in Unity is X-Z, 
// while Y is the normal direction to the target plane
Vector3 pointOnTarget = new Vector3(-0.5f, 0, -0.5f/targetAspect); 

 

is taking the bottom-left corner of the image target.

Image deformation

February 4, 2014 - 6:49am #4

 Is it possible (in C# and with unity) to get juste the image target area (in the screen view) and put it into a texture ?

 Yes, if you manage to cut the part of the camera image (based on the 4 corners in screen cordinates, as I was mentioning),

then you should be able to extract the image within the trapeziod boundaries defined by the 4 corners in screen space.

Then once you have that image, you can build a texture in C# and Unity, for instance using the Texture2D.LoadImage() function: 

http://docs.unity3d.com/Documentation/ScriptReference/Texture2D.LoadImage.html

 

 

Image deformation

February 4, 2014 - 6:27am #3

AlessandroB wrote:

One thing you could do is to compute the screen coordinates (in pixels) of each of the 4 corners of the image target that is in your camera fieled of view.

I already have compute the screen coordinates of each of the 4 corners in my camera view.

 

AlessandroB wrote:

Then, once you have the screen coordinates of those 4 points, you could implement some sort of deformation filter that turns the "trapezoid" shape into a rectangle, by extracting the relevant pixels.

It's this step that I try to do.

 

AlessandroB wrote:

However, this kind of filtering techniques is beyond the scope of Vuforia and this Forum.

 

 I post this post in this forum because some people has succeeded to do this using the vuforia sdk.

 I've tried to understand the elecman's solution but it's too confused for me.

 

 Is it possible (in C# and with unity) to get juste the image target area (in the screen view) and put it into a texture ?

 The goal is to apply it then to a 3D model using UV mapping.

 

Image deformation

February 4, 2014 - 3:44am #2

Hi, one thing you could do is to compute the screen coordinates (in pixels) of each of the 4 corners of the image target that is in your camera fieled of view;

this article explains this:

https://developer.vuforia.com/forum/faq/unity-how-can-i-get-target-screen-coordinates

 

Then, once you have the screen coordinates of those 4 points, you could implement some sort of deformation filter that turns the "trapezoid" shape into a rectangle, by extracting the relevant pixels.

However, this kind of filtering techniques is beyond the scope of Vuforia and this Forum.

 

Log in or register to post comments