In this article, we will see various practical tasks of image processing in Python.
Task 4.1: Create an image with python code in cv2.
Step 1: Code of creating an chessboard image with opencv and numpy
Step 2 : Output displayed with ‘imshow()’ method of cv2 showing the 8X8 chessboard.
Task 4.2: Swapping the faces of two images after cropping.
Step 1: First we loaded both images with ‘imread()’ method. After loading we detected and selected the face on photo 1 using Cascade Classifier method of cv2.
Step 2: Output of detected face on photo 1.
Step 3: Then we detected and selected the face on photo 2.
Step 4: Output of detected face on photo 1.
Step 5: Swapped the face of photo 1 with photo 2 detected face.
Step 6: Final output with swapped faces.
Task 4.3: Combining two images into one by forming a collage.
Step 1: First loaded two images using ‘imread()’ method of cv2 and resized both the photo with the same dimensions. After, combined both the resized photo in a horizontal manner using ‘hstack()’ method of numpy.
Step 2: Output of the two loaded pictures which will be combined.
Step 3: Final output displaying a collage image of both pictures into one picture
Thanks for reading this article :)