Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I fit and then overlay 2 images which have different resolution ?

One represents has a mesh, which is supposed to overlay the Layer1 . I didn't find how can I do this using the opencv. I know that is possible change image resolution, however, I don't know how to fit both images

This is the main image: image description

I have this one, which has the correct mesh to the image above:

image description

The code to change resolution is more or less this :

#!/usr/bin/python

import cv2
from matplotlib import pyplot as plt
import numpy as np
img1 = cv2.imread('transparency.jpg')

img2 = cv2.imread('La1.png')


row1,cols1, ch1 = img1.shape
row2,cols2, ch2 = img2.shape

res = cv2.resize(img2, None , fx = (1.* row1 /row2 ), fy =(1.* cols1 /cols2 ), interpolation = cv2.INTER_CUBIC)

How can I fit and then overlay 2 images which have different resolution ?

One represents has a mesh, which is supposed to overlay the Layer1 . I didn't find how can I do this using the opencv. I know that is possible change image resolution, however, I don't know how to fit both images

This is the main image: image descriptionimage1 - (2.6 MB)

I have this one, which has the correct mesh to the image above:

image descriptionimage2 - (26.4 MB)

The code to change resolution is more or less this :

#!/usr/bin/python

import cv2
from matplotlib import pyplot as plt
import numpy as np
img1 = cv2.imread('transparency.jpg')

img2 = cv2.imread('La1.png')


row1,cols1, ch1 = img1.shape
row2,cols2, ch2 = img2.shape

res = cv2.resize(img2, None , fx = (1.* row1 /row2 ), fy =(1.* cols1 /cols2 ), interpolation = cv2.INTER_CUBIC)