Skip to content

Commit f41ba89

Browse files
committed
Improve documentation
1 parent 56d1f7f commit f41ba89

File tree

4 files changed

+103
-58
lines changed

4 files changed

+103
-58
lines changed

CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ project(ImageGrabber)
33

44
set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6-
# set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic")
76

87
find_package(OpenCV REQUIRED)
98
include_directories(${OpenCV_INCLUDE_DIRS})

README.md

+85-14
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,100 @@
11
# Image Grabber
22

3-
Image Grabber allows you to capture images (JPG) or video (AVI) with multiple Basler USB Cameras at once. It logs all
4-
captured data to a CSV file for later use.
3+
Image Grabber allows you to capture images or video with multiple Basler USB Cameras at once. It logs all captured data
4+
to a CSV file for later use.
55

6-
## How to launch
6+
## Prerequisites
7+
8+
Tested on Ubuntu 20.04, may not work properly on other Linux distributions. This software is necessary for the code to
9+
compile and run properly.
10+
11+
* Compiler supporting C++17.
12+
* CMake 3.16 and higher.
13+
* [OpenCV library](https://opencv.org/).
14+
* [Pylon SDK](https://www.baslerweb.com/en/sales-support/downloads/software-downloads/installationnotes-pylon-6-2-0-linux-x86-arm/)
15+
(tested on version 6.2.0).
16+
17+
Devices supported are:
18+
19+
* [Basler ace USB 3.0](https://docs.baslerweb.com/basler-ace-usb-30) cameras
20+
(tested on acA2000-165uc and acA1920-150uc).
21+
22+
## How to use the app
723

824
In the project root folder:
925

1026
1. Build and compile: `make`.
1127
2. Run with arguments (see below), for example: `./ImageGrabber -v -f 60 -o "/myoutput"`.
12-
3. Exit the app with `Ctrl+C`.
28+
3. Exit the app with `SIGINT` or `SIGTERM` signal (`Ctrl+C`).
1329

1430
## Arguments
1531

16-
* `-R` (`--bwr`) - Set balance white (red channel), larger than 0 (default: auto continuous). (=1 red intensity
17-
unchanged, >1 intensity increased, <1 intensity decreased).
18-
* `-G` (`--bwg`) - Set balance white (green channel), larger than 0 (default: auto continuous). (=1 green intensity
19-
unchanged, >1 intensity increased, <1 intensity decreased).
20-
* `-B` (`--bwb`) - Set balance white (blue channel), larger than 0 (default: auto continuous). (=1 blue intensity
21-
unchanged, >1 intensity increased, <1 intensity decreased).
22-
* `-e` (`--exposure`) - Set exposure time in microseconds, range may vary (for example 28 - 1e7).
23-
* `-f` (`--framerate`) - Set framerate (fps) of recording (default: 25).
24-
* `-g` (`--gain`) - Set gain, range may vary (for example 0 - 23.59).
32+
* `-R` (`--bwr`) - Balance white (red channel), larger than 0, double precision, (default: auto continuous),
33+
(=1 red intensity unchanged, >1 intensity increased, <1 intensity decreased).
34+
* `-G` (`--bwg`) - Balance white (green channel), larger than 0, double precision, (default: auto continuous),
35+
(=1 green intensity unchanged, >1 intensity increased, <1 intensity decreased).
36+
* `-B` (`--bwb`) - Balance white (blue channel), larger than 0, double precision, (default: auto continuous),
37+
(=1 blue intensity unchanged, >1 intensity increased, <1 intensity decreased).
38+
* `-e` (`--exposure`) - Set exposure time in microseconds, range may vary (for example 28 - 1e7), double precision,
39+
(default: auto continuous).
40+
* `-f` (`--framerate`) - Set framerate (fps) of recording, double precision, (default: 25).
41+
* `-g` (`--gain`) - Set gain, range may vary (for example 0 - 23.59), double precision, (default: auto continuous).
2542
* `-h` (`--help`) - Show help.
2643
* `-i` (`--image`) - Save images instead of video.
2744
* `-o` (`--output`) - Set directory for video/image and log output (default: out), directories will be created.
28-
* `-q` (`--quality`) - Set image quality (only for `-i`) between 0 and 100, the higher is the better (default: 95).
45+
* `-q` (`--quality`) - Set image quality (use only together with `-i`) between 0 and 100, the higher is the better,
46+
integer precision, (default: 95).
2947
* `-v` (`--verbose`) - Print information about the camera state.
48+
49+
## Output format
50+
51+
Saved images are in JPG format.
52+
53+
Saved video is in AVI container.
54+
55+
Saved log information is in CSV file with format shown below. Each captured image on a separate line.
56+
57+
* `index` - Index of the captured image.
58+
* `mode` - Format of recording: `img` or `vid`, stays same for one log file.
59+
* `camera` - Camera identification number, stays same for one log file.
60+
* `file_path` - Path to the captured image or video.
61+
* `timestamp_in_ms` - System timestamp of the captured image in milliseconds.
62+
* `iso_datetime` - Datetime of the captured image in ISO format `YYYY-MM-DDThh:mm:ss.sss`.
63+
* `exposure_time` - Exposure time of the captured image.
64+
* `gain` - Gain of the captured image.
65+
* `white_balance_r` - Balance white (red channel) of the captured image.
66+
* `white_balance_g` - Balance white (green channel) of the captured image.
67+
* `white_balance_b` - Balance white (blue channel) of the captured image.
68+
69+
## Cameras configuration
70+
71+
Cameras can be configured using the arguments when launching the app. Settings are applied to all cameras. Default
72+
values for all available settings are `auto continuous` which means that before each image is captured, values are
73+
automatically set. Available settings are stated below.
74+
75+
* Exposure time
76+
* Available range depends on the camera used,
77+
see [documentation](https://docs.baslerweb.com/exposure-time#specifics) to find these values.
78+
* Maximal exposure time is limited to values that do not interfere with the requested frame rate.
79+
* Gain
80+
* Available range depends on the camera used, see [documentation](https://docs.baslerweb.com/gain#specifics) to find
81+
these values.
82+
* White Balance
83+
* Configure each channel independently - red, green, blue.
84+
85+
## Cameras handling
86+
87+
App detects all Basler cameras connected to the device and starts recording on all of them with the same settings. Once
88+
any camera is disconnected, recording is stopped on all of the cameras. As soon as the disconnected camera is connected
89+
again, the recording is resumed and the newly obtained data is appended.
90+
91+
## Image handling
92+
93+
Each captured image is handled by the OpenCV library and it is saved using it. Videos are also saved with OpenCV.
94+
95+
## Synchronization of capturing
96+
97+
Capturing images with multiple cameras is parallelized using Pylon library - each camera has its own thread.
98+
Synchronization of capturing images from all cameras at the same time is done by software trigger that is serially sent
99+
to all cameras. Software sleep until the necessary time is used when waiting for the next image. With this mechanism,
100+
precision of +-1 ms is achieved.

src/ArgumentsParser.cpp

+18-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @file ArgumentsParser.cpp
55
* @author Daniel Konecny (xkonec75)
66
* @organisation Brno University of Technology - Faculty of Information Technologies
7-
* @date 30. 04. 2021
7+
* @date 20. 07. 2021
88
*/
99

1010

@@ -65,20 +65,26 @@ double ArgumentsParser::LoadDouble(char *numberAsChars) {
6565

6666
void ArgumentsParser::PrintHelp() {
6767
cout << "IMAGE GRABBER" << endl <<
68-
"-R (--bwr) Set balance white (red channel), larger than 0 (default: auto continuous)." << endl <<
69-
" (=1 red intensity unchanged, >1 intensity increased, <1 intensity decreased)." << endl <<
70-
"-G (--bwg) Set balance white (green channel), larger than 0 (default: auto continuous)." << endl <<
71-
" (=1 green intensity unchanged, >1 intensity increased, <1 intensity decreased)." << endl <<
72-
"-B (--bwb) Set balance white (blue channel), larger than 0 (default: auto continuous)." << endl <<
73-
" (=1 blue intensity unchanged, >1 intensity increased, <1 intensity decreased)." << endl <<
74-
"-e (--exposure) Set exposure time in microseconds, larger than 0 (default: auto continuous)." << endl <<
75-
"-f (--framerate) Set framerate (fps) of recording (default: " << DEFAULT_FRAME_RATE << ")." << endl <<
76-
"-g (--gain) Set gain, larger than 0, (default: auto continuous)." << endl <<
68+
"-R (--bwr) Balance white (red channel), larger than 0, double precision," << endl <<
69+
" (default: auto continuous), (=1 red intensity unchanged, >1 increased, <1 decreased)."
70+
<< endl <<
71+
"-G (--bwg) Balance white (green channel), larger than 0, double precision," << endl <<
72+
" (default: auto continuous), (=1 green intensity unchanged, >1 increased, <1 decreased)."
73+
<< endl <<
74+
"-B (--bwb) Balance white (blue channel), larger than 0, double precision," << endl <<
75+
" (default: auto continuous), (=1 blue intensity unchanged, >1 increased, <1 decreased)."
76+
<< endl <<
77+
"-e (--exposure) Set exposure time in microseconds, range may vary, double precision," << endl <<
78+
" (for example 28 - 1e7), (default: auto continuous)." << endl <<
79+
"-f (--framerate) Set framerate (fps) of recording, double precision, (default: " << DEFAULT_FRAME_RATE <<
80+
")." << endl <<
81+
"-g (--gain) Set gain, range may vary (for example 0 - 23.59), (default: auto continuous)." << endl <<
7782
"-h (--help) Show help." << endl <<
7883
"-i (--image) Save images instead of video." << endl <<
7984
"-o (--output) Set folder for video/image and log output (default: " << DEFAULT_OUT_DIR << ")." << endl <<
80-
"-q (--quality) Set image quality between 0 and 100, the higher is the better (default: " <<
81-
DEFAULT_IMG_QUALITY << ")." << endl <<
85+
"-q (--quality) Set image quality (use only together with `-i`) between 0 and 100," << endl <<
86+
" the higher is the better, integer precision, (default: " << DEFAULT_IMG_QUALITY << ")."
87+
<< endl <<
8288
"-v (--verbose) Print information about the camera state." << endl;
8389
}
8490

todolist.md

-31
This file was deleted.

0 commit comments

Comments
 (0)