Skip to content

Commit 32ca9b6

Browse files
authored
update-to-readme-Dec-7-2017
1 parent 459e900 commit 32ca9b6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

examples/analog-gauge-reader/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Analog Gauge Reader
22

3-
This sample application takes an image or frame of an analog gauge an reads the value using computer vision.
4-
It consists of two parts: the calibration, and the measurement. During calibration, the user gives the application an image
5-
of the gauge to calibrate, and it prompts the user to enter the range of values in degrees. It then uses these
3+
This sample application takes an image or video frame of an analog gauge and reads the value using functions from the OpenCV\* computer vision library.
4+
It consists of two parts: calibration and measurement. During calibration, the application calibrates an image
5+
of a gauge (provided by the user) by prompting the user to enter the range of values of the gauge in degrees. It then uses these
66
calibrated values in the measurement stage to convert the angle of the dial into a meaningful value.
77

88
## What you’ll learn
@@ -12,11 +12,11 @@ calibrated values in the measurement stage to convert the angle of the dial into
1212
## Gather your materials
1313
* Python\* 2.7 or greater
1414
* OpenCV version 3.3.0 or greater
15-
* A picture of a gauge to try (or you can use the sample one provided)
15+
* An image of a gauge (or you can use the sample one provided)
1616

1717
## Setup
1818
1. Take a picture of a gauge or use the gauge-1.jpg provided. If you name it something other than gauge-1.jpg make sure to
19-
change that in the main() function.
19+
change that in the `main() ` function.
2020
2. Run the application (download the .zip at the end of this article first) and enter the requested values, using the output file gauge-#-calibration.jpg to determine the values. Here's an example of what the calibration image looks like:
2121
![](images/gauge-1-calibration.jpg)
2222

@@ -37,19 +37,19 @@ gauge-2.jpg is provided for the user to try.
3737
Code is included in this folder of the repository in the .py file.
3838

3939
## How it works
40-
The main functions used in OpenCV are HoughCircles (to detect the outline of the gauge and center point) and HoughLines (to detect the dial).
40+
The main functions used from the OpenCV\* library are `HoughCircles` (to detect the outline of the gauge and center point) and `HoughLines` (to detect the dial).
4141

4242
Basic filtering is done as follows:
43-
For cirles (this happens in calibrate_gauge() )
43+
For cirles (this happens in `calibrate_gauge()`)
4444
* only return circles from HoughCircles that are within reasonable range of the image height (this assumes the gauge takes up most of the view)
4545
* average the resulting circles and use the average for the center point and radius
46-
For lines (this happens in get_current_value() )
47-
* apply a threshold using cv2.threshold. cv2.THRESH_BINARY_INV with threshold of 175 and maxValue of 255 work fine
46+
For lines (this happens in `get_current_value()`)
47+
* apply a threshold using `cv2.threshold.` and `cv2.THRESH_BINARY_INV` with threshold of 175 and maxValue of 255 work fine
4848
* remove all lines outside a given radius
4949
* check if a line is within an acceptable range of the radius
5050
* use the first acceptable line as the dial
5151

52-
There is a considerable amount of triginomotry involved to create the calibration image, mainly sin and cos to plot the calibration image lines and arctan to get the angle of the dial. This approach sets 0/360 to be the -y axis (if the image has a cartesian grid in the middle) and it goes clock-wise. There is a slight modification to make the 0/360 degrees be at the -y axis, by an addition (i+9) in the calculation of p_text[i][j]. Without this +9 the 0/360 point would be on the +x axis. So this
52+
There is a considerable amount of trigonometry involved to create the calibration image, mainly sine and cosine to plot the calibration image lines and arctangent to get the angle of the dial. This approach sets 0/360 to be the -y axis (if the image has a cartesian grid in the middle) and it goes clock-wise. There is a slight modification to make the 0/360 degrees be at the -y axis, by an addition (i+9) in the calculation of p_text[i][j]. Without this +9 the 0/360 point would be on the +x axis. So this
5353
implementation assumes the gauge is aligned in the image, but it can be adjusted by changing the value of 9 to something else.
5454

5555
IMPORTANT NOTICE: This software is sample software. It is not designed or intended for use in any medical, life-saving or life-sustaining systems, transportation systems, nuclear systems, or for any other mission-critical application in which the failure of the system could lead to critical injury or death. The software may not be fully tested and may contain bugs or errors; it may not be intended or suitable for commercial release. No regulatory approvals for the software have been obtained, and therefore software may not be certified for use in certain countries or environments.

0 commit comments

Comments
 (0)