Log in or register to post comments

Working with 2 Cameras

September 6, 2013 - 7:34am #1

Hi,

i am trying to use two cameras to create 3d stereo vision. 

the problem i face is:

i am adding a second camera to the AR camera. but this second camera need to have its own image plane for the the 2nd webcam, but i can't filter the webcam background thats created buy the camera.

also, when i do split screen for the two cameras by putting one at -0.5 and other one at 0.5, the AR object is off, it is not ontop of the marker anymore but seems to be off by the amount i shift the camera.

anyone can help me on this? thx

Working with 2 Cameras

January 28, 2015 - 5:59pm #24

send me a we transfer of your project, lets pool our resources see if we can crack this

Working with 2 Cameras

January 28, 2015 - 2:58am #23

If i diable the camera switch on the partent AR camera my app renders a solid blue screen.

any chance i could have a copy of a working project lol... 

 

Working with 2 Cameras

January 28, 2015 - 2:58am #22

If i diable the camera switch on the partent AR camera my app renders a solid blue screen.

any chance i could have a copy of a working project lol... 

 

Working with 2 Cameras

January 19, 2015 - 7:07am #21

Hi!

 

I am also interested in this topic and use the suggested script to clone the Background Plane.

Right now I am only on PC and already facing problems. For me the Augmented objects are created only once. So it is somehow the opposite of the other problems.

I probably have something wrong because I do not get this:

 

I disabled the main AR camera, added two children set to half width in the viewport at the same position.

 

How can the main camera be disabled, but the children not?

 

Appreciate any help. Also I want to build for Android and would be interested in any other soultions.

AttachmentSize
Image icon Unbenannt.PNG505.62 KB

Working with 2 Cameras

June 5, 2014 - 7:54am #20

Thanks for your responses!

I just checked the scene out on runtime and apparently the script posted below in this thread does exactly what you suggested - it duplicates the plane that has the camera stream applied as a texture. And as I said it works perfectly when I run it on my computer i just dont understand why it won't work on my android phone (which is my target device).

Any ideas? Would it be helpful if I post a screenshot of my scene setup ?

//EDIT:

I guess the problem is that Vuforia does not create the "BackgroundCamera(Clone)" object on mobile devices as it does on computers and, therefore, the script isn' working. Any suggestions how Vuforia handles this on mobile devices? Is the plane just called differently or is it a different workflow?

Working with 2 Cameras

June 3, 2014 - 10:03am #19

Hi all, 

It is amazing to see people still contributing to this topic. 

I have been away from vuforia and unity for a long time. but i think i had another way of slipting the screen.

from what i remember, vuforia is using the camera input purely as a background. 

im not sure if you guys tried with stereo webcam on pc yet. basiclly you can put two cameras masking two different plane and each plane is beeing texutured by each webcam. 

i think this can actually be used here, you can put the vuforia camera feed into a texture(maybe create another camera to just look at the camera background vuforia creates), and then use this texture to texture both plane(since they are the same, you can just use one). 

not 100% sure if this will work or not. if you guys are interested, give it a try and let me know if i can help

Working with 2 Cameras

June 3, 2014 - 9:49am #18

same problem here, though I gave up this project in April... 

Working with 2 Cameras

June 3, 2014 - 9:11am #17

Hi @WPCJack

Your script is working pretty well for me - thanks alot! When I run my scene on my computer everything is working fine, but when i run it on my Android phone you can see the model properly (twice) but the video stream of my camera is still shown in fullscreen (not in splitscreen as the model).

Computer:

Phone:

 

Do you have any idea how to fix this?

Thanks a lot!

Working with 2 Cameras

April 6, 2014 - 8:47am #16

Hello,

I advanced a lot using the descriptions and helps in this topic (thanks to FabulousPixel pointed to this) but stopped at the following status:

I have the two sides with working Target recognition. My right camera still hasnt the proper size, even after changed the mentioned orthographicSize to 1, it is still smaller, not just in height but in width. It is true in Unity on PC in play mode.

My greater problem that I lost the camera input entirely if I build the application to Android, to my Samsung SII phone. The AR recognition still works because I see the augmented 3D model if I hold the phone to the proper direction towards the image target, but I havent camera image, just black background.

Anyone maybe had similar problem and successfully solved it?

thanks,

Gabor

Working with 2 Cameras

January 2, 2014 - 9:59pm #15

Hey all,

I disabled the main AR camera, added two children set to half width in the viewport at the same position.

Had a similar thing where the camera freezes if you copy it, probably something in the dll.

This is for a single camera and seems to work, add this code to the ARcamera.

using UnityEngine;
using System.Collections;

public class StereoscopyHack : MonoBehaviour
{

		float delay = 1f;

		void Update ()
		{
				delay -= Time.deltaTime;
				if (delay < 0) {
						GameObject bCamGo = GameObject.Find ("BackgroundCamera(Clone)");
						if (bCamGo != null) {
								GameObject plane = bCamGo.transform.GetChild (0).gameObject;
								plane.transform.localScale = new Vector3 (.5f, 0, plane.transform.localScale.z);
								plane.transform.localPosition = new Vector3 (-.5f, 0, plane.transform.localPosition.z);
								GameObject newPlane = Instantiate (plane) as GameObject;
								StartCoroutine(FixPlane(plane, bCamGo));							
								delay = 999999;
						}
				}
		}

