examples-camera: Coral dev mini opencv error

Hi, I’m testing the examples with coral mini board!

But, I’ve got the error. I can’t execute the opencv examples.

mendel@silly-quill:~/google-coral$ cd examples-camera/
mendel@silly-quill:~/google-coral/examples-camera$ ls
all_models       download_models.sh  LICENSE    opencv  raspicam
CONTRIBUTING.md  gstreamer           nativeapp  pygame  README.md
mendel@silly-quill:~/google-coral/examples-camera$ cd opencv/
mendel@silly-quill:~/google-coral/examples-camera/opencv$ ls
detect.py  install_requirements.sh  README.md
mendel@silly-quill:~/google-coral/examples-camera/opencv$ bash install_requirements.sh
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-opencv is already the newest version (3.2.0+dfsg-6).
0 upgraded, 0 newly installed, 0 to remove and 89 not upgraded.
mendel@silly-quill:~/google-coral/examples-camera/opencv$ python3 detect.py
Loading ../all_models/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite with ../all_models/coco_labels.txt labels.
Unable to stop the stream: Invalid argument

The error message is so simple that I cant’ figure out what the problem come from. I need help.

Regards,

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20

Most upvoted comments

I ran into the same issues. I struggled trying to install various versions via pip and finally got it to work by building openCV from scratch. I used the script here for that: https://github.com/milq/milq/blob/master/scripts/bash/install-opencv.sh

Note: There was a file instead of a directory at /usr/local/share - I’m not sure where that came from but I had to remove it and make sure there was a /usr/local/share/licenses directory for the make install part of the script.

WARNING - the build process took me 12+ hours (maybe more since I stopped monitoring it and went to bed). There were a few points where it looked like thought it froze since no progress was reported for more than an hour, but it kept going. Run this locally or use something like screen - my ssh connection broke and I had to start over.

This installed OpenCV 4.5.1. I also had to set the camera index to 1 as @alengcm mentioned.

Here is what I ran.

cd ~
wget https://raw.githubusercontent.com/milq/milq/master/scripts/bash/install-opencv.sh
chmod u+x install-opencv.sh
ls /usr/local/share/licenses
# make sure this directory exists - /usr/local/share was a text file for me, so I renamed that
# mv /usr/local/share /usr/local/share.bak
# mkdir /usr/local/share
# mkdir /usr/local/share/licenses
./install.sh
cd coral/examples-camera/opencv
# make sure to set the display if you ssh in
DISPLAY=:0 python3 detect.py --camera_idx 1

Request for the Coral team: please fix the build in the next Mendel release to avoid this process.

For me it wasn’t as easy and it took me many many many hours to get it finally working. And to make the pain less for future people, here is the right numpy with the right opencv-python-headless wheels for you to install. Just repeating it for the lazy reader what this is:

TO FIX

VIDIOC_QUERYCTRL: Inappropriate ioctl for device
VIDIOC_QUERYCTRL: Inappropriate ioctl for device
VIDIOC_QUERYCTRL: Inappropriate ioctl for device

USE THESE WHEELS:

opencv-python-headless.zip numpy-1.19.5.zip