need help QR code scanning and get info in IronPython 27 - python

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

Related

ImageGrab is not accessed by pylance

Looking to use PILLOW (PIL) to do an imagegrab. The purpose of the imagegrab is to view a box on the screen to see incoming things in a flash game. I did pip install pillow in my terminal. I want to put from PIL import imagegrab When I put that text into where I write my script it says:
"ImageGrab isn't accessed by pylance".
I'm not sure what the issue is with the library for PILLOW or what I should do to fix this. FYI I'm very new to coding, this is week 1 for me.
Error Code in Visual Studio Code:
This is a warning from the static code analyzer PyLance saying you are not using ImageGrab in your code yet (it's an idle import, basically). It shouldn't affect the execution of the code.

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.

Pyzbar works not good with Ubuntu

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.

Capturing frames from macbook isight with PIL

I'm trying to write an app using python and PIL that involves processing frames from my macbook camera. Is there an easy way to capture frames from the iSight for use with PIL without installing too many libraries?
I've seen a few questions on SO about doing this with OpenCV, which I don't want to do. Can I do this without using OpenCV as I've had trouble installing that?
Maybe you can try using the SimpleCV library. After installing it, the following code should work:
from SimpleCV import Camera
from SimpleCV import Image
webcam_camera = Camera()
webcam_image = webcam_camera.getImage()
webcam_image.save("frame.jpg")
Although OpenCV would be a much better option. If you follow the instructions on their website, it wouldn't be too hard to get it up and running.

difference in using the import and from * import statement

When I install PIL http://www.pythonware.com/products/pil/ on 32 bit python, I can use import Image and then use the Image library inside PIL. However, for the 64 bit python, I downloaded http://www.lfd.uci.edu/~gohlke/pythonlibs/. However, when I use import Image, it gives me error, "No Module named Image". However, I can use from PIL import Image.
Why is that I can use import Image directly in one instance and not in another?
You want to install Pillow instead.
It comes in both 32 and 64 bit variants for Windows, and has fixed long-standing issues with the original PIL library.
The PIL library has long been broken when it comes to packaging. Pillow was started as a fork to fix these issues once and for all, and version 2.0.0 added Python 3 support (with a grant from the Python Software Foundation).
They're different libraries. Or, to be specific, they're different packaging of the same library.
PIL is notorious for these sort of issues. Just use Pillow instead.

Categories