Qui n’a jamais eu besoin de numériser un document pour l’avoir en format texte? La ROC ou OCR en anglais est souvent dure à mettre en place et a utiliser. Voici un petit tutoriel pour y arriver facilement.
– Interface:
ayant toujours été fan de Linux, j’utilise xsane, disponible sur macports. Si ça n’est pas déjà installé, allez sur http://www.macports.org/ . Puis depuis un terminal tappez sudo port install xsane
-Logiciel ROC:
Le most du most: Tesseract: pour l’installer, il faut avoir les outille de développement de apple, disponible à http://developer.apple.com/technologies/tools/ clique sur download xcode, et installer.
Puis installez la grande dépendence: Leptonica : http://www.leptonica.com/download.html un double click permet de décompresser. Ensuite avec un terminal tapper dans le dossier leptonica: ./configure (entrer) make (entrer) sudo make install (entrer). les dépendances manquantes peuvent être installé via macports.
puis télécharger tesseract : http://code.google.com/p/tesseract-ocr/downloads/list
Pour que cela fonctionne il vous faut: la source à ce jour: tesseract-3.01.tar.gz , au moins un paquetage de langue tesseract-ocr-3.01.eng.tar.gz ,tesseract-2.00.fra.tar.gz et au moins un entraineur fra.traineddata.gz eng.traineddata.gz .
Je ne suis plus sur mais boxtiff-2.01.fra.tar.gz ou boxtiff-2.01.eng.tar.gz peut aussi être nessessaire.
En cas d’impossibilité de compilation de tesseract deux possibilités, La subversion: svn checkout http://tesseract-ocr.googlecode.com/svn/trunk/ tesseract-ocr ou la version macports (un peu vielle, mais mieu que rien) sudo port install tesseract
Une fois tout désarchivé, mettre les fichiers contenu dans l’archive « source ». et avec le terminal installez depuis le répertoire contenant le code source auquel ont été ajouté les fichier linguistique. ./configure (entrer) make (entrer) sudo make install (entrer). Si un fichier semble corrompu, il peut être remplacer par son équivalent sur http://tesseract-ocr.googlecode.com/svn/trunk/ . les dépendances manquantes peuvent être installé via macports. à se point le logiciel Tesseract peut être testé en ligne de commande.
-Liaison entre Tesseract et l’interface:
Pour cela il faut un script nommé xsane2tess dont la version qui fonctionne correctement est xsane2tess.pl (source: http://www.equinoxefr.org/)
Pour l’installer: Téléchargez http://www.equinoxefr.org/wp-content/uploads/2008/07/xsane2tess.pl
Dans un terminal sudo cp xsane2tess.pl /usr/bin/ (entrer) sudo chmod +x xsane2tess.pl (entrer)
une fois fait, dans un terminal tapper xsane (entrer) la le logiciel xsane se lance sans édition/ préférence allez sur l’onglet OCR commande OCR: xsane2tess.pl option de fichier d’enter -i option de fichier de sortie -o et validez.
Voilà vous disposez d’un logiciel de Reconnaissance optique de caractère fiable et gratuit sur votre Mac
ça n’a pas marché? dites moi ou ça à merdé en commentaire, et je vous aiderai et posez aussi votre question sur https://groups.google.com/group/tesseract-ocr/
C’est tout bien expliqué en clair et en langage courant, et je me demande si ça pourrait être traduit en un script, automation, appli ou autre mécanisme, agrémenté de explications étape par étape. Ça pourrait être sous la forme d’une application téléchargeable, ou ça doit rester initiatique ?
Pour un geek non-pratiquant ce serait très bien! Merci…
Bonjour
Merci pour le tutorial, mais pour ma part, au moment du configure de tesseract, le terminal m’annonce qu’il ne trouve pas le fichier Makefile.in. Ci-dessous le log complet, j’ai bien besoin d’un coup de main sur ce coup:
rickenmac:tesseract-3.01 rickenmac$ ./configure
checking build system type… i386-apple-darwin10.8.0
checking host system type… i386-apple-darwin10.8.0
checking –enable-graphics argument… yes
checking –enable-multiple-libraries argument… no
checking for cl.exe… no
checking for g++… g++
checking whether the C++ compiler works… yes
checking for C++ compiler default output file name… a.out
checking for suffix of executables…
checking whether we are cross compiling… no
checking for suffix of object files… o
checking whether we are using the GNU C++ compiler… yes
checking whether g++ accepts -g… yes
checking for gcc… gcc
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ISO C89… none needed
checking for a sed that does not truncate output… /opt/local/bin/gsed
checking for grep that handles long lines and -e… /usr/bin/grep
checking for egrep… /usr/bin/grep -E
checking for fgrep… /usr/bin/grep -F
checking for ld used by gcc… /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld
checking if the linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) is GNU ld… no
checking for BSD- or MS-compatible name lister (nm)… /usr/bin/nm
checking the name lister (/usr/bin/nm) interface… BSD nm
checking whether ln -s works… yes
checking the maximum length of command line arguments… 196608
checking whether the shell understands some XSI constructs… yes
checking whether the shell understands « += »… yes
checking for /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld option to reload object files… -r
checking for objdump… no
checking how to recognize dependent libraries… pass_all
checking for ar… ar
checking for strip… strip
checking for ranlib… ranlib
checking command to parse /usr/bin/nm output from gcc object… ok
checking for dsymutil… dsymutil
checking for nmedit… nmedit
checking for lipo… lipo
checking for otool… otool
checking for otool64… no
checking for -single_module linker flag… yes
checking for -exported_symbols_list linker flag… yes
checking how to run the C preprocessor… gcc -E
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking for dlfcn.h… yes
checking whether we are using the GNU C++ compiler… (cached) yes
checking whether g++ accepts -g… (cached) yes
checking how to run the C++ preprocessor… g++ -E
checking for objdir… .libs
checking if gcc supports -fno-rtti -fno-exceptions… no
checking for gcc option to produce PIC… -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works… yes
checking if gcc static flag -static works… no
checking if gcc supports -c -o file.o… yes
checking if gcc supports -c -o file.o… (cached) yes
checking whether the gcc linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) supports shared libraries… yes
checking dynamic linker characteristics… darwin10.8.0 dyld
checking how to hardcode library paths into programs… immediate
checking whether stripping libraries is possible… yes
checking if libtool supports shared libraries… yes
checking whether to build shared libraries… yes
checking whether to build static libraries… yes
checking for ld used by g++… /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld
checking if the linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) is GNU ld… no
checking whether the g++ linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) supports shared libraries… yes
checking for g++ option to produce PIC… -fno-common -DPIC
checking if g++ PIC flag -fno-common -DPIC works… yes
checking if g++ static flag -static works… no
checking if g++ supports -c -o file.o… yes
checking if g++ supports -c -o file.o… (cached) yes
checking whether the g++ linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) supports shared libraries… yes
checking dynamic linker characteristics… darwin10.8.0 dyld
checking how to hardcode library paths into programs… immediate
checking for a BSD-compatible install… /opt/local/bin/ginstall -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… /opt/local/bin/gmkdir -p
checking for gawk… no
checking for mawk… no
checking for nawk… no
checking for awk… awk
checking whether make sets $(MAKE)… yes
checking for style of include used by make… GNU
checking dependency style of gcc… gcc3
checking dependency style of g++… gcc3
checking whether to enable maintainer-specific portions of Makefiles… no
checking whether byte ordering is bigendian… no
checking for sem_init in -lpthread… yes
checking for ANSI C header files… (cached) yes
checking whether time.h and sys/time.h may both be included… yes
checking for sys/wait.h that is POSIX.1 compatible… yes
checking sys/ipc.h usability… yes
checking sys/ipc.h presence… yes
checking for sys/ipc.h… yes
checking sys/shm.h usability… yes
checking sys/shm.h presence… yes
checking for sys/shm.h… yes
checking limits.h usability… yes
checking limits.h presence… yes
checking for limits.h… yes
checking malloc.h usability… no
checking malloc.h presence… no
checking for malloc.h… no
checking allheaders.h usability… no
checking allheaders.h presence… no
checking for allheaders.h… no
checking for stdbool.h that conforms to C99… yes
checking for _Bool… no
checking whether #! works in shell scripts… yes
checking for special C compiler options needed for large files… no
checking for _FILE_OFFSET_BITS value needed for large files… no
checking for wchar_t… yes
checking for long long int… yes
checking for mbstate_t… yes
checking for size_t… yes
checking for stdlib.h… (cached) yes
checking for unistd.h… (cached) yes
checking for sys/param.h… yes
checking for getpagesize… yes
checking for working mmap… yes
checking for pid_t… yes
checking vfork.h usability… no
checking vfork.h presence… no
checking for vfork.h… no
checking for fork… yes
checking for vfork… yes
checking for working fork… yes
checking for working vfork… (cached) yes
checking for strerror… yes
checking for vsnprintf… yes
checking for gethostname… yes
checking for strchr… yes
checking for memcpy… yes
checking for acos… yes
checking for asin… yes
checking for leptonica… yes
checking for pixCreate in -llept… yes
configure: creating ./config.status
config.status: error: cannot find input file: `Makefile.in’
Ping : Protocole de cytogénétique… | Pour aller de l'ombre à la lumière…
Bonjour,
et bravo pour le tuto.
J’avais d’abord eu l’erreur « cannot find input file: ‘Makefile.in' »
mais je pense l’avoir résolue en le cherchant sur le net et en le mettant partout où il le demandait (donc dans 3 ou 4 endroits différents, par exemple le dossier « api »).
Ensuite, plus de message d’erreur là-dessus.
J’ai simplement installé Mac Ports sur le tard, en fin de processus, juste avant de lancer Xsane.
Là, j’ai eu le message suivant :
Error: Couldn’t determine your Xcode version (from ‘/usr/bin/xcodebuild -version’).
Error:
Error: If you have not installed Xcode, install it now; see:
Error: http://guide.macports.org/chunked/installing.xcode.html
Error:
Error: Target org.macports.extract returned: unable to find Xcode
Error: Failed to install ffmpeg
Log for ffmpeg is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_multimedia_ffmpeg/ffmpeg/main.log
Error: The following dependencies were not installed: gimp2 gegl ffmpeg lensfun libopenraw boost icu libspiro lua readline openexr ilmbase gsed gimp-help-en lcms libexif libgnomeui audiofile libbonoboui coreutils gmp libgnome esound libgnomecanvas libglade2 libgnome-keyring gnome-keyring libgcrypt libgpg-error libtasn1 xorg-libsm xorg-libice libmng libwmf poppler poppler-data py27-gtk py27-cairo py27-numpy fftw-3 py27-nose nosetests_select py27-distribute py27-py py27-gobject webkit-gtk enchant aspell texinfo hunspell gst-plugins-base gstreamer bison flex gzip libsoup glib-networking gnutls lzo2 libproxy cmake xorg-libXt xorg-libXmu xpm sane-backends libusb-compat libusb net-snmp
Error: Status 1 encountered during processing.
To report a bug, see
Puis, lorsque j’ai voulu lancer Xsane, j’ai eu :
-bash: xsane: command not found
J’en suis là.
Une question : au cas où je voudrais tout désinstaller, est-ce possible ?
Grand merci.
i-Moi
alors a priori tu es sur la bonne voie:
fait:
sudo port install gimp2 gegl ffmpeg lensfun libopenraw boost icu libspiro lua readline openexr ilmbase gsed gimp-help-en lcms libexif libgnomeui audiofile libbonoboui coreutils gmp libgnome esound libgnomecanvas libglade2 libgnome-keyring gnome-keyring libgcrypt libgpg-error libtasn1 xorg-libsm xorg-libice libmng libwmf poppler poppler-data py27-gtk py27-cairo py27-numpy fftw-3 py27-nose nosetests_select py27-distribute py27-py py27-gobject webkit-gtk enchant aspell texinfo hunspell gst-plugins-base gstreamer bison flex gzip libsoup glib-networking gnutls lzo2 libproxy cmake xorg-libXt xorg-libXmu xpm sane-backends libusb-compat libusb net-snmp
Normalement si tu a macport, tu dois avoir Xcode (c’est normalement une dépendence) vérifie tout de même…
Si tu as un message d’erreur, il est possible que macports ne soit pas syncronisé, fait alors:
sudo port -d sync
sudo port -d selfupdate
Et recommencela ligne plus haut (NB: flèche vers le haut dans le terminal te propose l’historique des commande, et le terminal mac à l’avantage d’avoir un bon copier coller)
une foi fait reprend le tuto à « sudo port install xsane »
ps: des fois ça bloque quand il y a plein de choses qui s’install en même temps… si ça plante sur un packetage passe le et install tout les autres.
Pour désinstaller: les chose que tu compiles et install avec « sudo make install » se désinstalle avec « sudo make uninstall » dans le répertoire ou tu as compiller ton programe (concerve donc le dossier de compilation)
ce qui s’installe avec macport sudo port uninstall … ou juste désinstaller macport qui suprimera de lui même tout ce qu’il faut, xsane2tess n’est qu’un script, y’a qu’à faire un rm … Xcode… sur que ça peut se désinstaller… mais je ne comprend pas ce qui peuvent avoir un mac sans!
Ouf ! C’est super gentil, merci pour ce si complet complément.
Le terminal est en train tourner, j’attends…
Une chose est mystérieuse pour moi : le dossier de compilation est-il celui où se trouvent les sources, ou bien celui vers lequel j’ai copié des éléments, comme /usr/bin ?
Par exemple, est-ce ~/Downloads/sources/ (où j’ai copié tous les éléments que tu listais) ou /usr/bin ?
Merci
i-Moi
oui, en générale le dossier de compilation est celui ou tu met les sources et ou tu les compile… des fois ça peut être un sous dossier pour certain programme ou utilisateur tordu…
Dis moi si tu as réussis à la fin… (Comme tu viens du forum mac, tu as du lire que certaine persones disait que ça ne marchait pas…) bon comme j’utilise xsane et tesseract très souvent depuis mon mac installé comme décrit, je sais que ça marche :p
En réalité, mes besoins en OCR sont plutôt ponctuels, mais pour la beauté de la chose, j’aime bien essayer. En l’occurrence, je découvre ce monde que —à part Gimp et 2 ou trois autres programmes X11— je ne connaissais pas.
A la fin, Xsane a commencé à se lancer, mais mon scanner n’était pas reconnu, je n’ai donc pas pu aller plus loin. Du coup, comme mon installation avait un peu bordélique, j’ai désinstallé MacPorts et quand j’aurai plus de temps, j’y reviendrai sans doute pour d’autres softs, ça a l’air très intéressant. Merci encore pour les infos et l’aide, grâce à toi j’ai pu aller jusqu’au bout de cette complexe odyssée.
i-Moi
mmm souvent quand le scan n’est pas reconu, il y a juste deux trois truc à vérifier…. déjà si il est dispo, enssuite si il n’y a pas une question de droit (lance xsane en sudo) …
sinon, si c’est un problème spécifique au modèle, essayes une recherche de comment installer ton scan sous linux… heu… chose toute bête, à la base ton scan fonctionne?
Salut,
oui, le scan marche sans problème (HP Laserjet all in one réseau 3052), et j’avais lancé Xsane en sudo. De toute façon, il y a tant d’autres choses sur MacPorts et je n’ai pas un besoin suffisant pour pousser trop avant dans cette voie : quelques pages à reconnaître par ci par là, à la limite j’ai plus vite fait d’aller sur les site OCR en ligne. Je vais aller explorer MacPorts… Merci encore !
Bonjour,
et félicitations pour le tuto.
déjà je ne sais pas si il est toujours possible de télécharger Tesseract sous cette version mais j’ai tenter le coup (je suis sous OS X 10.11.4 El Capitan), donc j’ai télécharger Xcode et Leptonica mais je n’arrive pas a modifier le terminal.
merci
Bonsoir,
En effet, Tesseract à déménagé… Veuillez voir ici: https://github.com/tesseract-ocr