@@ -42,11 +42,11 @@ while(True):
42
42
cap.release()
43
43
cv2.destroyAllWindows()
44
44
@endcode
45
- cap.read() returns a bool (True/ False). If frame is read correctly, it will be True. So you can
45
+ ` cap.read() ` returns a bool (` True ` / ` False ` ). If frame is read correctly, it will be ` True ` . So you can
46
46
check end of the video by checking this return value.
47
47
48
48
Sometimes, cap may not have initialized the capture. In that case, this code shows error. You can
49
- check whether it is initialized or not by the method ** cap.isOpened()** . If it is True, OK.
49
+ check whether it is initialized or not by the method ** cap.isOpened()** . If it is ` True ` , OK.
50
50
Otherwise open it using ** cap.open()** .
51
51
52
52
You can also access some of the features of this video using ** cap.get(propId)** method where propId
@@ -55,9 +55,9 @@ video) and full details can be seen here: cv::VideoCapture::get() .
55
55
Some of these values can be modified using ** cap.set(propId, value)** . Value is the new value you
56
56
want.
57
57
58
- For example, I can check the frame width and height by cap.get(3) and cap.get(4) . It gives me
59
- 640x480 by default. But I want to modify it to 320x240. Just use ret = cap.set(3 ,320) and
60
- ret = cap.set(4 ,240).
58
+ For example, I can check the frame width and height by ` cap.get(cv2.CAP_PROP_FRAME_WIDTH) ` and ` cap.get(cv2.CAP_PROP_FRAME_HEIGHT) ` . It gives me
59
+ 640x480 by default. But I want to modify it to 320x240. Just use ` ret = cap.set(cv2.CAP_PROP_FRAME_WIDTH ,320) ` and
60
+ ` ret = cap.set(cv2.CAP_PROP_FRAME_HEIGHT ,240) ` .
61
61
62
62
@note If you are getting error, make sure camera is working fine using any other camera application
63
63
(like Cheese in Linux).
@@ -100,7 +100,7 @@ very simple, just use cv2.imwrite(). Here a little more work is required.
100
100
This time we create a ** VideoWriter** object. We should specify the output file name (eg:
101
101
output.avi). Then we should specify the ** FourCC** code (details in next paragraph). Then number of
102
102
frames per second (fps) and frame size should be passed. And last one is ** isColor** flag. If it is
103
- True, encoder expect color frame, otherwise it works with grayscale frame.
103
+ ` True ` , encoder expect color frame, otherwise it works with grayscale frame.
104
104
105
105
[ FourCC] ( http://en.wikipedia.org/wiki/FourCC ) is a 4-byte code used to specify the video codec. The
106
106
list of available codes can be found in [ fourcc.org] ( http://www.fourcc.org/codecs.php ) . It is
0 commit comments