Closed Hat3 closed 5 years ago
I have problems too with open cv.
I keep getting:
2018-08-27 16:27:56 ERROR (Thread-3) [homeassistant.components.image_processing.opencv] No OpenCV library found! Install or compile for your system following instructions here: http://opencv.org/releases.html
I'm running HA on Raspbian Stretch on Rpi 3.
I've installed opencv-python in venv using pip3 install opencv-python
, I've installed opencv-python in raspberry using sudo apt-get install opencv-python
.. everything I do, I get that opencv is installed but HA doesn't find library.
Is there any way to add a install guide in the docs? I see a lot of people on Google that have problems. (I tried to switch to dlib but HA then hangs up, so it's unusable for me)
solved installed libqtgui4
and libqt4-test
on raspbian stretch
Can you tell me all the commands that you used please?
@Hat3 I did several tests so I really think there are some passages that are superfluous. The process I suppose that worked is the following (I use raspbian):
I followed that guide for python3: https://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/
Then inside homeassistant venv:
pip3 install numpy
pip3 install opencv-python==3.4.2.17
after this I was still having libraries issues running:
python3
>>> import cv2
so from /home/pi :
sudo apt-get install libqtgui4
and
sudo apt-get install libqt4-test
then rebooted and it worked
I has follow your instruction but i receive the identical error...
Aug 29 15:17:50 rasp-server hass[389]: 2018-08-29 15:17:50 ERROR (MainThread) [homeassistant.helpers.entity] Update for image_processing.opencv_ingresso fails
Aug 29 15:17:50 rasp-server hass[389]: cv2.error: OpenCV(3.4.2) /home/pi/packaging/opencv-python/opencv/modules/core/src/persistence_c.cpp:388: error: (-49:Unknown error code -49) Input file is empty in function 'cvOpenFileStorage'
Aug 29 15:17:50 rasp-server hass[389]: During handling of the above exception, another exception occurred:
Aug 29 15:17:50 rasp-server hass[389]: Traceback (most recent call last):
Aug 29 15:17:50 rasp-server hass[389]: File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 199, in async_update_ha_state
Aug 29 15:17:50 rasp-server hass[389]: yield from self.async_device_update()
Aug 29 15:17:50 rasp-server hass[389]: File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 320, in async_device_update
Aug 29 15:17:50 rasp-server hass[389]: yield from self.async_update()
Aug 29 15:17:50 rasp-server hass[389]: File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/image_processing/__init__.py", line 149, in async_update
Aug 29 15:17:50 rasp-server hass[389]: await self.async_process_image(image.content)
Aug 29 15:17:50 rasp-server hass[389]: File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
Aug 29 15:17:50 rasp-server hass[389]: yield self # This tells Task to wait for completion.
Aug 29 15:17:50 rasp-server hass[389]: File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
Aug 29 15:17:50 rasp-server hass[389]: future.result()
Aug 29 15:17:50 rasp-server hass[389]: File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
Aug 29 15:17:50 rasp-server hass[389]: raise self._exception
Aug 29 15:17:50 rasp-server hass[389]: File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
Aug 29 15:17:50 rasp-server hass[389]: result = self.fn(*self.args, **self.kwargs)
Aug 29 15:17:50 rasp-server hass[389]: File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/image_processing/opencv.py", line 170, in process_image
Aug 29 15:17:50 rasp-server hass[389]: cascade = cv2.CascadeClassifier(path)
Aug 29 15:17:50 rasp-server hass[389]: SystemError: <class 'cv2.CascadeClassifier'> returned a result with an error set
OK checked this in HA 0.78.0 and works fine, therefore the issue is not due to the HA component. I used pip install opencv-python
which is pre-compiled and much faster/easier than a full install.
@Hat3 the error you report (cascade = cv2.CascadeClassifier(path)
) indicates that the .xml classifer file (/home/homeassistant/.homeassistant/classifier/haarcascade_fullbody.xml
in your case) has a problem. You can follow the steps in my notebook here to troubleshoot.
Recommend you comment out your custom .xml classifier and try the default, which gets downloaded to the HA config folder as below:
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:
This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍
Hello guys
Home Assistant 0.71.0 i have installed OpenCV 3.4.1 with this commands:
build log
test inside venv
Also inside venv
image_processing.yaml
But i find this error inside a log files