Loading tutorials
cv2.imread: how to call it, how it fails, and how to confirm that the array it returns is what you expect. It assumes you can write basic Python functions, have installed OpenCV with pip install opencv-python numpy, know how to index a NumPy array, and understand pixels, widt5 min readopencv-python with pip, and know that an OpenCV image is a NumPy array in BGR order, as covered in the earlier chapters. You will show an image in a window, control how long it stays open, write it to disk, and handle the cases where 5 min readcv2.imread, that you know an OpenCV image is a NumPy array with shape (height, width, channels), and that you are comfortable with NumPy slicing. Here you will learn why channel order causes silent bugs, how to convert between color spaces with `cv5 min readcv2.resize: the two ways to call it, the argument-order trap, rounding behavior, and the errors that come up most often. It assumes you can write basic Python functions, have installed opencv-python and numpy with pip, and know that an OpenCV image is a NumPy array with sha5 min readcv2.imread, read its shape, and call cv2.resize with a (width, height) size or with fx and fy scale factors. NumPy indexing and the idea of a pixel grid are also assumed.5 min readcv2.imread and cv2.resize, know that img.shape is (height, width, channels), and are comfortable with NumPy slicing. You have already seen that cv2.resize takes its size as (width, height). Here you will keep the aspect ratio when you change an image's s5 min read(height, width, channels) with channels in BGR order. The chapter covers how to cut a region out of an image, why that region can silentl6 min readcv2.imread, know that it is a NumPy array, and know that its channels are in BGR order.7 min readcv2.line, cv2.rectangle, and cv2.circle. It assumes you can load an image with cv2.imread, know that an image is a NumPy array with shape (height, width, 3) in BGR order, and are comfortable with basic Python functions. You s5 min readcv2.putText, the function that writes text onto an image. It assumes you have read the earlier chapters on loading images and on drawing conventions: (x, y) points, BGR color tuples, and drawing on a copy. You should be comfortable with img.shape and with tuples in Python.5 min readcv2.polylines, cv2.fillPoly, and cv2.fillConvexPoly. This chapter covers the point format they expect, the difference between an outline and a fill, and the errors that format causes. It assumes you can already draw on a copy of an image and5 min readcv2.imread, index NumPy arrays, and use the drawing functions cv2.line, cv2.rectangle, cv2.circle, and cv2.putText. It also assumes you know that OpenCV images are uint8 arrays in BGR order. The chapter explains why drawing changes your dat6 min readcv2.imread, know that OpenCV stores pixels in BGR order, and have drawn shapes on a copy of an image. You should also be comfortable indexing NumPy arrays.5 min read