mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #16001 from alalek:backport_15995
This commit is contained in:
@@ -36,7 +36,7 @@ let x = document.getElementById('myRange');
|
||||
@endcode
|
||||
|
||||
As a trackbar, the range element need a trackbar name, the default value, minimum value, maximum value,
|
||||
step and the callback function which is executed everytime trackbar value changes. The callback function
|
||||
step and the callback function which is executed every time trackbar value changes. The callback function
|
||||
always has a default argument, which is the trackbar position. Additionally, a text element to display the
|
||||
trackbar value is fine. In our case, we can create the trackbar as below:
|
||||
@code{.html}
|
||||
|
||||
@@ -16,7 +16,7 @@ correspondingly window color changes. By default, initial color will be set to B
|
||||
|
||||
For cv.getTrackbarPos() function, first argument is the trackbar name, second one is the window
|
||||
name to which it is attached, third argument is the default value, fourth one is the maximum value
|
||||
and fifth one is the callback function which is executed everytime trackbar value changes. The
|
||||
and fifth one is the callback function which is executed every time trackbar value changes. The
|
||||
callback function always has a default argument which is the trackbar position. In our case,
|
||||
function does nothing, so we simply pass.
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ print( accuracy )
|
||||
@endcode
|
||||
So our basic OCR app is ready. This particular example gave me an accuracy of 91%. One option
|
||||
improve accuracy is to add more data for training, especially the wrong ones. So instead of finding
|
||||
this training data everytime I start application, I better save it, so that next time, I directly
|
||||
this training data every time I start application, I better save it, so that next time, I directly
|
||||
read this data from a file and start classification. You can do it with the help of some Numpy
|
||||
functions like np.savetxt, np.savez, np.load etc. Please check their docs for more details.
|
||||
@code{.py}
|
||||
|
||||
@@ -210,12 +210,12 @@ Explanation
|
||||
@code{.cpp}
|
||||
image2 = image - Scalar::all(i)
|
||||
@endcode
|
||||
So, **image2** is the substraction of **image** and **Scalar::all(i)**. In fact, what happens
|
||||
here is that every pixel of **image2** will be the result of substracting every pixel of
|
||||
So, **image2** is the subtraction of **image** and **Scalar::all(i)**. In fact, what happens
|
||||
here is that every pixel of **image2** will be the result of subtracting every pixel of
|
||||
**image** minus the value of **i** (remember that for each pixel we are considering three values
|
||||
such as R, G and B, so each of them will be affected)
|
||||
|
||||
Also remember that the substraction operation *always* performs internally a **saturate**
|
||||
Also remember that the subtraction operation *always* performs internally a **saturate**
|
||||
operation, which means that the result obtained will always be inside the allowed range (no
|
||||
negative and between 0 and 255 for our example).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user