Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

so i made a camera app for the hq camera but i cannot take any sort of pictures on my raspberry pi 4!

from guizero import App, PushButton
from picamera import PiCamera

camera = PiCamera()

app = App()
def preview():
    camera.start_preview(fullscreen=False, window = (50,150,2048,1152))
    
button = PushButton(app, command=preview, text="preview")
def stop_preview():
    camera.stop_preview()
    
button = PushButton(app, command=stop_preview, text="stop preview")
def shutter():
    camera.capture('/home/pi/Desktop/image.jpg')
    
button = PushButton(app, command=shutter, text="shutter")
app.display()
question from:https://stackoverflow.com/questions/65867654/unable-to-capture-images-using-python-image-gets-corrupted

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
902 views
Welcome To Ask or Share your Answers For Others

1 Answer

nevermind i got it working! here is my code!

from picamera import PiCamera

camera = PiCamera()
camera.resolution = (1920, 1080)

app = App()
def preview():
    camera.start_preview(fullscreen=False, window = (50,150,2048,1152))
    
button = PushButton(app, command=preview, text="preview")
def stop_preview():
    camera.stop_preview()
    
button = PushButton(app, command=stop_preview, text="stop preview")
def shutter():
    camera.capture('/home/pi/Desktop/image.jpg')
    
button = PushButton(app, command=shutter, text="shutter")
app.display()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...