Unable to run arch-specific checks with opencv - python

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.

Related

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

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?

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.

'Web' module cannot be found while having installed lpthw.web

I'm currently doing the exercise in "Learn python the hard way".
In this exercise i have to install the lpthw.web frame work.
Having installed pip in windows, i open my terminal and hit
pip install lpthw.web
Everything then ends succesfully.
But when i browse C:\Python27\Lib\site-packages\lpthw.web-1.1-py2.7.egg-info and check the installed-files text i can't see the web.py.
Consequently when i try to import it in a simple script i get ImportError.
I don't have python 3 installed as book suggested for possible cause, so i don't know how to work around it.
Any suggestion?
I checked my path
import sys
sys.path
and saw that every single line was using the panda3d path.
As i was not really using it, unistalling it fixed my problem.
For me it was python version control on raspberry pi
(linux) 2.7 is default and does not work.
follow:
https://learn.sparkfun.com/tutorials/python-programming-tutorial-getting-started-with-the-raspberry-pi/configure-your-pi
have other errors now but the import web loads in python.
cheers!

Python 2.7 - ImportError: No module named Image

Recently, I have been studying OpenCV to detect and recognize faces using C++. In order to execute source code demonstration from the OpenCV website I need to run Python to crop image first. Unfortunately, the message error is 'ImportError: No module named Image' when I run the Python script (this script is provided by OpenCV website). I installed "python-2.7.amd64" and downloaded "PIL-1.1.7.win32-py2.7" to install Image library. However, the message error is 'Python version 2.7 required, which was not found in the registry'. And then, I downloaded the script written by Joakim Löw for Secret Labs AB / PythonWare to register registry in my computer. But the message error is "Unable to register. You probably have the another Python installation".
I spent one month to search this issue on the internet but I cannot find the answer. Please support me to resolve my issue.
Thanks,
Tran Dang Bao
You installed the 64-bit version of Python, but the 32-bit version of PIL. Either switch to the 32-bit version of Python, or you need a 64-bit version of PIL (not available that I could find). There is pillow, a PIL-compatible replacement that might work. A 64-bit version is available here:
Pillow-2.1.0.win-amd64-py2.7.‌exe
The solution is very simple. You don't need to worry about x86 or 64 bit,
all you have to do is import as follows:
from PIL import Image
but make sure Pillow is installed.
Works for me.
Try to put the python(2.7) at your Windows path.
Do the following steps:
Open System Properties (Win+Pause) or My Computer and right-click then Properties
Switch to the Advanced tab
Click Environment Variables
Select PATH in the System variables section
Click Edit
Add python's path to the end of the list (the paths are separated by semicolons).
example C:\Windows;C:\Windows\System32;C:\Python27

ImportError: DLL load failed: Invalid access to memory location. Using aubio in Python

For a schoolproject I need to make use of the aubio library. However, I have a problem compiling it for Windows.
I downloaded the latest source from his git (0.4.0 alpha). Then I compiled it using Cygwin, using the --with-target-platform=win32 to cross-compile it for Windows. It uses waf by the way.
This works without any errors.
Next step is copying the compiled file (libaubio.dll.a) to MinGW library folder. Then I want to compile the Python wrapper for the module, but it shows up the ld.exe cannot find -laubio error. Renaming the libaubio.dll.a to libaubio.a resolves this and compiling succeeds succesfully.
Installing it into the Python folder works perfectly too. But here starts the problem. When trying to import aubio, I get this error: ImportError: DLL load failed: Invalid access to memory location.
I have no clue on how to solve this problem. Can anybody help? Or explain the error to me?
Thanks in advance!
Xander
PS. It compiles perfectly on both OSX and Ubuntu.
Well, this may not be the right solution for you, just a hint. ImportError: DLL load failed: Invalid access to memory location. I encountered the same error when trying to make my own extension of Python programmed in C. Platform: Windows 32bits.
It was a real pain because this error appeared randomly in interactive as well as in non-interactive mode in all Python environments (Spyder, Notebook, plain console...). I compiled my code using MinGW and Python's distutils (command python setup.py install). The compilation gave no warnings or errors and produced pyd file to the correct directory. But when trying to import this module import example pro my Python code it irregularly crashed (usually only one out of five attempts to import the module succeeded).
Strange was that on another computer it worked just fine... Well, finally I found workaround - I downloaded a newer version of MinGW (before I had used the version that comes packed in Qt SDK distribution) and compiled the module again. Then it worked with no more crashes. However I did not find any systematic solution or explanation. So I might have something to do with the compiler (maybe absence of its DLLs? I do not know exactly) that was used to generate the pyd file.

Categories