OpenCV In Hindi

OpenCV in Hindi – Binary Images

Python OpenCV

OpenCV – Binary Images In Hindi OpenCV Ke Kuch Method Ka Use Kar Ke Aap Kisi Bhi Image Ko Color Image Se Binary Images Me Convert Kar Sakte Hai. 

Binary Images Aise Images Ko Kahte Hai, Jisme Only Black Or White Color Wale Pixels ka use hua ho. Jisme Black Color Ka Value 0 Hota Hai And White Color Ka Value 1 Hota Hai.

Binary Image

Upar Diye Hue Image Me Aap Dekh Sakte Hai Ki Image Me Sirf Two Colors Ka Use Hua Hai Black And White. Image Me Kahi Bhi Gray Ya Dusre Colors Ka Use Nahi Hua Hai.

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

OpenCV – Binary Images In Hindi

Sabse Pahle Aapko Kuch Aur Terms Janana Padega Binary Images, Threshold Value

Threshold Value = Threshold Value Ek Number Ko Bola Jata Hai Jiske Niche Jane Ke Sabhi Pixels Ka Value 0 Ho Jata Hai And Threshold Value Ke Upar Ke Sabhi Pixels Ka Value 1 Hota Hai.

Agar Humne Apne Image Me Threshold Value 125 Diya. Ab 125 Value Ke Niche (0-124) Value Tak Ke Sabhi Pixel Ka Value 0 Ho Jayega. Aur 0 Black Coloured Pixel Ko Represent Karta Hai.

Same 125 Value Ke Upar (126 – 255) Ke Sabhi Pixel Ka Value 1 Ho Jayega. 1 Value White Coloured Pixel Ko Represent Karta Hai.

Example No 1

import cv2

img = cv2.imread('original.jpg')
cv2.imshow("Original Image",img)

ret, binary = cv2.threshold(img,95,255,cv2.THRESH_BINARY)
cv2.imshow("Binary Image",binary)

cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Binary Image

STEP 1 = Sabse Pahle cv2 Ko import Kiya

STEP 2 = img Variable Banaya Phir cv2.imread Method Ka Use Kar Ke model.jpg Ko Read Kiya.

STEP 3 = cv2.imshow Ka Use Kar Ke Original image Ko Show Karenge.

STEP 4 = cv2.imshow Me First Parameter Me Ek string Pass Karenge And Second Parameter Me img Ko Pass Karenge.

STEP 5 = ret Ka use kar ke return kiya.

STEP 6 = Ek naya variable binary banaya jisme cv2.threshold method ka use kiya. threshold method ke use se threshold value de sakte hai jo image ko binary image me convert karne me helpful hoga.

STEP 7 = cv2.threshold Me First Parameter Me img Ko Pass Karenge Second Parameter Me Threshold value Ko Pass Karenge, Third Parameter Me Maximum Value (255) Diya, Fourth Parameter Me threshold type Ko Pass Kiya Hai.

STEP 8 = cv2.imshow Me First Parameter Me Ek string Pass Karenge And Second Parameter Me binary Ko Pass Karenge.

OpenCV – Reading an Image as Grayscale

STEP 9 = cv2.waitkey(0) Iska Use Karne Se Ek Window Show Hoga, Jisme Aapka Image Show Hoga Aur Wo Hold Position Me Rahega. Ko Parameter Me Dene Se Ye Close Nahi Hoga.

STEP 10 = cv2.destroyAllWindows() Iske Use Karke Program Me Running Sabhi Codes Ko Memory Se Release Kiya Jata Hai And Program Stop Ho Jata Hai.

Friends Mujhe Umeed Hai Ki Aapko OpenCV Ke Binary Image ki 100% Jankari Ho Gayi Hogi | Agar Agar Aaapko Koi Question Hai To Please Aap Humse Comment Section Me Jarur Puche.

Leave a Reply

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