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.

https://github.com/shiv0112/task4/tree/main

I automate things ๐Ÿ˜‰