Re: [orca-list] OCR Current Window
- From: chrys87 <chrys87 web de>
- To: covici ccs covici com, orca-list <orca-list gnome org>
- Subject: Re: [orca-list] OCR Current Window
- Date: Sun, 01 Feb 2015 22:26:41 +0100
Its the Python Imaging Library
https://en.wikipedia.org/wiki/Python_Imaging_Library
sometimes also called pillow
on Arch its this packet:
community/python-pillow
Am 01.02.2015 um 19:13 schrieb covici ccs covici com:
Amoung the requirements is PIL, what is that, never heard of it so I
cannot tell if I have it or not.
Thanks.
chrys87 <chrys87 web de> wrote:
Hi List,
by the way i uploaded a new version of the OCR script. maybe someone
is interesting in testing.
changelog:
1. fixed a bug that you cant klick an object behind the "list of"
dialog
2. di also add the possibility to middleklick
3. reorganize the interface a litte. (now the "enter" key is a
leftklick by default.
4. make type ahead working in the list
5. now there should also less false entrys in the "list of"
words. Just put entrys with alphanumerical content in the list.
its not perfect for know. there 4 known things to do:
1. BUG: if you call the OCR function a second time - the dialog
appears behind the current window.
2. Feature: OCR current window. For know i just can OCR the whole
desktop because i cannnot get the possition of the current window. so
i cannot calculate the mousepos for klicking or moving to the selected
object correctly.
3. find an python way to take a screenshot.
4. :) clear up the code. Put everything in a single "OCRScreen" class.
I cant call it stable before the bugs are fixed. so be careful.
maybe someone have an idea to solve one of this problems or wanna help
by submitting code, just let me know. Thanks for any help.
copy the script to your home - install the depencys (first line in the
script) and press orca + m for use it.
http://crivatec.de/page/uploads/Downloads/Accessible%20Games/orca-customizations.py
I hope that the script is near on pair with the NVDA one (for the
parts that i know) until end of the week. So orcausers can also
benefit by using OCR.
Chrys over and out :)
Am 29.01.2015 um 20:39 schrieb chrys87:
Hey out there,
i did some more work on the OCR Window Script. Thanks for your
replay and the good explanations :).
What does the script now?
- OCR the whole desktop (i have some problems to find the current
window position -> wnck segfaults here, maybe someone know how i can
get the coordinates of the active window.)
- a "list of" form pops up ( like the cute "list of" feature in the
browsers, sorry joanie i stole many of your generic list code,
because i was to stupid to just use it for my case)
- you can select a entry
- you can route the mouse over the object
- you can _leftklick/ _rightklick _doubleklick (here i have the
problem -> the "list of" window is sometimes overlayed to the object
you wanna click to -> here i m searching for a solution. maybe one
of you knowes more than i. Just let me know.
- the result is stored in you clipboard ( if you wanna copy some
strings, just paste in the gedit)
i m also searching for a way to take a screenshot in "the python
way" instead of just run gnome-screenshot.
An other (big) problem is that orca does not react to shortcuts if
the current window is not accessible ^^. can anybody confirm this
problem?
if someone wanna test its on my server:
http://crivatec.de/page/index.php?page=download-area
or just the direct link:
http://crivatec.de/page/uploads/Downloads/Accessible%20Games/orca-customizations.py
its not the cleanest code but it works for me. i will investigate
more times later.
# Requiere: python3, tesserwrap >=0.1.6, GTK, tesseract ,PIL , orca
=3.14
Cheers Chrys
Am 28.01.2015 um 15:18 schrieb Mallard:
Hello there,
Oh, bless you!
This function has been performed by a specific add-on in NvDA for
quite a while now, and I use it a lot.
It can make quite a bit of difference when ou're working with
documents that are images only, like pdf or jpg files, where you
have text that hasn't been ocr'd before.
You can also locate buttons, controls and the like, and left- or
right click as need be. You can scan the whole window or just an
object, which you can pre-select...
Jaws has an internal OCR function too, but I don't know how it
works, because I don't have Jaws on my pc. What I know, though, is
that it should b based on Omnipage, which is a very bulky
programme, though it's more accurate than Tesseract.
Please, keep up this project! This would really enhance the
usability and value of Orca for blind users.
Ciao,
Ollie
Il 26/01/2015 23:28, chrys87 ha scritto:
Hi Guys,
i play a little arround with tesserwrap. i dont know if it really make
sense but maybe someone need this.
i wrote a little orca-cust for taking a screen shot of the current
window and pass it through tesseract. just press
orca + m
orca will start reading the content of the window (maybe the image
program or browser with pictures or an other not accessible
content) and
set it to the clipboard.
You need tesseract tesserwrap, your tesseract-language-pack and orca >=
3.14
hier is the cust script for those who are interested in:
# Requiere: tesserwrap, tesseract, orca >=3.14
# -*- coding: utf-8 -*-
#Python
import os
from PIL import Image
import locale
#tesseract
from tesserwrap import tesseract
#GTK/GDK
from gi.repository import Gtk, Gdk
# Orca
import orca.orca
import orca.input_event
import orca.settings
import orca.keybindings
import orca.speech
import orca.braille
#Settings-
#this is need by arch for correct braille
orca.settings.tty = 1
#Settings+
#Bind Function to key-
myKeyBindings = orca.keybindings.KeyBindings()
def DefineShortcut(pHandle,pShortcut):
myKeyBindings.add(orca.keybindings.KeyBinding(
pShortcut,
1 << orca.keybindings.MODIFIER_ORCA,
1 << orca.keybindings.MODIFIER_ORCA,
pHandle))
orca.settings.keyBindingsMap["default"] = myKeyBindings
#Bind Function to key+
#OCRPath-
def ocr_path(path):
img = Image.open(path)
tr = tesseract("/usr/share")
new_string = tr.ocr_image(img)
return new_string
#OCRPath+
#Set to Clipboard
def setTextToClipboard(text):
ClipboardObj = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
ClipboardObj.set_text(text, -1)
#Display Message-
#Speak or Braille
def outputMessage(Message):
if (orca.settings.enableSpeech):
orca.speech.speak(Message)
if (orca.settings.enableBraille):
orca.braille.displayMessage(Message)
#Display Message+
#OCR Current Window-
def ocrWindow(script, inputEvent=None):
os.popen('gnome-screenshot -w -f
"/tmp/orca-currwindow.png"').read()
locale.setlocale(locale.LC_NUMERIC, 'C')
OCRText = ocr_path("/tmp/orca-currwindow.png")
setTextToClipboard(OCRText)
outputMessage(OCRText)
return True
#OCR Current Window+
# define OcrHandler-
ocrWindowHandler = orca.input_event.InputEventHandler(
ocrWindow, "OCR Current window") #OCR the current window
# define OcrHandler+
DefineShortcut(ocrWindowHandler,"m"); #Shortcut Orca + m
_______________________________________________
orca-list mailing list
orca-list gnome org
https://mail.gnome.org/mailman/listinfo/orca-list
Visit http://live.gnome.org/Orca for more information on Orca.
The manual is at
http://library.gnome.org/users/gnome-access-guide/nightly/ats-2.html
The FAQ is at http://live.gnome.org/Orca/FrequentlyAskedQuestions
Log bugs and feature requests at http://bugzilla.gnome.org
Find out how to help at http://live.gnome.org/Orca/HowCanIHelp
_______________________________________________
orca-list mailing list
orca-list gnome org
https://mail.gnome.org/mailman/listinfo/orca-list
Visit http://live.gnome.org/Orca for more information on Orca.
The manual is at
http://library.gnome.org/users/gnome-access-guide/nightly/ats-2.html
The FAQ is at http://live.gnome.org/Orca/FrequentlyAskedQuestions
Log bugs and feature requests at http://bugzilla.gnome.org
Find out how to help at http://live.gnome.org/Orca/HowCanIHelp
_______________________________________________
orca-list mailing list
orca-list gnome org
https://mail.gnome.org/mailman/listinfo/orca-list
Visit http://live.gnome.org/Orca for more information on Orca.
The manual is at http://library.gnome.org/users/gnome-access-guide/nightly/ats-2.html
The FAQ is at http://live.gnome.org/Orca/FrequentlyAskedQuestions
Log bugs and feature requests at http://bugzilla.gnome.org
Find out how to help at http://live.gnome.org/Orca/HowCanIHelp
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]