There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "OpenCV provides the VideoCapture and VideoWriter classes, which support various video file formats."
A block of code is set as follows:
import cv2
grayImage = cv2.imread('MyPic.png', cv2.IMREAD_GRAYSCALE)
cv2.imwrite('MyPicGray.png', grayImage)
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
import cv2
cameraCapture = cv2.VideoCapture(0)
fps = 30 # An assumption
size = (int(cameraCapture.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(cameraCapture.get(cv2.CAP_PROP_FRAME_HEIGHT)))
videoWriter = cv2.VideoWriter(
'MyOutputVid.avi', cv2.VideoWriter_fourcc('M','J','P','G'), fps, size)
In general, command-line input or output is written as follows:
$ pip install opencv-contrib-python
Alternatively, for Windows, command-line input or output may be written as follows:
> pip install opencv-contrib-python
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Now, under System variables, select Path and click on the Edit... button."
Warnings or important notes appear like this.
Tips and tricks appear like this.