<< return to Pixycam.com

I cannot for the life of me get the Pixy2 to work with my Raspberry pi 3 B+

I have fallowed the instructions on the Pixy2 installation guide and I still can not get the Pixy2 to work with my RPi.

I do not get the .so file when I build the libpixyusb2 library (I do get the .a file and the build does say it was successful)

anyone ran into this because I am about to just throw this pixy2 in the trash.

I have tried for a couple of hours to get this thing working, even attempted to make a CMakeList.txt file to manually create the .so file with no success as when I do the cmake … command I get an error because I do not have these two directories:

ls /home/bob1-printer-pi/pixy2/common/src
ls /home/bob1-printer-pi/pixy2/common/inc

Thanks for any assistance.

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

Hello,
Let’s try to see if we can get libpixyusb2 working first, before we try Python (which uses libpixyusb2). If it builds without errors, please try to run the get blocks example:

https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:building_the_libpixyusb_example_on_linux#color-identification-example-getblockscppdemo

If it doesn’t run, what message do you receive?

Edward