Image Processing Using OpenCV

Priyanshugoyal
2 min readJun 12, 2021

--

What is OpenCV ?

OpenCV is the huge open-source library for the computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in today’s systems. By using it, one can process images and videos to identify objects, faces, or even handwriting of a human.

What is Image Processing ?

Image processing is a method to perform some operations on an image, in order to get an enhanced image or to extract some useful information from it. It is a type of signal processing in which input is an image and output may be image or characteristics/features associated with that image.

Task Description 📄

🔅 Task 4.1

📌 Create image by yourself Using Python Code

🔅 Task 4.2

📌 Take 2 image crop some part of both image and swap it.

🔅 Task 4.3

📌 Take 2 image and combine it to form single image. For example collage.

Lets, Start

🔅 Task 4.1

📌 Create image by yourself Using Python Code.

# Import required libraries
import cv2
import numpy as np
# Create a 3D Array
img = np.zeros((550, 500, 3))

# Make left half:Pink & Right half:Light Green
img[:, 0:500//2] = (255,0,255) # (B, G, R)
img[:, 500//2:500] = (255,255,0)

# Create Circles in Mid
img = cv2.circle(img, center=(260,250), radius=100, color=(0,0,0), thickness= -1)
img = cv2.circle(img, center=(260,250), radius=75, color=(255,0,0), thickness= -1)
img = cv2.circle(img, center=(260,250), radius=75, color=(0,255,255), thickness= -1)
# Shape of the Image
img.shape
# Show Image
cv2.imshow("MyPhoto", img)
cv2.waitKey()
cv2.destroyAllWindows()

🔅 Task 4.2

📌 Take 2 image crop some part of both image and swap it.

--

--

No responses yet