Working on Computer Vision CV2 module

Summer — Task 04 👨🏻‍💻

An image is just a two-dimension NumPy array that has three values each representing three basic colors. In python, we can use the cv2 module for image processing.

OpenCV-Python is a library of Python bindings designed to solve computer vision problems.
cv2.imread() method loads an image from the specified file. If the image cannot be read (because of missing file, improper permissions, unsupported or invalid format) then this method returns an empty matrix.

All three types of flags are described below:

cv2.IMREAD_COLOR: It specifies to load a color image. Any transparency of image will be neglected. It is the default flag. Alternatively, we can pass integer value 1 for this flag.
cv2.IMREAD_GRAYSCALE: It specifies to load an image in grayscale mode. Alternatively, we can pass integer value 0 for this flag.
cv2.IMREAD_UNCHANGED: It specifies to load an image as such including alpha channel. Alternatively, we can pass integer value -1 for this flag.

Now we will use these basic tools to perform some tasks on cv2 module:

Task Description 📄
🔅 Task 4.1
📌 Creating an image by yourself Using Python Code

Now, above I have created a simple code to print Captain America’s vibranium shield.

Now we can use simple logic to create an animation on the Shield.

🔅 Task 4.2
📌 Take 2 images crop some parts of both images and swap them.

🔅 Task 4.3
📌 Take 2 images and combine them to form a single image.

We use the same two pictures and combine them to form single image.

Thank you for viewing this task.

Here is the Github link for all the codes above.

I automate things 😉