Extracting the Image Region of Interest (ROI) in Python using OpenCV¶
Read Actual Image¶
In [2]:
import cv2
img = cv2.imread('machinelearning.png',1)
cv2.imshow('Machine Learning',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Read Image from Height 100-200 Pixel and Width 200-400 Pixel¶
In [3]:
import cv2
img = cv2.imread('machinelearning.png',1)
roi = img[100 : 200, 200 : 400]
cv2.imshow('Machine Learning',roi)
cv2.waitKey(0)
cv2.destroyAllWindows()