0

Currently I'm using this code, to display my pygame on 2.8" TFT with Touchscreen while keeping the HDMI-Port as main-output:

import pygame, sys, os

os.environ["SDL_VIDEODRIVER"] = "fbcon"
os.environ["SDL_FBDEV"] = "/dev/fb1"
os.environ["SDL_MOUSEDRV"] = "TSLIB"
os.environ["SDL_MOUSEDEV"] = "/dev/input/touchscreen"

Is there a way to create a container, something similar to Rect in Pygame, that is able to display the pi-camera preview?

When I use:

cam = picamera.PiCamera()
cam.resolution = (220,140)
cam.start_preview()

My application is still displayed on the TFT, but the Camera-Feed is displayed on the HDMI-Output on-top of bash.

1

To the best of my knowledge, this can't be done. As the FAQ explains the camera's preview system simply gets the GPU to overlay the camera output on top of the usual video output.

There was a very cool adafruit camera project that seemingly managed to get a preview working on a PiTFT display (which I assume is the sort of display you're talking about), and which was also using picamera but when I dug into the code they were (very cleverly) "cheating" by taking lots of consecutive unencoded captures and displaying them one after the other.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.