From the course: Computer Vision on the Raspberry Pi 4

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Convolution in OpenCV

Convolution in OpenCV

From the course: Computer Vision on the Raspberry Pi 4

Start my 1-month free trial

Convolution in OpenCV

- [Instructor] This video demonstrates how convolution can be performed using OpenCV. The most important function to know is filter2D. And in most applications, you only need to be concerned with the first three arguments. Src identifies the NumPy array containing the input image. Ddepth sets the data type of the output values. If this is set to minus one, the output values will all have the same type as the input values. Kernel identifies the NumPy array containing the kernel values. The function's return value is the image produced by the convolution. To start the program, I'll create an array named img_array and call cv2.imread to read data from rpi4.jpg and I'll set the image's type to cv2.IMREAD_COLOR. Then I'll call the display function to present the image in a window. This accepts the window's name, which I'll call Original and the array containing the image's pixels. To demonstrate box blurring, I'll…

Contents