How to control the camera output?

0 votes
asked Feb 11 by ndmrzk (390 points)
Hi. I am using EasyAR 3.0 basic. We are using the camera function and we would like to control the output of the camera. Now, when we "switch on" the camera, the output is what the camera sees and when we use easyarCamera.stop(); easyarCamera.close(); the camera stops/switches off but a still image from the output is still visible.

From inspection, every time the camera gets switched on, in the editor, in the inspector a new line appears at the bottom of the camera component : 1 command buffers BeforeForwardOpaque: unnamed command buffer (120 B). If we remove it manually, then the camera output no longer shows and have to stop/play the game view. if we remove command buffer via script, the camera does not work.

This isn't such a huge issue but the camera feed lags a few seconds to start after just using easyarCamera.stop(); easyarCamera.close(); and that is not a very nice user experience.

Please advise on how to overcome this.

2 Answers

+1 vote
answered Feb 18 by rlmidiaalvs (2,420 points)
selected Feb 18 by ndmrzk
Best answer

Hello ndmrzk!

As grissankara said, use EasyAR 3.1.0 insteady 3.0.1. See this guide to configure easyAR3.1.0.

After that, you need to download the samples. Then, open:

Assets -> Samples -> Scenes -> DeviceSupport -> Camera_VideoCamera.unity.

Find "VideoCameraDevice" prefab in the scene and you will see VideoCameraDevice.cs script.

Inside this script you will have functions like:

Open(); Close(); ...

Call this function to open or close the camera. See the VideoCameraSample.cs to understand more.

 If you need more help, tell me.

Have fun! Hehe

commented Feb 18 by ndmrzk (390 points)
yup! i got it to work. Didnt realize the samples were a separate download. Thank you!

Also, if anyone were to stumble on this and was trying to figure out how to not have the camera to start on play. there is a script called CameraSource.cs. comment out the Open() in the protected virtual void Start() function. Then u can use a button or however to control the camera via the open close (like rlmidiaalvs said) from VideoCameraDevice.cs.
0 votes
answered Feb 11 by grissankara (690 points)
Use Easyar 3.1 otherwise u get problem like this...

commented Feb 11 by ndmrzk (390 points)
Okay. But there are no sample scenes? How do i setup the easyar? Same as 3.0? ARSession scripts are different. For center mode do i change it to camera? Or keep it as first target?

Instead of ImageTrackerBehaviour use ImageTargetController?

Anyway, a lot has changed and listing them doesn't seem productiv. Seems like it gives more control but the documentation  has not been updated ( As the title says, it is WIP. Unless you can help me out on setting up.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.