I think maybe it may not be a build issue but I am not sure:
I cant seem to use the python library for the pixy though
Traceback (most recent call last):
File “/home/bob1-printer-pi/Video_Capture.py”, line 5, in
import pixy
ModuleNotFoundError: No module named ‘pixy’
here is the code I am trying to run:
import sys
sys.path.append(’/home/bob1-printer-pi/pixy2/src/host/libpixyusb2/python_demos’)
import pixy
from pixy import BlockArray
import tkinter as tk
from PIL import Image, ImageTk
import numpy as np
Initialize Pixy2
pixy.init()
pixy.change_prog(“color_connected_components”)
Create a tkinter window
root = tk.Tk()
root.title(“Pixy 2 Video Capture”)
root.geometry(“800x600+1120+0”) # Window size 800x600, positioned at top right corner
Create a label widget to display the video feed
lbl_video = tk.Label(root)
lbl_video.pack()
Function to update the video feed in the tkinter window
def update_video_feed():
blocks = BlockArray(100)
count = pixy.ccc_get_blocks(100, blocks)
if count > 0:
block = blocks[0]
# Create an empty image
img = np.zeros((pixy.video_get_height(), pixy.video_get_width(), 3), dtype=np.uint8)
# Here, the block does not contain image data. Normally, you would draw rectangles where the blocks are detected.
# This example will just create an empty window to show how it works.
img = Image.fromarray(img)
imgtk = ImageTk.PhotoImage(image=img)
lbl_video.imgtk = imgtk
lbl_video.configure(image=imgtk)
lbl_video.after(30, update_video_feed) # Lower frame rate
Start updating the video feed
update_video_feed()
Close the tkinter window when ‘q’ is pressed
def on_closing(event):
if event.keysym == ‘q’:
root.destroy()
root.bind(’’, on_closing)
Run the tkinter main loop
root.mainloop()
please let me know what I am doing wrong here.
thank you