Pyzbar works not good with Ubuntu - python

I want to decode a QR-Code on Ubuntu/Linux. I installed the libary and started the Code. The result is an empty array. On my windows device the result is the correct code data. Can anyone try the Code on there linux device and if it works tell me the way to install the pyzbar libary correct, i think there is the problem. If you have any other ideas, please let me know.
Image(Code)=https://www.directupload.net/file/d/5519/tsv8hg76_jpg.htm
I tried the Code on windows and it works perfectly fine.
On ubuntu i installed the libary like this https://pypi.org/project/pyzbar/
import cv2
import pyzbar.pyzbar as pyzbar
Image = cv2.imread("wfunktioniert.jpg",0)
decodedObjects = pyzbar.decode(Image)
print(decodedObjects)
print("Ende")
No errors, just no correct result

I encounter this problem today. One picture decoded fine on my MAC but not decoded on my ubuntu server.
I finally find out that my ubuntu server RAM is too small, it's only 2G, but my MAC has 16G. And I created a VM with 4G RAM, test the picture again with pyzbar, it decoded successfully.
So I think you can try to add more RAM to your machine.
Or you can try zxing. I found out that zxing decoded the picture with 2G RAM.

You can use
from pyzbar import pyzbar to import the module
And to decode
barcode=pyzbar.decode(image)
Zbar opencv link
Follow the link.

Related

need help QR code scanning and get info in IronPython 27

Need to scan a QR image using IronPython2.7
Iron Python does not support PIL, cv2, ....
Kindly someone help in scanning QR code using IronPython 2.7
I am having hard time finding the solution.
I tried in Python 2.7 using PIL and cv2.. It works like Pro. but it doesn't works in IronPython 2.7
Errors like no module cv2, cannot import _imaging is the error I am getting

Problem in Using opencv and pytesseract for extracting text out of images in Python3.7 interpreter

I intend to use opencv and pytesseract to extract text of out images. On executing the following code in a Python 3.7 Interpreter, I am receiving a error I'm not sure I understand.
import cv2
import pytesseract
#tesseract.exe location provided
pytesseract.tesseract_cmd=r'C:\\Users\\shree\\AppData\\Local\\Programs\\Tesseract-OCR\\tesseract.exe'
#image location provided
img=cv2.imread('C:\\Users\\shree\\Desktop\\hey.jpeg')
text=pytesseract.image_to_string(img)
print(text)
error shown
P.S:
I have installed opencv and pytessearct in
"C:\Users\shree\AppData\Local\Programs\Python\Python37-32\Scripts"
Python 3.7 Interpreter is installed in
"C:\Users\shree\AppData\Local\Programs\Python\Python37-32"
Please excuse if this is an obvious/dumb question. Actually, I'm just starting out. I read about this at https://towardsdatascience.com/read-text-from-image-with-one-line-of-python-code-c22ede074cac
A Detailed answer and an alternate way(if required) would be highly appreciated.
Thanks!
Replace the line,
pytesseract.tesseract_cmd=r'C:\\Users\\shree\\AppData\\Local\\Programs\\Tesseract-OCR\\tesseract.exe'
with,
pytesseract.pytesseract.tesseract_cmd = r'C:\\Users\\shree\\AppData\\Local\\Programs\\Tesseract-OCR\\tesseract.exe'
This should fix the issue if tesseract is installed properly.

cannot get frame from openni device in python-opencv

I am using raspberry pi to get frames from ASUS Xtion openni device.
Python-opencv, OpenNI, and OpenCV are installed on raspberry pi correctly.
I am using the following code:
import cv2
import cv2.cv as cv
capture = cv2.VideoCapture(cv.CV_CAP_OPENNI)
capture.set(cv.CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE. cv.CV_CAP_OPENNI_VGA_30HZ)
okay, color_image = capture.retrieve(0, cv.CV_CAP_OPENNI_BGR_IMAGE)
This code was working without any problems before. But now, I always get "okay" value as "false". How can I fix this problem?
Thanks,
Do you have the v4l drivers?
If not
sudo modprobe bcm2835-v4l2

PIL decoder JPEG not available Raspberry

i'm trying to utilize PIL to open a jpeg image and assign it to a Tkinter's label.
However whenever i try to open the image i get the same problem as this guy
I tried all the suggestions he got and also the ones i found here but it doesn't seem to fix, by installing PIL or Pillow(i tried that too) during the setup i get :
*** TKINTER support not available
*** JPEG support not available
And whenever i run my code i get an IOError: decoder jpeg not available
I'm using python 2.7.
Can someone provide a good method to make PIL or Pillow work with jpeg support? I've been googling extensively for two days, but all the possible fixes that i found don't seem to work for me
Installing libjpeg-dev should do the trick, as proposed by the link you provided. But if it doesn't help (I ran into that as well) you can consider upgrading to Pillow 3, it looks like you are running Pillow 2. This also helped me getting rid of the errors, don't know why exactly..

Using OpenKinect on Raspberry pi in python

I am very new to raspberry pi and python.
I am trying write a progam using python on raspberry pi to use the Kinect. I aim to install OpenKinect on Raspberry pi.
So far I have done:
apt-cache search OpenKinect
sudo apt-get install python-freenect
sudo apt-get update
Next i tried writing a code in python from this link https://github.com/OpenKinect/libfreenect/blob/master/wrappers/python/demo_cv_async.py
When i try to run the programe, it says that
error in line 5,
import cv.
ImportError:no module named cv.
I am not sure if i have installed all the necessary files. I am also not sure what i have done wrong.
I also have been trying to look for tutorials on installing and using OpenKinect.
Congradtulations on starting python! That sounds like a complicated project to start on. You should probably try doing the tutorial first at python.org. I particularily like the google video tutorials (if you are a classroom kind of person): http://www.youtube.com/watch?v=tKTZoB2Vjuk
After that you can dig into more detailed stuff :)
It looks like you still dont have opencv package for python. Try to install it:
sudo apt-get install python-opencv
The OpenGL or GTK-Warning: Cannot open display. Or the other one you stated
Number of deviced found:1 GL thread write reg 0x0105 <= 0x00 freeglut(freenect-glview):
OpenGL GLX extension not supported by display ':o.o'
is because freenect does not support OpenGL. It probably uses EGL.
bmwesting (Brandt) wrote:
"The freenect library provides a demo for the Kinect called glview. The glview program will > not work with the Pi because the program is written using OpenGL. The Raspberry Pi only supports GLES through EGL.
It seems like you will be able to use libfreenect to grab the depth stream and rgb stream, > but will be unable to run the demo program because it uses the incorrect graphics API."
If you read through that thread, it should show the alternatives (i.e. ASUS XTion instead of Kinect). They reach 30fps at high (~ 1024x800) resolution for depth data if using console output mode. I plan to go for Xtion now too - and I hope to get deactivate as much as possible from the USB bus (as this seems to be the bottleneck, for the Kinect too I think).
When you install OpenCV using apt-get install python-opencv you are installing version 2. However, you can still use the methods from version 1 by doing so:
import cv2.cv as cv

Categories