opencv is refusing to import because libcblas.so.3 is missing - python

I'm trying to build a text recognition system from images and I decided to use opencv and pytesseract to do this.
I'm new to using a raspberry pi so I'm using the thonny python ide that came preinstalled on the legacy os. I'm running the legacy os because I'm using a camera module to capture and save the images.
I pip installed both and both commands in the terminal stated that they were both successfully installed. Pytesseract appears to be working fine when I import it but opencv always throws an import error stating
libcblas.so.3: cannot open shared object file: no such file or directory
How can I fix this problem?

Related

Why the Python crashes on importing cv2?

I am just beginning to learn OpenCV in python for a face recognition project, I installed opencv-python in an python environment using pip and tried to run this simple program
import cv2
img = cv2.imread('.\\jerry.jpg',1)
cv2.imshow('jerry',img)
cv2.waitKey(0)
but as I executed this, the python stoped without any error. Like this:
(venv) C:\Users\ashok\Documents\_StudyMaterial\Code\Face Recognition - Open CV practice>python -u "c:\Users\ashok\Documents\_StudyMaterial\Code\Face Recognition - Open CV practice\1_read.py"
(venv) C:\Users\ashok\Documents\_StudyMaterial\Code\Face Recognition - Open CV practice>
When I run this program
a = 12
b = 2131
print(a+b)
import cv2
print(cv2.__version__())
It outputs
(venv) C:\Users\ashok\Documents\_StudyMaterial\Code\Face Recognition - Open CV practice>python -u "c:\Users\ashok\Documents\_StudyMaterial\Code\Face Recognition - Open CV practice\simple.py"
2143
(venv) C:\Users\ashok\Documents\_StudyMaterial\Code\Face Recognition - Open CV practice>
This confirmed python stopped working on statement import cv2
This same is also happening when i tried to import numpy
I tried searching for this, but all in vain. I reinstalled opencv-python, deleted and again created virtual environment, tried uninstalling and reinstalling numpy, but it didn't helped.
I am using windows 7 32-bit, python 3.8.10, these are the installed libraries in the environment
numpy==1.24.1
opencv-python==4.7.0.68
Please help me out, I am stuck here. If any other details are required, please let me know.
Thanks
Edit:
I have figured something out, It is being caused because of numpy, when cv2 imports numpy, it crashed there. This issue is being discussed at github
I tried to reinstall opencv-python, numpy. Destroyed and recreated virtual environment.

How to run Python libraries PIL and pillow in the Unreal Editor

I am currently attempting to run a Python file inside of the Unreal Editor's scripting environment that imports and uses the pillow (PIL fork) library's Image module:
from PIL import Image
However in the Unreal Editor's log I am getting the below error message when I try to run this script:
LogPython: Error: ModuleNotFoundError: No module named 'PIL'
I already have pillow installed on my computer, however the Unreal Editor doesn't seem to have it installed in it's internal Python package.
Is there any way I can execute or install pillow into the Unreal Editor?
I would be curious to see others approaches but I've found that adding Pythons site-packages path to the PYTHONPATH at Unreal Startup to be the ideal approach.
In the Unreal Python Settings (Edit > Project Settings > Search Python) you have the option to add a script that executes at start up. It's here we append any paths needed in our Pipeline.
import sys
if __name == '__main__':
sys.path.append("C:\\python37\\Lib\\site-packages")
Assuming you have PIL, or PySide2 or any other library pip installed then it should become available.

Unable to run arch-specific checks with opencv

I am using a Raspberry Pi and wanted to compile opencv on it, then build the .so file and then re-install the pi and just use the .so file instead of having the entire 4Gb of opencv on the SD Card (since I'm just running code, not developing anything).
So I have one SD Card with the full 4Gb of opencv that I used to compile the .so file, on that system in my python script I can use import cv2 and give the correct PYTHONPATH and it works just fine.
However, when I put my other SD Card in (with the exact same version of the OS, the cards were an exact clone before I installed opencv) I put the cv2.so in the directory of the python script and I run it with import cv2 and I receive this error:
ImportError: cv2.so, Unable to run arch-specific checks
I don't understand this at all. Can I not do this with a .so file? It's the exact same Pi and OS so I don't understand where it runs into trouble with the architecture.
I read somewhere that compiling a static library .a might help, but I believe I would need to translate my code from python to C++, could that work perhaps?
I am using opencv version 3.1.0, and the latest raspbian jessie on a Pi 3.
Any help is much appreciated, thank you.
I still don't know how to fix that exact error, but I got OpenCV installed and running without issue using the following gist: https://gist.github.com/willprice/c216fcbeba8d14ad1138
I was not able to get it to run as a standalone include, however. I had to leave the entire library and IDE installed.

How can I recognize numbers from a picture using python and an OCR engine?

Hi everyone what I'm trying to do is to make python recognize this picture just the number 96 in a white background. and to show me a "96" in string, that's all.
For that purpose I have installed pytesseract into python using the command prompt (pip install pytesseract), I also have installed Pil (which is pillow now, and also installed it using command prompt), Tesseract OCR engine is also installed on my computer, I downloaded it and installed it, is in my environmental variables (typing the path command in the command prompt it shows me Tesseract-OCR), and finally I also downloaded the pytesser, unzipped the file to the directory: C:\Python27\Lib. Almost forgot to mention, the version of python I have is 2.7.12 and the OpenCV version installed is 3.1.0.
What I did, is to run the following script:
from PIL import Image
import pytesseract
img=Image.open('E:\Alex2016\Python OpenCV\Scripts\imagenFinal.jpg')
a=pytesseract.image_to_string(img)
print(a)
img.show()
And it only shows me the image but no "96" string. I'm new at this guys, I don't even know if I'm really using the Tesseract-OCR which I know is a super powerful engine for these things. I'm runing my script in the python shell. I have to mention also that I couldn't be able to make pytesser work, because when trying to "import pytesser" or doing "from pytesser import *" like I've seen in other sites, I get this error
import pytesser
ImportError: No module named pytesser
I think this image is pretty understandable and noisy free, so guys if you could tell me how I can detect numbers with these tools or if there is any other that could make this, thanks a lot for your time guys I'm new at this stuff but I'm really interested on this field of science, the computer vision technology.

How to import cv2 in python project "Visual Studio 2015"?

I would like to start with OpenCV . I followed some tutorials for installing OpenCV in Windows.
After downloading and extracting OpenCV
First, I create environment variable and path
Then I moved to python in Visual Studio. I installed python and I started with a very simple tutorial, but I faced some problems with python.
First problem was with numpy module was not found. solved
cv2 error I couldn't solved it, I followed instruction said that I need copy cv2.pyd file in ..\Python34\Lib\site-packages
afterword I tried to >>> import cv2
but I got this error
Thanks for all of you.

Categories