Hello guys
Home Assistant 0.71.0
i have installed OpenCV 3.4.1 with this commands:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install python2.7-dev python3-dev
cd ~
wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.4.1.zip
unzip opencv.zip
wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.4.1.zip
unzip opencv_contrib.zip
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
source /srv/homeassistant/bin/activate
pip install numpy
cd ~/opencv-3.4.1/
mkdir build
cd build
cmake -D PYTHON_LIBRARIES=/usr/lib/arm-linux-gnueabihf/libpython3.5m.so -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.1/modules -D INSTALL_C_EXAMPLES=OFF -D BUILD_opencv_python3=yes ..
make -j4
sudo make install
sudo ldconfig
there is e file cv2. ?
ls -l /usr/local/lib/python3.5/site-packages/
sudo cp /usr/local/lib/python3.5/site-packages/cv2.cpython-35m-arm-linux-gnueabihf.so /usr/local/lib/python3.5/site-packages/cv2.so
cd /srv/homeassistant/lib/python3.5/site-packages/
sudo ln -s /usr/local/lib/python3.5/site-packages/cv2.so cv2.so
test inside venv
python
import cv2 as cv
print(cv.__version__)
3.4.1
Also inside venv
sudo pip3 install opencv-python==3.4.1.15
sudo pip3 show opencv-python
Name: opencv-python
Version: 3.4.1.15
Summary: Wrapper package for OpenCV python bindings.
Home-page: https://github.com/skvark/opencv-python
Author: Olli-Pekka Heinisuo
Author-email: UNKNOWN
License: MIT
Location: /usr/local/lib/python3.5/dist-packages
Requires: numpy
image_processing.yaml
- platform: opencv
name: "image processing test"
source:
- entity_id: camera.Ingresso
classifier:
me: /home/homeassistant/.homeassistant/classifier/haarcascade_fullbody.xml
But i find this error inside a log files
2018-06-14 16:50:06 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2018-06-14 16:50:07 ERROR (MainThread) [homeassistant.helpers.entity] Update for image_processing.opencv_ingresso fails
cv2.error: OpenCV(3.4.1) /home/pi/opencv-3.4.1/modules/core/src/persistence_c.cpp:384: error: (-49) Input file is empty in function cvOpenFileStorage
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 204, in async_update_ha_state
yield from self.async_device_update()
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 325, in async_device_update
yield from self.async_update()
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/image_processing/__init__.py", line 145, in async_update
yield from self.async_process_image(image.content)
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/image_processing/opencv.py", line 172, in process_image
cascade = cv2.CascadeClassifier(path)
SystemError: <class 'cv2.CascadeClassifier'> returned a result with an error set
2018-06-14 16:50:09 ERROR (MainThread) [homeassistant.helpers.entity] Update for image_processing.opencv_ingresso fails
cv2.error: OpenCV(3.4.1) /home/pi/opencv-3.4.1/modules/core/src/persistence_c.cpp:384: error: (-49) Input file is empty in function cvOpenFileStorage