	IEnumerator FixPlane (GameObject plane, GameObject bCamGo)
		{
				yield return new WaitForSeconds(.1f);
				GameObject newPlane = GameObject.Find ("Plane(Clone)");
				newPlane.transform.parent = bCamGo.transform;
				newPlane.transform.localScale = new Vector3 (.5f, 0, plane.transform.localScale.z);
				newPlane.transform.localRotation = plane.transform.localRotation;
				newPlane.transform.localPosition = plane.transform.localPosition;
				newPlane.transform.localPosition += Vector3.right;
				this.enabled = false;
		}
}

The code is a bit nasty, I just needed a quick fix.  

Good luck

Working with 2 Cameras

November 11, 2013 - 7:12am #14

Hmm, i think your problem now is the ratio of movement of the AR object, I don't remember how I did it, but i think the FOV of the camera can change that

Working with 2 Cameras

November 10, 2013 - 4:53am #13

Thank you!

Here is the way I make it work:

Disable the camera inside the AR Camera and add two camera to it. Clear Flags set to Depth. Right Camera x = 0.63.

Added two BackgroundCameras for the video background. Set the Normalized Viewport rect for the left camera to -0.5 and the right camera to 0.5.

Deleted the plane from the right camera because I only use one webcam. And added the VideoTextureBehaviour script to the left plane.

For the height I deleted the  m_Camera.orthographicSize from the scripts and set it manual to 1 for both BackgroundCameras.

The problem is now, because of changing the orthographicSize, the AR camera and the BackgroundCamera haven't the same view angle and the teapot moves faster one the imageTaget as the imageTaget moves on the video stream.

May I have to test different view angels for the AR Cameras.

 

Working with 2 Cameras

November 7, 2013 - 7:34am #12

Hi, 

First, make sure u have clear Flags set to Depth only for the two cameras under ARcamera,

for the size problem, I think what i did was copy the BackgroundCamera thats in the sence, not from Qualcomm folder. There might be some difference between them. and if you want to change the size, inside NegativeGrayScaleVideo theres a script called Video Texture Behaviour.

inside that, serach for

 m_Camera.orthographicSize = visibleHeight or something.

and make it equal to 1;

that will turn off the auto fitting screen. 

you don't have to use two BackgroundCamera, for my project, when i use two webcam, i put the other webcamtexture on a plane i created myself. but if you are only using one webcam or the phone, you need to dig out the webcam texture from Vuforia scripts, and that will take some time. so i just add another backgroundcamera because it automatically take the texture fromthe same camera you asign to vuforia inside ARcamera. 

Let me know if you have any more questions,

thx

Working with 2 Cameras

November 7, 2013 - 5:02am #11

Hey!

Thanks for your response.

 I tested many combinations of camera settings.

Sometimes there was a target recognition with one camera, somtimes I got a recognision with both cameras but without any video stream.

 

To find possible problems, here is your soultion I tried based on the background image access sample:

"disable the camera inside the ARcamera"     http://www.abload.de/img/1ejppl.png

"add two camera to it" http://refkiller.de/redirect.php?url=http://www.imagebanana.com/view/g6zp13f4/2.2.png   (left -0.5, right 0.5) May the "Projektion" should be changed?

"add another BackgroundCamera"   http://www.abload.de/img/3tfoed.png

 

 
On a mobile phone it looks like this:
 
 
 

 
Why is the left  camera on max height? Both should be like the right camra.
Do I realy need two BackgroundCameras? There is only one textured plane which can be used by two cameras, isn't it?
How do the two new cemaras depend on the video stream?

 

Working with 2 Cameras

November 5, 2013 - 7:22am #10

Hi, 

Im sorry i can't upload my project, but i will help you on that. can you tell me more about your problem?

Working with 2 Cameras

November 5, 2013 - 7:05am #9

Hi!

Can you upload your Unity project?

I tried your solution, I can see 2 camera streams but the recognition of a taget does not work.

Working with 2 Cameras

October 23, 2013 - 8:37am #8

Keep in mind that the Unity scene is going to inherit the unit scale you define by the target width. Unity's default unit is a meter, but Vuforia overrides that and sets a custom scale. Though I'm not sure if that will have any affect on your application.

Working with 2 Cameras

October 23, 2013 - 8:31am #7

Yes, since unity scale is 1:1 meter, i offset it to 0.63, but i didn't offset the backgroundcamera

Working with 2 Cameras

October 23, 2013 - 8:06am #6

Thanks for the follow-up. Did you need to offset the cameras from each other?

Working with 2 Cameras

October 16, 2013 - 12:01pm #5

Quick solution to my own problem.

based on the background image access sample. 

first, disable the camera inside the ARcamera. add two camera to it.  one for each eye, and add another backgourndcamera, one for each eye too.

for my application i change the ratio to one. 

Working with 2 Cameras

October 9, 2013 - 3:21pm #4

Working with 2 Cameras

September 6, 2013 - 8:41am #3

thx, i did find some posts about this problem, but they didn't seem to have the image shift issue, i will look into background texture access, thank you again

Working with 2 Cameras

September 6, 2013 - 8:32am #2

For complex render setups we recommend using the Background Texture Access of rendering the Video feed.

It's worth searching the forums as there have been quite a few threads about this recently.

 

N

Log in or register to post comments