Question: Using Thonny Application within Raspberry pi 4 6 4 - bit Bullseye system. Picamera 2 seems to be the lastest module in order to use
Using Thonny Application within Raspberry pi bit Bullseye system. Picamera seems to be the lastest module in order to use a raspberry pi camera. I am working on a YOLOv object detection test witht the use of a raspberry pi camera. This code works well with a webcam before I change the code a bit. Can you please help me make this code to detect with the use of a raspberry pi camera. My only problem is that I am having a hard time make the raspberry pi camara to work with object detection. Thank you so much.
import tkinter as tk
import torch
from picamera import Picamera
import cv
import numpy as np
from PIL import Image, ImageTk
app tkTk
app.geometryx
app.titleObjectTest
label tkLabelapp text'detectionTest', fontArial
labelpackside'top', pady
vidFrame tkFrameheight width
vidFrame.pack
vid tkLabelvidFrame text
vid.pack
picam Picamera
camera picam
def detect:
frame npempty dtypenpuint
camera.captureframebgr usevideoportTrue
results modelframe
outputimage results.render
displayimage Image.fromarrayoutputimage
imgtk ImageTk.PhotoImageimagedisplayimage
vid.imgtk imgtk
vid.configureimageimgtk
vid.after detect
detect
app.mainloop
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
