Skip to main content

Take 2 images and combine it to form a single image using opencv

 


Libraries Required for this 

1.numpy

2.Matplotlib

3.opencv

Taking input from the user using

img1 = cv2.imread("imageone.jpg")
img2 = cv2.imread("imagetwo.png")

Converting both the images into RGB format from BGR

img1 = cv2.cvtColor(img1,cv2.COLOR_BGR2RGB)

Showing image using Matplotlib

plt.imshow(imagename)

Make sure that both the images are of same sizes to add them together one can check the shape of the image and confirm whether both image has same size

using
imgname.shape

return (x,y,[RGB])

concatenating two images using the below code


im_h = cv2.hconcat([imageone, imagetwo])
a =  cv2.cvtColor(im_h,cv2.COLOR_BGR2RGB)

Showing image using Matplotlib

plt.imshow(imagename)

Writing the image using imwrite()

cv2.imwrite("imagename.png",a)


Comments

Popular posts from this blog

What are the differences between StaticJsonBuffer and DynamicJsonBuffer?

   StaticJsonBuffer ArduinoJson  uses preallocated memory to store the data and this is possible due to StaticJsonBuffer. If one has to use this library then firstly they should create t he StaticJsonBuffer just like: StaticJsonBuffer<200> jsonBuffer; then it creates an  memory of 200 byte size which creates allocated memory in the system for storing the data static as the name tells it has fixed in size type of memory.Also we cannot reuse the memory once it gets allocated.it has high speed performance. DynamicJsonBuffer This library supports DynamicJsonBuffer since it has parameters for dynamic memory allocation but it will be more useful if we use this buffer in the machine having memory more than 10KB of RAM. to use this syntax is just similar. DynamicJsonBuffer jsonBuffer; This will create one dynamic memory for the system so that it can allocate it more precisely.its size is variable it stores the data in heap.while storing it take time and its somehow pro...

Implement the concept of template in python & the concept of do while loop in python.

 

Vivo Announces Android 11-Based Funtouch OS 11 Beta Update Schedule for India

Vivo has announced the rollout schedule for the beta version of its Android 11-based Funtouch OS 11 in India that will go on till June. The Vivo V20 debuted with the stable version of Android 11 with Funtouch OS 11 in October, and the Vivo X50 Pro started receiving the update last month, but the company was yet to announce the schedule for its older models. The update schedule has devices ranging from the budget segment to the premium segment. The company took to Twitter to reveal its Android 11-based Funtouch OS 11 beta rollout plan. Vivo clarified that users will receive the update on a batch-by-batch basis. The Vivo V20 and the Vivo V20 Pro are already running on the latest OS. The Vivo X50 Pro, too, started receiving the update last month, Vivo said. The Vivo V19 and the Vivo X50₹ 34,990 will start receiving the Android 11-based Funtouch OS 11 beta version update at the end of January 2021, while Vivo V17, Vivo V17 Pro₹ 27,375, Vivo V15 Pro, and Vivo S1 will start receiving the upd...