Friday , December 6 2024

Extracting the Image Region of Interest (ROI) in Python using OpenCV

4 Extracting the Region of Interest (ROI)

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()

About Machine Learning

Check Also

Record Video From a Webcam using OpenCV

12 Record Video using OpenCV Record Video From a Webcam using OpenCV¶ cv2.VideoWriter( filename, fourcc, …

Leave a Reply

Your email address will not be published. Required fields are marked *