Linux-sdk-python camera error

hi good day again, i am trying to run my simple model locally using the linux-sdk-python,
inside the image, i found the script and try to run using this command together with my model: pi@raspberrypi:~/linux-sdk-python/examples/image $ python3 paper-plastic-battery.eim

i am getting this one:
[ WARN:0] global /tmp/pip-wheel-qd18ncao/opencv-python/opencv/modules/videoio/src/cap_v4l.cpp (893) open VIDEOIO(V4L2:/dev/video1): can’t open camera by index

also, i am curious about this script, when this is run does this open a camera window where you can see your model?

i did try to google the error to see if i can find any solution and found this forum: —but it did not help me either

i am using a camera module not a usb webcam, this is my version of opencv:


any help would be much appreciated,


Hi @MarLon4321, you can try this:

$ python3 paper-plastic-battery.eim 0

To try and select a different camera (if this does not work set to 1 or 2)

If you set this to True you’ll get a preview:

wow thank you for the fast reply! it did work but i am not getting any preview
i did this : show_camera = True

maybe i did something wrong because i dont see any preview in the screen

@MarLon4321 Ah, the example didn’t show the camera for object detection. I’ve updated the example now here

ok so it did work again but it seems that the bounding boxes is not visible,

@MarLon4321 See the updated script I sent, it draws the boxes too (although all in the same color):

thank you @janjongboom, it work like charm, now i am trying to figure out how to add a label and the confidence score at the top of the bounding boxes, any suggestion?

@MarLon4321 cv2.putText I’d reckon:

@janjongboom i did manage to put the label and accuracy score, thank very much for the help! sorry for being such a noobie…


Whoohoo! Awesome, thanks for reporting back.

i am planning to add some style to the text like adding a background color or maybe changing the stylefont, oh and by the way i am building a simple machine that can detect garbage and segregate them properly with the help og A.I and also your platform EGDE IMPULSE, my hardware is already set up including the prototype (raspberry pi4,stepper motor, servo motor, and some bunch of accesories connected to the Pi)and the only thing i am working on is this, the software side, currently it is trained to detect three garbagetype: obviously paper,plastic bottle,and a battery

in the future i will add more sample so that it can detect more types of garbage and hopefully i can deploy the machine to a small community near me and be able to raise awareness to them on how to properly segregate their own garbage