I am trying to add two images of different sizes using bitwise operations in OpenCV using python. I want a specific point in Image1 (image of a person’s face) to coincide with a specific point in Image2 (image of a frame of glasses). Special moments are not the most corrupt image points. I know the two midpoints of the frame points and the pupil of the eyes. I want the midpoints of the frame to coincide with the points of the pupil of the eyes in the face. The code I use adds the second left upper corner point of the image to a specific point of Image1, as in line 10, while I want to add the middle point of the left glass frame.
The image of the face can be any random image, and the image of the spectacle -

I am using the code:
import cv2
import numpy as np
img_frame = cv2.imread('image1.jpg',1)
img_in = cv2.imread('face.jpg',1)
new_image = np.zeros(img_frame.shape,dtype=np.uint8)
i,j,k = img_frame.shape
for ii in range (1,i):
for jj in range (1,j):
pixel = img_frame[ii,jj]
img_in[339+ii,468+jj] = pixel
cv2.imwrite('pc2_with_frame_7.jpg',img_in)
cv2.imshow('win',img_in)
cv2.waitKey(0)
cv2.destroyWindow('win')
Any help would be appreciated.
Thank.
source
share