Skip to content

Connecting a camera

ju1ce edited this page Nov 24, 2021 · 14 revisions

Connecting a camera

The first step is connecting a camera feed to you computer, refine its parameters and check whether it meets the requirements for good tracking. You can also use a phone.

OPTIMAL CAMERA FEATURES:

  • Resolution: A resolution of 720p is usualy optimal. 480p can work, but you will have reduced range of detection.
  • FPS: While 60fps can help, it is not necesary. 30fps cameras are enough.
  • FOV: Any will work, but low FOV cameras will reduce your play space. 90° or more is preferred in order to cover your whole playspace if you put it into a corner.
  • The most important feature of your camera is MANUAL EXPOSURE CONTROL. Not having this feature means that your camera will have motion blur, which will break detection when you move.

Try whatever camera you have before buying any specificaly for this!

Best camera app for Android: IP Webcam Best camera app for Iphones: iOS Camera for OBS Studio

This step is probably the most complex, since you will have to find out what works best for you. Each of the methods has its pros and cons, so try them out and see what works best. If you know of any other option, feel free to use that!

This tutorial only outlines the methods to connect a camera, and their pros and cons. If you have problems related to these, you should refer to their official tutorials. You should get it working before continuing with the tutorial.

A quick comparison of diffrent methods can be found in the Camera method comparison

Tutorial

Below are tutorials for USB webcams, and for the Android app IP-Webcam. Make sure you get it working as optimal as you can before continuing!

To select which camera to open, use the IP/ID of camera parameter. To check whether it is opened properly, press the Open camera button and check the Camera preview checkbox.

Don't forget to set the Quad decimate parameter as well! Good values are 1 for 480p, 2 for 720p and 3 for 1080p. You will refine this parameter later.

start_camrea_button

When camera is opened properly, you will see its resolution and fps in the upper left corner. Make sure it is correct!

camera_preview

There is one more parameter to look at - you can check the Rotate camera parameters to rotate the camera sideways. This will give you more vertical space, meaning you can be closer to the camera. Check both clockwise and counterclockwise to turn it 180°.

USB webcam specific parameters

For usb webcams, the ID/IP of camera will be a number, like 0,1,2 etc. Try a number, save, and attempt to open camera until you find the correct one!

When you find the correct camera, we now have to set the settings correctly. In the params tab, set the camera width and height to the resolution of your camera (1280/720 or 1920/1080 for hd and full hd, but check for your camera specificaly!), and set the FPS if it is more than 30.

Second, you want to set Camera API to 700 and check the Open camera settings parameter. This should give you more control over your camera. Next time you open the camera, the following window should open:

camera_gain

camera_exp

Set exposure to -8 (or at least -7) and gain as high as you have to so the image is bright enough. Put it to max if you have to!

If the option is greyed out, your camera probably doesnt support manual exposure.

Camera doesnt open if I use API 700!

Use Camera API preference of 0 then, it will still work fine. You do lose the ability to change exposure using the Open camera settings parameter, however, meaning you will have to use other methods to set exposure, described below.

Camera is low FPS if I use API 700!

Usualy, reducing the camera resolution to 720p should be enough. Alternatively, you can use API preference of 0. You do lose the ability to change exposure using the Open camera settings parameter, however, meaning you will have to use other methods to set exposure, described below.

Camera doesn't open no matter the parameters

If camera doesn't open, first step is to plug the camera into another USB port. Try both API preference 0 and 700. If nothing works, you may have to open the camera through OBS, and then bridge the stream into ATT from there using the virtualcam plugin. (you NEED the virtualcam plugin, not the built in virtual camera!)

Alternative methods of setting exposure

If you cannot use the Open camera settings paramter, you may try the last 4 options in the Camera parameters section. Check Enable next 3 parameters, set camera autoexposure to 0, camera exposure to -7 and camera gain to 255, and try to open the camera. You should notice a diffrence if it worked properly.

Some cameras also come with software that allows setting exposure and gain - if you have that, you can use it as well.

IP Webcam specific parameters

For IP Webcam, you can set resolution in the app - try to have a 4:3 aspect ratio, around 800x600 works best. Use portrait mode if you use all three trackers, and landscape

In the downloaded folder, in /utilities, there is a set_exposure.bat script. Edit it, writing in your cameras IP adress, and the desired exposure - test a few to find the one with the best brightness, but it should be under 10 ms, or 10000 ns.

Running this script will now set the exposure of your phones camera, if your phone supports it.