Skip to content

Commit b01cb8c

Browse files
authored
Merge pull request #18 from AIRLegend/dev
Documentation update and Delay on open fixed
2 parents 9e455e1 + f130824 commit b01cb8c

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed

Client/src/camera/OCVCamera.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ OCVCamera::OCVCamera(int width, int height, int fps) :
66
size(width, height),
77
cap()
88
{
9+
CV_BACKEND = cv::CAP_DSHOW;
910
if (!is_camera_available())
1011
{
11-
throw std::runtime_error("No compatible camera found.");
12+
// Check again with Media foundation backend
13+
CV_BACKEND = cv::CAP_MSMF;
14+
if (!is_camera_available())
15+
throw std::runtime_error("No compatible camera found.");
1216
}
1317
is_valid = true;
18+
cap.set(cv::CAP_PROP_BUFFERSIZE, 1);
1419
}
1520

1621
OCVCamera::~OCVCamera()
@@ -22,7 +27,7 @@ bool OCVCamera::is_camera_available()
2227
{
2328
bool available = false;
2429

25-
cap.open(0, 0);
30+
cap.open(0, CV_BACKEND);
2631
available = cap.isOpened();
2732
if (available)
2833
cap.release();
@@ -32,7 +37,7 @@ bool OCVCamera::is_camera_available()
3237

3338
void OCVCamera::start_camera()
3439
{
35-
cap.open(0, 0);
40+
cap.open(0, CV_BACKEND);
3641
if (!cap.isOpened())
3742
{
3843
throw std::runtime_error("No compatible camera found.");

Client/src/camera/OCVCamera.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class OCVCamera : public Camera
77
private:
88
cv::VideoCapture cap;
99
cv::Size size;
10+
int CV_BACKEND;
1011

1112
bool is_camera_available();
1213

Doc/USER_GUIDE.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# User guide
1+
# User guide: Setup, common problems and tips
22

33
## Configuring opentrack and AiTrack
44

@@ -14,7 +14,7 @@ Example of Opentrack configuration:
1414
![](../Images/OpentrackConfig.png)
1515
![](../Images/OpentrackConfig1.png)
1616

17-
Then, on AITrack, just click "Start tracking". The program will use the default configuration, which assumes that opentrack is on the same machine and it's listening port is 4242 (Opentrack's default). In case you want to use other config, just change it on AITrack and save it.
17+
Then, on AITrack, just click "Start tracking". The program will use the default configuration, which assumes that opentrack is on the same machine and it's listening port is 4242 (Opentrack's default). In case you want to use other config, just change it on AITrack and save it. After that, just click "Start" in Opentrack.
1818

1919

2020
## Common problems
@@ -24,18 +24,21 @@ Then, on AITrack, just click "Start tracking". The program will use the default
2424
- If you find your view on the game making "strange jumps":
2525
- Look at the video preview on AITrack and confirm the facial landmarks are correctly positioned.
2626
- If not, check your illumination, and the angle your have your camera.
27-
- If the landmarks are recognized correctly try fine-tunning the distance parameter on AITrack.
27+
- If the landmarks are recognized correctly try fine-tunning the distance parameter on AITrack. (Don't forget to click **Apply** each time you make any change).
2828

2929
- If the view makes "jumps" when you move your head try adjusting the curves on Opentrack (`Mapping` button).
3030
- See **Tips** section
3131
- Here is a video with some tips https://www.youtube.com/watch?v=u0TBI7SoGkc on how to configure your curves.
3232

33+
- If you move left/right my your goes up/down:
34+
- You have to flip your X and Y axes in Opentrack (see screenshot above: Options>Output).
35+
3336
## Tips
3437

3538
Based on the testing made so far, here are some recommendations for getting the best performance:
3639

3740
- Configure well your movement curves on Opentrack. Leave a little "dead zone" at the beginning of each curve and use the asymetric mapping feature for "Pitch".
38-
- Position your camera at about 0.5-1 meters horizontally from your face.
41+
- Position your camera at about 0.5-2 meters horizontally from your face.
3942
* It's better if the camera is directly in front of you, but it doesn't mattter if you have some lateral offset.
4043
- The camera should be, approximately, at about your nose-level. Good positions are on top of our monitor, or at its base.
4144
- You shouldn't need to touch "Initial parameters" on AITrack. If you find the tracking is not accurate, fine-tune "Distance" parameter only to the actual value (distance from your face to the camera, in meters).

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,23 @@ AITrack uses its own tracking pipeline (based on neural networks) to estimate th
2828
5. Run `AITrack.exe` from AITrack and click "Start tracking".
2929
6. Look around!
3030

31+
### But... I don't have a webcam :(
32+
33+
No problem. This program supports [Droid Cam](https://www.dev47apps.com/), so you're able to use your smartphone as a camera.
34+
35+
### My webcam is too old
36+
37+
Don't worry. AITrack supports low resolutions pretty well. Anything achieving at least 30fps and 480p will do the job fine.
38+
39+
---
40+
3141
**IMPORTANT:**
3242
In case you want to know more, please, head to the `Doc/` directory to find guides about usage. If you can't find there what you're looking for, feel free to post your question on the [issues page](https://github.com/AIRLegend/aitracker/issues).
3343

44+
---
45+
3446
## Showoff videos
35-
[] TODO
47+
[<img src="https://img.youtube.com/vi/6uhcg43o7tc/hqdefault.jpg" width="50%">](https://youtu.be/6uhcg43o7tc)
3648

3749

3850
## Bugs and Contributing

0 commit comments

Comments
 (0)