Topic locked

image distortion mode_optimize_quality

October 2, 2014 - 10:16am #1

Hi,

 

I have an app that use the VideoTextureBehaviour, and when I use the Camera device mode, I obtain several results.

I'm using and ipad air (resolution: 2048x1536).

In the VideoTextureBehaviour.cs:

the Debug textinfo says this, in several case of Camera Device mode in:

Camera device mode: MODE_OPTIMIZE_QUALITY   -> VideoTextureInfo 2048  1024  1280  720    => relation aspect texturesize 2  ---  relation aspect ImageSize 1.777  => THIS IS INCORRECT ?¿?

 

Camera device mode: MODE_OPTIMIZE_SPEED -> VideoTextureInfo 1024  512  640  480    => relation aspect texturesize 2  ---  relation aspect ImageSize 1.333  => THIS IS CORRECT

The mapping videotexture in the object it's correct if I have the MODE_OPTIMIZE_SPEED, because the original resolution ipad air 2048x1536 has 1,333 ratio aspect.

how can configure the MODE_OPTIMIZE_QUALITY with the 1,333 ratio aspect.??¿?

Thanks.

 

public void UpdateBehaviour()
    {
        if (mVideoBgConfigChanged && QCARRenderer.Instance.IsVideoBackgroundInfoAvailable())
        {
            // reset the video texture:
            if (mTexture != null)
                Destroy(mTexture);
            
            CreateAndSetVideoTexture();
            
            QCARRenderer.VideoTextureInfo texInfo = QCARRenderer.Instance.GetVideoTextureInfo();
            
            // Cache the info:
            mTextureInfo = QCARRenderer.Instance.GetVideoTextureInfo(); ;
            
            Debug.Log("VideoTextureInfo " + texInfo.textureSize.x + " " +
                      texInfo.textureSize.y + " " + texInfo.imageSize.x + " " + texInfo.imageSize.y);

image distortion mode_optimize_quality

February 25, 2015 - 9:20am #8

Do you know when to support 2048*1536 (1.33) resolution for most iPad devices?

No, I do not know when that might happen (probably not in the very near future). No timeline available at present.

 

Does vuforia 4.0 final release could include this feature?

As far as I am aware, the 4.0 final release will support HD up to 720p (1280 x 720), although I cannot exclude that this might be raised further in the future.

UPDATE:

4.0 is now available, and you can download it from:

https://developer.vuforia.com/downloads/sdk

https://developer.vuforia.com/downloads/samples

 

Before upgrading, make sure to read the migration guide:

https://developer.vuforia.com/library/articles/Solution/Vuforia-40-Migration

 

image distortion mode_optimize_quality

February 24, 2015 - 7:10pm #7

Hi Alessandro, 

Do you know when to support 2048*1536 (1.33) resolution for most iPad devices?

Does vuforia 4.0 final release could include this feature?

Thanks,

Felix

image distortion mode_optimize_quality

October 20, 2014 - 9:40am #6

Ok, thanks for clarifying.

Selecting a different Camera Mode (SPEED vs DEFAULT vs QUALITY) results in selecting different camera resolutions (as you have also observed).

Each camera resolution corresponds to one of the (several) camera images that the underlying device camera can deliver. The aspect ratio is determined by the resolution of that image. 

Once this is selected. there is no way to enforce a different aspect ratio. For example, if the image selected is at 1280x720 (like in your example), the aspect ratio will be 1,77.

Vuforia will only be able to give you an HD at 1,33 if this is available in the list of supported resolutions of the underlying device camera. Note that HD resolutions on modern device typically are at 16:9 or 16:10 aspect ratios, i.e. the 1,33 resolution is not so common for HD resolution; 

for example, these are 2 common HD formats :

1280 x 720 => aspect ratio = 1,77

1920 x 1080 => aspect ratio 1,77

 

Note: the 2048x1536 resolution has 1.33, however this resolution is currently not supported in Vuforia.

 

 

 

 

image distortion mode_optimize_quality

October 18, 2014 - 2:17am #5

Hi Alessandro, 

thank you very much for the answer but I'm refering to this.

How can obtain a 4:3 aspect ratio videotexture with high quality seems to native. ?

I tested and tested and tested and searched and I find this post that one people answer similar.

https://developer.vuforia.com/forum/android/generate-43-camera-texture

So...why vuforia returns diferent aspect ratios dependiing the mode? 

I tested the math, and they are correct, but I thing that "the problem" comes from the video iniatialization.

In the ipad resolution you have :

2048x1536 from the screen a.r: 1,333

1280x720 from the device camera: a.r: 1,777

If I run the videobackground in mode_optimize_speed I obtain a texture of 640 x 480 a.r: 1,33(you can code this in the previous post).

If I run the videobackground in mode_optimize_quality I obtain a texture of 1280x720 a.r:1,77

I want to capture the marker from this texture to apply after to a model, but it works in 4:3 relation aspect, but not in 16:9.

Here you have an example:

https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/camera-patch-unity

I have checked all the before code, and finally I think that the problem comes from the "way" how vuforia gives the video.

For this motive, if we can give a HD 1,33 aspect ration stream, it will works.

 

Thanks in advance,

Alvaro

 

 

image distortion mode_optimize_quality

October 13, 2014 - 8:11am #4

Hi,

not sure what is your question here.

The Videobackground Texture size and the device screen resolutionin general do NOT have the same aspect ratio. This is normal and expected.

In fact, the Vuforia background rendering is done in a way such that the background video texture is scaled so that the visible (on screen) portion of it is not stretched (and as a consequence of this, part of the texture will be then rendered ouside the screen space... this is precisely meant to avoid image distortion).

If you look at the BackgroundTexture Access sample code, you will be able to see the maths involved with the background image scaling. 

For example, suppose you have a screen resolution (e.g. in landscape mode) of 2000 x 1000 (aspect ratio = 2), and a background video texture size of 1500 x 1000 (aspect ratio = 1.5);

the video texture in this example has a smaller aspect ratio than the screen (1.5 < 2); however we cannot  modify the aspect ratio of the texture to magically become 2 (otherwise we would introduce a deformation). So, we need to keep it at 1.5, but we also need to scale the texture up so that it fits the screen entirely.

This means that we need to scale up the texture width from 1500 to 2000 (to fit the screen width entirely); however, since we don't want to touch the aspect ratio, we will also have to scale up the texture image height by the same amount (i/e/ by a factor = 2000 / 1500, i.e. 1.33) ===> so, the texture height will be scaled from 1000 up to 1333; we would then end up with a texture rescaled to 2000 x 1333.

As you can see, the 2000 x 1333 will fit the screen (2000 x 1000) entirely. However, there is an exceeding 333 pixels in the height direction (i.e. 1333 - 1000) with respect to the screen height. Those 333 excess pixels will simply be falling outside of the screen.

Note that this approach is mathematically correct (and has always been the same acrosss all versions of Vuforia) in that it meets 2 requirements simultaneously:

- to fit the screen entirely (otherwise we would have black side bands)

- to avoid image distortions (i.e. avoid changing the aspect ratio)

 

Note: this general principle applies regardless of the camera MODE that you have selected (the only difference is that each MODE may result in different texture resolution, and so the actual "numbers" wioll change accordingly).

I hope this answers your question.

NOTE:

you can always change this behaviour by modifying the BTA sample code (the maths are just there in the code, and you are free to change them the way you want, if the conditions above do not meet your own app requirements).

 

 

 

image distortion mode_optimize_quality

October 13, 2014 - 7:43am #3

Hello... Alessandro? Any comments about this?

Do you have an upgrade soon? or someting similar?

 

thanks...

 

Alvaro

image distortion mode_optimize_quality

October 6, 2014 - 1:34am #2

really? nobody? I will apreciate if somebody says anything.. I think that this affect directly to vuforia no?

Topic locked