How do I position an image in cv2?
I am making a program that records the screen, but it will display the same recording in 4 different spots around one window. How do I set the position of the recording to a certain coordinate in the window?
Right now, it just displays all 4 recordings in the same spot, stacked on top of each other.
The code:
import pyautogui
import cv2
import numpy as np
from win32api import GetSystemMetrics
width = GetSystemMetrics(0)
height = GetSystemMetrics(1)
resolution = (width, height)
fps = 60.0
cv2.namedWindow("Hologram", cv2.WINDOW_NORMAL)
cv2.resizeWindow("Hologram", 480, 270)
while True:
img1 = pyautogui.screenshot()
img2 = pyautogui.screenshot()
img3 = pyautogui.screenshot()
img4 = pyautogui.screenshot()
frame1 = np.array(img1)
frame2 = np.array(img2)
frame3 = np.array(img3)
frame4 = np.array(img4)
frame1 = cv2.cvtColor(frame1, cv2.COLOR_BGR2RGB)
frame2 = cv2.cvtColor(frame2, cv2.COLOR_BGR2RGB)
frame3 = cv2.cvtColor(frame3, cv2.COLOR_BGR2RGB)
frame4 = cv2.cvtColor(frame4, cv2.COLOR_BGR2RGB)
cv2.imshow('Hologram', frame1)
cv2.imshow('Hologram', frame2)
cv2.imshow('Hologram', frame3)
cv2.imshow('Hologram', frame4)
cv2.waitKey(1)