এই প্রোগ্রামে, আমরা OpenCV ফাংশন rectangle() ব্যবহার করে একটি আয়তক্ষেত্র আঁকব। এই ফাংশনটি কিছু পরামিতি নেয় যেমন শুরু স্থানাঙ্ক, সমাপ্তি স্থানাঙ্ক, রঙ এবং বেধ এবং নিজেই চিত্র।
মূল ছবি

অ্যালগরিদম
Step 1: Import cv2. Step 2: Read the image using imread(). Step 3: Define the starting coordinates. Step 5: Define the ending coordinates. Step 6: Define the color and the thickness. Step 7: Draw the rectangle using the cv2.reactangle() function. Step 8: Display the rectangle.
উদাহরণ কোড
import cv2
image = cv2.imread('testimage.jpg')
height, width, channels = image.shape
start_point = (0,0)
end_point = (width, height)
color = (0,0,255)
thickness = 5
image = cv2.rectangle(image, start_point, end_point, color, thickness)
cv2.imshow('Rectangle',image) আউটপুট
