-2

I have this poster image:

posterimage

I have to blend it with another image. I have to put this image on a picture of a building like this:

Buildingimage

The rotated poster image has white pixels that I don't know how to get rid of.

Can someone please help me with code to paste this image on the building image? The front of the building.

Jazz
  • 916
  • 1
  • 8
  • 22

1 Answers1

1

Firstly find the four corner points of building where you want to blend image. Also find four corner points of your poster. Then use perspective transform and warpaffine to paste poster on image.

This http://www.learnopencv.com/homography-examples-using-opencv-python-c/ link may help you to get the idea but it is using OpenCV.

I have tried this using OpenCV C++ and I am getting following image after applying perspective transform. Let me know if you want this kind of results:

output

Jazz
  • 916
  • 1
  • 8
  • 22
  • This is exactly what I want. But I have a problem understanding how to implement this line in matlab: warpPerspective(im_src, im_out, h, im_dst.size()); if I look at the example codes. – Desmarie Sep 25 '17 at 10:19
  • I do not know syntax of MATLAB functions for this implementation but MATLAB have imwarp function which you can use. Also check homography2d from Peter Kovesi website http://www.peterkovesi.com/matlabfns/index.html (MATLAB and Octave Functions for Computer Vision and Image Processing) – Jazz Sep 25 '17 at 11:16