I am building a stand-alone VR headset using Raspberry Pi 3 model b. I am having a problem with splitting the screen as we see on our phone. I am still learning Python so I don't have much idea on how to do this.
Here in this code, I have tried to solve the above-mentioned problem but when I run this code on Raspbian an error occurs that ImageGrab
function works only on Windows and Mac. I tried to use pyscreenshot module also, although it works on my PC screen fairly when I connect it with my 5-inch screen, a black window opens and I see nothing.
import numpy as np
from PIL import ImageGrab
import cv2
import time
while(True):
screen = np.array(ImageGrab.grab(bbox=(920,420,1320,900)))
frame = cv2.cvtColor(screen, cv2.COLOR_BGR2RGB)
frame = cv2.resize(frame, (0, 0), None, 1, .83)
numpy_horizontal = np.hstack((frame,frame))
#cv2.namedWindow("window", cv2.WND_PROP_FULLSCREEN)
#cv2.setWindowProperty("window", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
cv2.imshow('window',numpy_horizontal)
if cv2.waitKey(25) & 0xFF == ord('q'):
cv2.destroyAllWindows()
break