OpenCV Images Size In Hindi

OpenCV Images Size In Hindi

Python OpenCV

OpenCV Images Size In Hindi – OpenCV Me shape Method Ka Use Kar Ke Aap Kisi Image Ke Size (Color Channel) Ko Malum Kar Sakte Hai. Image Ke (Height, Width and Channel) Malum Karne Ke Liye shape Method Ka Use Kare.

Agar Aap OpenCV Ko Poora A-Z Learn Karna Chahte Hai To Aapko, Sabse Pahle Aapko OpenCV Ke Previous Post Ko Read Karna Chahiye – Opencv Setup And Installation In Hindi

OpenCV Images Size In Hindi

OpenCV Me Kisi Image Ke Size and Channel Pata Karne Ke Liye, shape Method Ka Use Karna Padta Hai. Is Method Ka Use Karke Aap Image Ke Height, Width pixel and Color Channel Pata Kar Sakte Hai.

Example No 1

import cv2

img = cv2.imread('master.jpg')

print(img.shape)

Output

Image Height, Width, Color

STEP 1 = Sabse Pahle cv2 Ko import Kiya

STEP 2 = Ab Image master.jpg Ko imread Method Se Read Kiya Aur Phir img Variable Me Pass Kar Diya

STEP 3 = img.shape Method Ka Use Kiya Aur Usko print Kiya.

STEP 4 = Ab Aap Dekh Sakte Hai Terminal Me Result Aa Gya Hai. Heigth = 147px , Width = 348 px and Image RGB (Red, Green, Blue) Color Dimension Me Hai Isliye Channel 3 Hai.

Example No 2

import cv2

img = cv2.imread('master.jpg')

height = img.shape[0]
width = img.shape[1]
channel = img.shape[2]

print("The Height of Image is: ",height)
print("The Height of Image is: ",width)
print("The Height of Image is: ",channel)

Output

opencv shape
opencv shape

STEP 1 = Sabse Pahle cv2 Ko import Kiya

STEP 2 = Ab Image master.jpg Ko imread Method Se Read Kiya Aur Phir img Variable Me Pass Kar Diya

STEP 4 = height Variable Banaya Usme img.shape[0] Ka Use Kiya Aur 0th Index Ko Call Kiya Jisme Image Ka height pixel value Me Saved Hai.

STEP 5 = width Variable Banaya Usme img.shape[1] Ka Use Kiya Aur 1th Index Ko Call Kiya Jisme Image Ka width pixel value Me Saved Hai.

STEP 6 = channel Variable Banaya Usme img.shape[2] Ka Use Kiya Aur 2nd Index Ko Call Kiya Jisme Image Ka Color Dimension or Color Channel value Saved Hai.

STEP 7 = Ab Three Variables (height, width, channel) Ke Value Ko print Kiya.

STEP 8 = print Karne Ke liye First Parameter Me String Ko pass Kiya and Second Parameter Me Variable Ka Name Likhna Hai.

STEP 9 = Result Me Aap Dekh Sakte Hai Channel Ka Value 3 Hai, Kyuki Image RGB format Me Hai (Red, Green, Blue) Agar Image Black & White Hoga To Channel Ka Value 2 Hoga.

Ab Aap Dekh Sakte Hai Ki Image Ke Height, Width and Color Channel Terminal Me Show Ho Raha Hai.

Friends Mujhe Umeed Hai Ki Aapko OpenCV Ke shape method In Hindi Ke Bare Mai 100% Jankari Ho Gayi Hogi | Agar Aapko Learn Karne Main Dikkat Aa Rahi Hai To Aap Mere Se Contact Kar Sakte Hai.

Leave a Reply

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