## Next, we configure the preview window size that determines how big should the image be from the camera, the bigger the image the more the details you capture but the slower it runs
## the smaller the size, the faster it can run and get more frames per second but the resolution will be lower. We keep
picam2.preview_configuration.main.size=(dispW,dispH)## 1280 cols, 720 rows. Can also try smaller size of frame as (640,360) and the largest (1920,1080)
## with size (1280,720) you can get 30 frames per second
## since OpenCV requires RGB configuration we set the same format for picam2. The 888 implies # of bits on Red, Green and Blue
picam2.preview_configuration.main.format="RGB888"
picam2.preview_configuration.align()## aligns the size to the closest standard format
picam2.preview_configuration.controls.FrameRate=30## set the number of frames per second, this is set as a request, the actual time it takes for processing each frame and rendering a frame can be different
picam2.configure("preview")
## 3 types of configurations are possible: preview is for grabbing frames from picamera and showing them, video is for grabbing frames and recording and images for capturing still images.