COMBINE 2 IMAGES TO FORM A SINGLE IMAGE

* Install cv2 module
command: pip install OpenCV-python
* cv2.imread() :: loads an image from the specified file.
SYNTAX: cv2.imread (path)
By this slicing, images get halved
# Add an image in the window : display  
SYNTAX :: cv2.imshow (window_name, image)
# wait for a specific time in milliseconds
SYNTAX :: cv2.waitKey()
# Destroys the window showing image
SYNTAX :: cv2.destroyAllWindows()
SYNTAX: resizeImg = cv2.resize(img, (new_w, new_h))
* numpy.hstack() function is used to stack the sequence of input arrays horizontally (i.e. column wise) to make a single array. SYNTAX : numpy.hstack (tup)
Where,
tup - sequence of ndarrays
* numpy.vstack() function is used to stack the sequence of input arrays vertically (i.e. row wise) to make a single array.SYNTAX : numpy.vstack (tup)
Where,
tup - sequence of ndarrays
# Add an image in the window : display  
SYNTAX :: cv2.imshow (window_name, image)
# wait for a specific time in milliseconds
SYNTAX :: cv2.waitKey()
# Destroys the window showing image
SYNTAX :: cv2.destroyAllWindows()

OUTPUT ::

DONE !!!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store