-
Notifications
You must be signed in to change notification settings - Fork 0
/
C123.txt
62 lines (36 loc) · 1.81 KB
/
C123.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
cv2.cvtColor() method is used to convert an image from one color
space to another. There are more than 150 color-space conversion
methods available in OpenCV
cv2.rectangle(image, start_point, end_point, color, thickness)
numpy.percentile()function used to compute the nth percentile of
the given data (array elements) along the specified axis.
numpy.percentile(arr, n, axis=None, out=None)
numpy.percentile(arr, n, axis=None, out=None)
For example, if an interval of [0, 1] is specified, values smaller
than 0 become 0, and values larger than 1 become 1.
numpy.asarray()function is used when we want to convert input to an
array. Input can be lists, lists of tuples, tuples, tuples of tuples,
tuples of lists and arrays
import numpy as geek
my_list = [1, 3, 5, 7, 9]
print ("Input list : ", my_list)
out_arr = geek.asarray(my_list)
print ("output array from input list : ", out_arr)
->ord('q') returns the Unicode code point of q
-->cv2.waitkey(1) returns a 32-bit integer corresponding to the
pressed key
-->& 0xFF is a bit mask which sets the left 24 bits to zero,
because ord() returns a value betwen 0 and 255, since your keyboard
only has a limited character set
-->Therefore, once the mask is applied, it is then possible to check
if it is the corresponding key.
Doing wait 1 ms for user press.
If user press, for example, q then waitKey return DECIMAL VALUE of q
is 113. In Binary, It is expressed as 0b01110001.
Next, AND operator is excuted with two inputs are 0b01110001 and
0xFF (0b11111111).
0b01110001 AND 0b11111111 = 0b01110001. Exactly result is DECIMAL
VALUE of q
Second, compare value of left expression 0b01110001 with ord('q').
Clearly, these values is the same as another value. And final result
is break is invoked.