About OpenCV

  • Officially launched in 1999, OpenCV (Open Source Computer Vision) from an Intel initiative.
  • OpenCV’s core is written in C++. In python we are simply using a wrapper that executes C++ code inside of python.
  • First major release 1.0 was in 2006, second in 2009, third in 2015 and 4th in 2018. with OpenCV 4.0 Beta.
  • It is an Open source library containing over 2500 optimized algorithms.
  • It is EXTREMELY useful for almost all computer vision applications and is supported on Windows, Linux, MacOS, Android, iOS with bindings to Python, Java and Matlab.
In [1]:
import numpy as np
import matplotlib.pyplot as plt
import cv2


By altering our kernels we can implement sharpening, which has the effects of in strengthening or emphasizing edges in an image.

In [2]:
image = cv2.imread('/kaggle/input/opencv-samples-images/data/building.jpg')
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

plt.figure(figsize=(20, 20))
plt.subplot(1, 2, 1)

# Create our shapening kernel, we don't normalize since the 
# the values in the matrix sum to 1
kernel_sharpening = np.array([[-1,-1,-1], 

# applying different kernels to the input image
sharpened = cv2.filter2D(image, -1, kernel_sharpening)

plt.subplot(1, 2, 2)
plt.title("Image Sharpening")