इमेज़ के लिए NumPy

Python में इमेज प्रोसेसिंग

Rebeca Gonzalez

Data Engineer

इमेज़ के लिए NumPy

  • इमेज प्रोसेसिंग की बुनियाद
    • फ्लिप करना
    • फीचर निकालना और विश्लेषण करना

पार्क में टहलता प्यारा कुत्ता

क्षैतिज रूप से फ्लिप किया प्यारा कुत्ता

Python में इमेज प्रोसेसिंग

NdArray के रूप में इमेज़

मैड्रिड बिल्डिंग

# Loading the image using Matplotlib
madrid_image = plt.imread('/madrid.jpeg')

type(madrid_image)
<class 'numpy.ndarray'>
Python में इमेज प्रोसेसिंग

NumPy के साथ रंग

ऊपर अंगूर की इमेज, नीचे 3 रंग चैनल दिखाते चित्र

Python में इमेज प्रोसेसिंग

NumPy के साथ रंग

# Obtaining the red values of the image
red = image[:, :, 0]

# Obtaining the green values of the image
green = image[:, :, 1]

# Obtaining the blue values of the image
blue = image[:, :, 2]

अलग-अलग दिखाए गए इमेज के चैनल

Python में इमेज प्रोसेसिंग

NumPy के साथ रंग

ग्रे cmap में अलग-अलग दिखाए गए चैनल (युवा महिला)

plt.imshow(red, cmap="gray")    
plt.title('Red')
plt.axis('off')
plt.show()
Python में इमेज प्रोसेसिंग

Shapes

मैड्रिड बिल्डिंग

# Accessing the shape of the image
madrid_image.shape
(426, 640, 3)
Python में इमेज प्रोसेसिंग

Sizes

मैड्रिड बिल्डिंग

# Accessing the shape of the image
madrid_image.size
817920
Python में इमेज प्रोसेसिंग

इमेज फ्लिप करना: वर्टिकली

# Flip the image in up direction
vertically_flipped = np.flipud(madrid_image)

show_image(vertically_flipped, 'Vertically flipped image')

ऊर्ध्वाधर रूप से फ्लिप की गई मैड्रिड इमेज

Python में इमेज प्रोसेसिंग

इमेज फ्लिप करना: हॉरिजॉन्टली

# Flip the image in left direction
horizontally_flipped = np.fliplr(madrid_image)

show_image(horizontally_flipped, 'Horizontally flipped image')

क्षैतिज रूप से फ्लिप की गई मैड्रिड इमेज

Python में इमेज प्रोसेसिंग

हिस्टोग्राम क्या है?

डार्क इमेज का हिस्टोग्राम लाइट इमेज का हिस्टोग्राम

Python में इमेज प्रोसेसिंग

कलर हिस्टोग्राम

युवा महिला की RGB इमेज के लिए प्रत्येक रंग का हिस्टोग्राम

Python में इमेज प्रोसेसिंग

हिस्टोग्राम के अनुप्रयोग

  • विश्लेषण
  • थ्रेशहोल्डिंग
  • ब्राइटनेस और कॉन्ट्रास्ट
  • इमेज को इक्वलाइज़ करना

थ्रेशहोल्ड की गई इमेज

Python में इमेज प्रोसेसिंग

Matplotlib में हिस्टोग्राम

लाल रंग का हिस्टोग्राम

# Red color of the image
red = image[:, :, 0]

# Obtain the red histogram plt.hist(red.ravel(), bins=256)
Python में इमेज प्रोसेसिंग

Matplotlib से हिस्टोग्राम विज़ुअलाइज़ करना

blue = image[:, :, 2]

plt.hist(blue.ravel(), bins=256)
plt.title('Blue Histogram')
plt.show()

इमेज के नीले रंग का हिस्टोग्राम

Python में इमेज प्रोसेसिंग

अभ्यास करते हैं!

Python में इमेज प्रोसेसिंग

Preparing Video For Download...