Error with OpenCV module (Computer Vision)

Titan Two general support. Questions, firmware update, feature request.

Error with OpenCV module (Computer Vision)

Postby Ketechi » Sat Feb 29, 2020 12:43 pm

Hello everyone,

I am trying the new Gtuner release with Computer Vision but I am running into an issue. So far I have been able to install python.dll fine but it appears the OpenCV is not working at all.

I installed OpenCV trough pip install I installed OpenCV with the following command "pip install target=D:\Gtuner\_Python opencv-python" as you can see on this image I was able to install OpenCV on that directory.
Image

However, on GtunerIV it shows that OpenCV is not recognized. You can see it in the following image.
Image

Is there something I am missing?

Thanks in advance for the help.
User avatar
Ketechi
Staff Sergeant
Staff Sergeant
 
Posts: 13
Joined: Thu Feb 22, 2018 8:13 pm

Re: Error with OpenCV module (Computer Vision)

Postby Scachi » Sat Feb 29, 2020 1:17 pm

For me the opencv path is like this:
C:\Users\username\AppData\Local\Programs\Python\Python38\Lib\site-packages
The file is here: C:\Users\username\AppData\Local\Programs\Python\Python38\Lib\site-packages\cv2\cv2.cp38-win_amd64.pyd
Not sure if GTuner or python needs the opencv to be in Lib\site-packages ? Maybe try to add that cv2 path to your PATH env ?
python.png
python.png (28.35 KiB) Viewed 4699 times
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Error with OpenCV module (Computer Vision)

Postby J2Kbr » Sun Mar 01, 2020 10:33 am

Scachi wrote:Not sure if GTuner or python needs the opencv to be in Lib\site-packages ?

Correct, Gtuner expects the default Python directory structure (Lib and Lib\site-packages).
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Error with OpenCV module (Computer Vision)

Postby Ketechi » Sun Mar 01, 2020 2:46 pm

Thanks, I was able to make it work. I followed the advice and installed pip on "C:\Users\ME\AppData\Local\Programs\Python\Python37\Lib\site-packages".

Now OpenCV is being recognized.
Image

In case it helps anyone what I had to do when installing OpenCV and Win32Api was the following:

For OpenCV: pip install --target=C:\Users\[your username]\AppData\Local\Programs\Python\Python[your version of python]\Lib\site-packages opencv-python

For Win32Api: pip install --target=C:\Users\[your username]\AppData\Local\Programs\Python\Python[your version of python]\Lib\site-packages pywin32
User avatar
Ketechi
Staff Sergeant
Staff Sergeant
 
Posts: 13
Joined: Thu Feb 22, 2018 8:13 pm

Re: Error with OpenCV module (Computer Vision)

Postby J2Kbr » Mon Mar 02, 2020 10:55 am

Glad you got working and thank you for sharing your findings. :smile0517:
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Error with OpenCV module (Computer Vision)

Postby GarrisonXV » Wed Nov 11, 2020 1:18 am

I fixed the issue of my cv2 not being recognized but now I am encountering a new issue when just trying to do a visual input check:
GCV Error: _win_os_check()
File "C:\Users\garri\AppData\Local\Programs\Python\Python38\Lib\site-packages\numpy\__init__.py", line 302, in _win_os_check
raise RuntimeError(msg.format(__file__)) from None
RuntimeError: The current Numpy installation ('C:\\Users\\garri\\AppData\\Local\\Programs\\Python\\Python38\\Lib\\site-packages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86
numpy.core.multiarray failed to import

Please help! I have tried Python 3.8 and 3.9. Thanks
User avatar
GarrisonXV
Sergeant
Sergeant
 
Posts: 9
Joined: Wed Nov 11, 2020 1:03 am

Re: Error with OpenCV module (Computer Vision)

Postby J2Kbr » Wed Nov 11, 2020 8:33 am

The solution is first remove your current numpy install and use numpy 1.18.1

Code: Select all
pip install numpy==1.18.1
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Error with OpenCV module (Computer Vision)

Postby GarrisonXV » Wed Nov 11, 2020 3:58 pm

J2Kbr wrote:The solution is first remove your current numpy install and use numpy 1.18.1

Code: Select all
pip install numpy==1.18.1


You are a life saver, thank you!
Here is the terminal command if anyone needs it:

python -m pip install --target=C:\Users\[Username]\AppData\Local\Programs\Python\Python[Version]\Lib\site-packages numpy==1.18.1 --upgrade

example:
python -m pip install --target=C:\Users\myUsername\AppData\Local\Programs\Python\Python38\Lib\site-packages numpy==1.18.1 --upgrade
or if you are in a python ide then its just
pip install --target=C:\Users\myUsername\AppData\Local\Programs\Python\Python38\Lib\site-packages numpy==1.18.1 --upgrade
User avatar
GarrisonXV
Sergeant
Sergeant
 
Posts: 9
Joined: Wed Nov 11, 2020 1:03 am

Re: Error with OpenCV module (Computer Vision)

Postby boxerpram » Sat Jan 09, 2021 3:03 am

GarrisonXV wrote:
J2Kbr wrote:The solution is first remove your current numpy install and use numpy 1.18.1

Code: Select all
pip install numpy==1.18.1


You are a life saver, thank you!
Here is the terminal command if anyone needs it:

python -m pip install --target=C:\Users\[Username]\AppData\Local\Programs\Python\Python[Version]\Lib\site-packages numpy==1.18.1 --upgrade

example:
python -m pip install --target=C:\Users\myUsername\AppData\Local\Programs\Python\Python38\Lib\site-packages numpy==1.18.1 --upgrade
or if you are in a python ide then its just
pip install --target=C:\Users\myUsername\AppData\Local\Programs\Python\Python38\Lib\site-packages numpy==1.18.1 --upgrade


Hello guys

I have this issue right now and do not understand what numpy and how to uninstall nor upgrade it, could you please explain in plain for a not so hi tech person here please

thanks
User avatar
boxerpram
Sergeant First Class
Sergeant First Class
 
Posts: 25
Joined: Sun Nov 08, 2020 8:28 am

Re: Error with OpenCV module (Computer Vision)

Postby Scachi » Sat Jan 09, 2021 3:12 am

boxerpram wrote:Hello guys

I have this issue right now and do not understand what numpy and how to uninstall nor upgrade it, could you please explain in plain for a not so hi tech person here please

thanks

Video: https://ufile.io/ff9ywt1q
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Next

Return to Titan Two Device

Who is online

Users browsing this forum: No registered users and 116 guests