How can I fit images with different resolutions?
Question: How can I fit and then overlay 2 images which have different resolution ?

This is the main image: ![image
description](https://dl.dropboxusercontent.com/u/710615/layer.png)

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

![image description](https://dl.dropboxusercontent.com/u/710615/tooverlay.jpg)

    
    
    #!/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)
    


Answer: It is pretty unclear from your question how it is supposed to come out! I am
just doing this at the command line using ImageMagick which is installed on
most Linux distros and is available for OSX and Windows - there are Python
bindings if that floats your boat though.

Anyway, let's get the size of the images:

    
    
    identify m*
    
    main.png PNG 1790x4098 1790x4098+0+0 8-bit sRGB 942KB 0.000u 0:00.000
    mesh.jpg JPEG 2537x5703 2537x5703+0+0 8-bit sRGB 3.493MB 0.000u 0:00.000
    

So, let's load up the main image and resize it to match the mesh. Then let's
load up the mesh, and make everything transparent that is within 10% of white
- that will leave just the black lines from the mesh. But we can't see black
on black, so let's make the black lines in the mesh red. Then splat that
(technical term meaning _"composite"_) on top of the main image:

    
    
    convert main.png -resize 2537x5703! \( mesh.jpg -fuzz 10% -transparent white -fill red -colorize 100% \) -composite result.png
    

Here's what you get.

[![enter image description
here](http://i.stack.imgur.com/P5Noq.jpg)](http://i.stack.imgur.com/P5Noq.jpg)

Looks like your mesh needs cropping down the left side to shift it over, so
try:

    
    
    convert main.png -resize 2480x5703! \( mesh.jpg -crop +57 -fuzz 10% -transparent white -fill red -colorize 100% \) -composite result.png
    

[![enter image description
here](http://i.stack.imgur.com/fyixS.jpg)](http://i.stack.imgur.com/fyixS.jpg)

