Open CV
Open CV
import cv2
img = cv2.imread("C:\\Users\\hamid\\Downloads\\messi.jpg")
img.shape
NOTE!
One thing to keep in mind while using the cv2.resize()
function is that the tuple passed for determining the size
of the new image ((1050, 1610) in this case) follows the
order (width, height) unlike as expected (height, width).
Resize an Image
• import cv2
• img =
cv2.imread("C:\\Users\\hamid\\
Downloads\\messi.jpg")
• small = cv2.resize(img,(150,150))
• small.shape → (150, 150, 3)
Converting Color of an Image
import cv2
path = cv2.imread("C:\\Users\\hamid\\Downloads\\messi.jpg")
image = cv2.cvtColor(path, cv2.COLOR_BGR2GRAY )
cv2.imshow('result', image)
Converting Color of an Image
Converting Color of an Image
import cv2
path = cv2.imread("C:\\Users\\hamid\\Downloads\\messi.jpg")
image = cv2.cvtColor(path, cv2.COLOR_BGR2RGB )
cv2.imshow('result', image)
Converting Color of an Image
Converting Color of an Image
import cv2
path = cv2.imread("C:\\Users\\hamid\\Downloads\\messi.jpg")
image = cv2.cvtColor(path, cv2.COLOR_BGR2HSV )
cv2.imshow('result', image)
Converting Color of an Image
waitKey Function