Core operation on an image in opencv.

import cv2
import numpy as np

img = cv2.imread('mehjabin.png')

pixel = img[100, 100]

print(pixel)

blue = img[100, 100, 2]
print(blue)

print(img.shape)
print(img.size)
print(img.dtype)

roi = img[80:300,  0:500]

while True:
    cv2.imshow('window', img)
    cv2.imshow('window2', roi)

    if cv2.waitKey(1) == 27:
        breakcv2.destroyAllWindows()


Comments

Popular posts from this blog

how to Create a Black Image in OpenCV

Playing a video from file with color BGR, RGB, GRAY, HSV in OpenCV

Capturing Video via webcam