How to Overlay two Images

How do i overlay detected section with another image

Hey @iamrajivprajapati,

You may take help from the example below:

background = cv2.imread('road.jpg')
overlay = cv2.imread('traffic sign.png')
rows,cols,channels = overlay.shape
overlay=cv2.addWeighted(background[250:250+rows, 0:0+cols],0.5,overlay,0.5,0)
background[250:250+rows, 0:0+cols ] = overlay

This will overlay the image over the background image such as shown here:
Ignore the ROI rectangles

Note that I used a background image of size 400x300 and the overlay image of size 32x32, is shown in the x[0-32] and y[250-282] part of the background image according to the coordinates I set for it, to first calculate the blend and then put the calculated blend in the part of the image where I want to have it.

(overlay is loaded from disk, not from the background image itself, the overlay image has its own white background, so you can see that too in the result)