[Debian-hebrew-package] [svn] r321 - in pkg/hocr/trunk: . bindings
bindings/perl bindings/python debian examples
examples/bindings examples/bindings/java
examples/bindings/pascal examples/bindings/perl
examples/bindings/pygtk examples/bindings/python
examples/bindings/python/pygtk
examples/bindings/python/simple examples/hocr
examples/hocr-gtk examples/hocr-qt pixmaps po src tests
Baruch Even
baruch at costa.debian.org
Sun Jan 15 21:21:16 UTC 2006
Author: baruch
Date: Sun Jan 15 21:21:02 2006
New Revision: 321
Added:
pkg/hocr/trunk/examples/bindings/Makefile.am
- copied unchanged from r320, pkg/hocr/branches/upstream/current/examples/bindings/Makefile.am
pkg/hocr/trunk/examples/bindings/Makefile.in
- copied unchanged from r320, pkg/hocr/branches/upstream/current/examples/bindings/Makefile.in
pkg/hocr/trunk/examples/bindings/java/
- copied from r320, pkg/hocr/branches/upstream/current/examples/bindings/java/
pkg/hocr/trunk/examples/bindings/pascal/
- copied from r320, pkg/hocr/branches/upstream/current/examples/bindings/pascal/
pkg/hocr/trunk/examples/bindings/perl/Makefile.am
- copied unchanged from r320, pkg/hocr/branches/upstream/current/examples/bindings/perl/Makefile.am
pkg/hocr/trunk/examples/bindings/perl/Makefile.in
- copied unchanged from r320, pkg/hocr/branches/upstream/current/examples/bindings/perl/Makefile.in
pkg/hocr/trunk/examples/bindings/python/Makefile.am
- copied unchanged from r320, pkg/hocr/branches/upstream/current/examples/bindings/python/Makefile.am
pkg/hocr/trunk/examples/bindings/python/Makefile.in
- copied unchanged from r320, pkg/hocr/branches/upstream/current/examples/bindings/python/Makefile.in
pkg/hocr/trunk/examples/bindings/python/pygtk/
- copied from r320, pkg/hocr/branches/upstream/current/examples/bindings/python/pygtk/
pkg/hocr/trunk/examples/bindings/python/simple/
- copied from r320, pkg/hocr/branches/upstream/current/examples/bindings/python/simple/
pkg/hocr/trunk/pixmaps/
- copied from r320, pkg/hocr/branches/upstream/current/pixmaps/
Removed:
pkg/hocr/trunk/examples/bindings/pygtk/
pkg/hocr/trunk/examples/bindings/python/hocr_py.py
Modified:
pkg/hocr/trunk/BUGS
pkg/hocr/trunk/ChangeLog
pkg/hocr/trunk/HACKING
pkg/hocr/trunk/Makefile.am
pkg/hocr/trunk/Makefile.in
pkg/hocr/trunk/aclocal.m4
pkg/hocr/trunk/bindings/Makefile.in
pkg/hocr/trunk/bindings/perl/Makefile.in
pkg/hocr/trunk/bindings/python/Makefile.in
pkg/hocr/trunk/configure
pkg/hocr/trunk/configure.in
pkg/hocr/trunk/debian/changelog
pkg/hocr/trunk/examples/Makefile.am
pkg/hocr/trunk/examples/Makefile.in
pkg/hocr/trunk/examples/hocr-gtk/Makefile.am
pkg/hocr/trunk/examples/hocr-gtk/Makefile.in
pkg/hocr/trunk/examples/hocr-gtk/callbacks.c
pkg/hocr/trunk/examples/hocr-gtk/callbacks.h
pkg/hocr/trunk/examples/hocr-gtk/hocr-gtk.c
pkg/hocr/trunk/examples/hocr-gtk/hocr.desktop
pkg/hocr/trunk/examples/hocr-gtk/interface.c
pkg/hocr/trunk/examples/hocr-gtk/interface.h
pkg/hocr/trunk/examples/hocr-qt/hocr_qt.cpp
pkg/hocr/trunk/examples/hocr/Makefile.in
pkg/hocr/trunk/examples/hocr/hocr-cmd.c
pkg/hocr/trunk/examples/hocr/hocr.1
pkg/hocr/trunk/libhocr.pc
pkg/hocr/trunk/ltmain.sh
pkg/hocr/trunk/po/he.gmo
pkg/hocr/trunk/po/he.po
pkg/hocr/trunk/po/hocr-gtk.pot
pkg/hocr/trunk/src/Makefile.in
pkg/hocr/trunk/src/consts.h
pkg/hocr/trunk/src/font_layout.c
pkg/hocr/trunk/src/font_recognition.c
pkg/hocr/trunk/src/hocr.c
pkg/hocr/trunk/src/hocr_object.c
pkg/hocr/trunk/src/hocr_object.h
pkg/hocr/trunk/src/hocr_pixbuf.c
pkg/hocr/trunk/src/hocr_pixbuf.h
pkg/hocr/trunk/src/hocr_textbuffer.c
pkg/hocr/trunk/src/hocrpp.h
pkg/hocr/trunk/tests/Makefile.in
Log:
Merge upstream version 0.8 to Debian package
Modified: pkg/hocr/trunk/BUGS
==============================================================================
--- pkg/hocr/trunk/BUGS (original)
+++ pkg/hocr/trunk/BUGS Sun Jan 15 21:21:02 2006
@@ -13,18 +13,24 @@
code cleaning:
+ - document undocumented functions and data structurs.
- find ugly hacks and replace with maintanble code.
- - create a dynamic structure for text buffer, and remove the all fixed size strings.
+ - rewrite the page_layout functions.
+ - create a dynamic structure for text buffer, and remove the all fixed size strings.
+ [done, kobi 1,1,2006]
- replace all functions and struct names to use hocr_ namespace convention.
+ [done, kobi 1,1,2006]
- find a way not to use constants and remove the consts.h file.
- find a way to make the do_ocr function more readable.
features:
+ - add stdin as an input method in the cmd line example (pipe)
+ [done, kobi 1,1,2006]
- add dictionary support
- add suport for multi columns pages [done, kobi 9,12,2005]
- add support for new shapes (numbers, english letters)
- - add support for nikud.
+ - add support for nikud. [done, kobi 1,1,2006]
- add support for more then one shape for each font.
documentation:
Modified: pkg/hocr/trunk/ChangeLog
==============================================================================
--- pkg/hocr/trunk/ChangeLog (original)
+++ pkg/hocr/trunk/ChangeLog Sun Jan 15 21:21:02 2006
@@ -1,16 +1,37 @@
+hocr (0.8.0)
+
+ * Shlomi Israel: hocr logo.
+ * Tal. (tal.bav at gmail.com): Fix memory leak when unrefing the text structure
+
+ -- Yaacov Zamir <kzamir at walla.co.il> Sat, 14 Jan 2006 22:13
+
+hocr (0.7.2)
+
+ * command line example implements pipes
+ * Tal. (tal.bav at gmail.com): add save ppm to command line example.
+ * move tal's save as pnm to the internal hocr_pixbuf functions.
+ * add command line args to hocr-gtk example
+ * add save picture to hocr-gtk example
+ * add xsane option to hocr-gtk example
+ * clean picture from artefacts before ocr it
+ * Tal. (tal.bav at gmail.com): add java binding example imagej-plugin
+
+ -- Yaacov Zamir <kzamir at walla.co.il> Thu, 5 Jan 2006 22:13
+
hocr (0.7.1)
* Fix bindings
* add pyGTK example
+ * Diego Iastrubni: fix qt example
- -- Yaacov Zamir <kzamir at walla.co.il> Mon, 2 Jan 2005 22:13
+ -- Yaacov Zamir <kzamir at walla.co.il> Mon, 2 Jan 2006 22:13
hocr (0.7.0)
* add bindings to C++, Python and Perl
* documentation is now separate for c and cpp
- -- Yaacov Zamir <kzamir at walla.co.il> Sun, 1 Jan 2005 22:13
+ -- Yaacov Zamir <kzamir at walla.co.il> Sun, 1 Jan 2006 22:13
hocr (0.6.4)
Modified: pkg/hocr/trunk/HACKING
==============================================================================
--- pkg/hocr/trunk/HACKING (original)
+++ pkg/hocr/trunk/HACKING Sun Jan 15 21:21:02 2006
@@ -18,6 +18,7 @@
HOCR use Indent and Doxygen. Use tabs for indentation, braces are
unindented and on a seperate line. Document your code using doxygen style.
+ (indent -bad -bap -bbb -bli0 -fca -l80 -psl -sc -sob -ss -ts8 -i8)
On top of that, you will have to:
Modified: pkg/hocr/trunk/Makefile.am
==============================================================================
--- pkg/hocr/trunk/Makefile.am (original)
+++ pkg/hocr/trunk/Makefile.am Sun Jan 15 21:21:02 2006
@@ -22,20 +22,20 @@
install-data-local:
@$(NORMAL_INSTALL)
if test -d $(srcdir)/pixmaps; then \
- $(mkinstalldirs) $(DESTDIR)$(datadir)/pixmaps/$(PACKAGE); \
+ $(mkinstalldirs) $(DESTDIR)$(datadir)/pixmaps/; \
for pixmap in $(srcdir)/pixmaps/*; do \
if test -f $$pixmap; then \
- $(INSTALL_DATA) $$pixmap $(DESTDIR)$(datadir)/pixmaps/$(PACKAGE); \
+ $(INSTALL_DATA) $$pixmap $(DESTDIR)$(datadir)/pixmaps/; \
fi \
done \
fi
dist-hook:
if test -d pixmaps; then \
- mkdir $(distdir)/pixmaps; \
+ mkdir $(DESTDIR)$(distdir)/pixmaps; \
for pixmap in pixmaps/*; do \
if test -f $$pixmap; then \
- cp -p $$pixmap $(distdir)/pixmaps; \
+ cp -p $$pixmap $(DESTDIR)$(distdir)/pixmaps; \
fi \
done \
fi
Modified: pkg/hocr/trunk/Makefile.in
==============================================================================
--- pkg/hocr/trunk/Makefile.in (original)
+++ pkg/hocr/trunk/Makefile.in Sun Jan 15 21:21:02 2006
@@ -82,8 +82,10 @@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
HAVE_LIB = @HAVE_LIB@
+IMAGEJ_SOURCE_PATH = @IMAGEJ_SOURCE_PATH@
INSTOBJEXT = @INSTOBJEXT@
INTLLIBS = @INTLLIBS@
+JAVA_DEV_KIT_PATH = @JAVA_DEV_KIT_PATH@
LIB = @LIB@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
@@ -466,20 +468,20 @@
install-data-local:
@$(NORMAL_INSTALL)
if test -d $(srcdir)/pixmaps; then \
- $(mkinstalldirs) $(DESTDIR)$(datadir)/pixmaps/$(PACKAGE); \
+ $(mkinstalldirs) $(DESTDIR)$(datadir)/pixmaps/; \
for pixmap in $(srcdir)/pixmaps/*; do \
if test -f $$pixmap; then \
- $(INSTALL_DATA) $$pixmap $(DESTDIR)$(datadir)/pixmaps/$(PACKAGE); \
+ $(INSTALL_DATA) $$pixmap $(DESTDIR)$(datadir)/pixmaps/; \
fi \
done \
fi
dist-hook:
if test -d pixmaps; then \
- mkdir $(distdir)/pixmaps; \
+ mkdir $(DESTDIR)$(distdir)/pixmaps; \
for pixmap in pixmaps/*; do \
if test -f $$pixmap; then \
- cp -p $$pixmap $(distdir)/pixmaps; \
+ cp -p $$pixmap $(DESTDIR)$(distdir)/pixmaps; \
fi \
done \
fi
Modified: pkg/hocr/trunk/aclocal.m4
==============================================================================
--- pkg/hocr/trunk/aclocal.m4 (original)
+++ pkg/hocr/trunk/aclocal.m4 Sun Jan 15 21:21:02 2006
@@ -1122,7 +1122,7 @@
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-# serial 48 Debian 1.5.22-1 AC_PROG_LIBTOOL
+# serial 48 Debian 1.5.22-2 AC_PROG_LIBTOOL
# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
Modified: pkg/hocr/trunk/bindings/Makefile.in
==============================================================================
--- pkg/hocr/trunk/bindings/Makefile.in (original)
+++ pkg/hocr/trunk/bindings/Makefile.in Sun Jan 15 21:21:02 2006
@@ -82,8 +82,10 @@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
HAVE_LIB = @HAVE_LIB@
+IMAGEJ_SOURCE_PATH = @IMAGEJ_SOURCE_PATH@
INSTOBJEXT = @INSTOBJEXT@
INTLLIBS = @INTLLIBS@
+JAVA_DEV_KIT_PATH = @JAVA_DEV_KIT_PATH@
LIB = @LIB@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
Modified: pkg/hocr/trunk/bindings/perl/Makefile.in
==============================================================================
--- pkg/hocr/trunk/bindings/perl/Makefile.in (original)
+++ pkg/hocr/trunk/bindings/perl/Makefile.in Sun Jan 15 21:21:02 2006
@@ -82,8 +82,10 @@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
HAVE_LIB = @HAVE_LIB@
+IMAGEJ_SOURCE_PATH = @IMAGEJ_SOURCE_PATH@
INSTOBJEXT = @INSTOBJEXT@
INTLLIBS = @INTLLIBS@
+JAVA_DEV_KIT_PATH = @JAVA_DEV_KIT_PATH@
LIB = @LIB@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
Modified: pkg/hocr/trunk/bindings/python/Makefile.in
==============================================================================
--- pkg/hocr/trunk/bindings/python/Makefile.in (original)
+++ pkg/hocr/trunk/bindings/python/Makefile.in Sun Jan 15 21:21:02 2006
@@ -82,8 +82,10 @@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
HAVE_LIB = @HAVE_LIB@
+IMAGEJ_SOURCE_PATH = @IMAGEJ_SOURCE_PATH@
INSTOBJEXT = @INSTOBJEXT@
INTLLIBS = @INTLLIBS@
+JAVA_DEV_KIT_PATH = @JAVA_DEV_KIT_PATH@
LIB = @LIB@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
Modified: pkg/hocr/trunk/configure
==============================================================================
--- pkg/hocr/trunk/configure (original)
+++ pkg/hocr/trunk/configure Sun Jan 15 21:21:02 2006
@@ -463,7 +463,7 @@
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT VERSION_INFO CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG WINDRES ac_ct_WINDRES WITH_WIN32_TRUE WITH_WIN32_FALSE GETTEXT_PACKAGE USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB MKINSTALLDIRS PO_DIR ac_pt_PKG_CONFIG gtk_CFLAGS gtk_LIBS WITH_GTK_TRUE WITH_GTK_FALSE gtkspell_CFLAGS gtkspell_LIBS WITH_GTKSPELL_TRUE WITH_GTKSPELL_FALSE WITH_GTKSPELL WITH_CMD_TRUE WITH_CMD_FALSE have_swig have_python PY_VERSION PY_CFLAGS PY_MODULES_PATH WITH_PYTHON_TRUE WITH_PYTHON_FALSE have_perl PE_CFLAGS PE_MODULES_PATH WITH_PERL_TRUE WITH_PERL_FALSE PACKAGE_CFLAGS PACKAGE_LIBS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT VERSION_INFO CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG WINDRES ac_ct_WINDRES WITH_WIN32_TRUE WITH_WIN32_FALSE GETTEXT_PACKAGE USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB MKINSTALLDIRS PO_DIR ac_pt_PKG_CONFIG gtk_CFLAGS gtk_LIBS WITH_GTK_TRUE WITH_GTK_FALSE gtkspell_CFLAGS gtkspell_LIBS WITH_GTKSPELL_TRUE WITH_GTKSPELL_FALSE WITH_GTKSPELL WITH_CMD_TRUE WITH_CMD_FALSE have_swig have_python PY_VERSION PY_CFLAGS PY_MODULES_PATH WITH_PYTHON_TRUE WITH_PYTHON_FALSE have_perl PE_CFLAGS PE_MODULES_PATH WITH_PERL_TRUE WITH_PERL_FALSE JAVA_DEV_KIT_PATH IMAGEJ_SOURCE_PATH WITH_JAVA_TRUE WITH_JAVA_FALSE PACKAGE_CFLAGS PACKAGE_LIBS LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -1059,6 +1059,7 @@
--disable-cmd do not build hocr program
--enable-python build python binding default=no
--enable-perl build perl binding default=no
+ --enable-java build java binding default=no
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1070,6 +1071,8 @@
include additional configurations [automatic]
--with-python-sitelib-dir=PATH path to python site lib
--with-perl-sitelib-dir=PATH path to perl site lib
+ --with-java-sdk-dir=PATH path to java sdk
+ --with-imagej-dir=PATH path to imagej source
Some influential environment variables:
CC C compiler command
@@ -1807,7 +1810,7 @@
PACKAGE=hocr
-VERSION=0.7.1
+VERSION=0.8.0
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
{ { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
@@ -4727,7 +4730,7 @@
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4730 "configure"' > conftest.$ac_ext
+ echo '#line 4733 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -5809,7 +5812,7 @@
# Provide some information about the compiler.
-echo "$as_me:5812:" \
+echo "$as_me:5815:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -6870,11 +6873,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6873: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6876: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6877: \$? = $ac_status" >&5
+ echo "$as_me:6880: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7138,11 +7141,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7141: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7144: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7145: \$? = $ac_status" >&5
+ echo "$as_me:7148: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7242,11 +7245,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7245: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7248: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7249: \$? = $ac_status" >&5
+ echo "$as_me:7252: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -9600,7 +9603,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9603 "configure"
+#line 9606 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9700,7 +9703,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9703 "configure"
+#line 9706 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12038,11 +12041,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12041: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12044: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:12045: \$? = $ac_status" >&5
+ echo "$as_me:12048: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -12142,11 +12145,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12145: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12148: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:12149: \$? = $ac_status" >&5
+ echo "$as_me:12152: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -13730,11 +13733,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13733: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13736: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13737: \$? = $ac_status" >&5
+ echo "$as_me:13740: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -13834,11 +13837,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13837: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13840: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13841: \$? = $ac_status" >&5
+ echo "$as_me:13844: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16057,11 +16060,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16060: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16063: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16064: \$? = $ac_status" >&5
+ echo "$as_me:16067: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16325,11 +16328,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16328: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16331: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16332: \$? = $ac_status" >&5
+ echo "$as_me:16335: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16429,11 +16432,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16432: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16435: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16436: \$? = $ac_status" >&5
+ echo "$as_me:16439: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -21201,6 +21204,7 @@
+
build_python=no
# Check whether --enable-python or --disable-python was given.
@@ -21389,12 +21393,69 @@
fi
+build_java=no
+have_java=no
+
+# Check whether --enable-java or --disable-java was given.
+if test "${enable_java+set}" = set; then
+ enableval="$enable_java"
+ build_java="$enableval"
+else
+ build_java=no
+fi;
+
+
+# Check whether --with-java-sdk-dir or --without-java-sdk-dir was given.
+if test "${with_java_sdk_dir+set}" = set; then
+ withval="$with_java_sdk_dir"
+
+fi;
+
+# Check whether --with-java-imagej-dir or --without-java-imagej-dir was given.
+if test "${with_java_imagej_dir+set}" = set; then
+ withval="$with_java_imagej_dir"
+
+fi;
+
+JAVA_DEV_KIT_PATH=$with_java_sdk_dir
+
+
+IMAGEJ_SOURCE_PATH=$with_imagej_dir
+
+
+if test "x$with_java_sdk_dir" = "x"; then
+ build_java=no
+fi
+
+if test "x$with_imagej_dir" = "x"; then
+ build_java=no
+fi
+
+if test -f ${with_java_sdk_dir}/bin/javac; then
+ have_java=yes
+fi
+
+if test "x$have_java" = "xno"; then
+ build_java=no
+fi
+
+
+
+if test "x$build_java" = "xyes"; then
+ WITH_JAVA_TRUE=
+ WITH_JAVA_FALSE='#'
+else
+ WITH_JAVA_TRUE='#'
+ WITH_JAVA_FALSE=
+fi
+
+
- ac_config_files="$ac_config_files Makefile libhocr.pc src/Makefile po/Makefile.in tests/Makefile examples/Makefile examples/hocr-gtk/Makefile examples/hocr/Makefile bindings/Makefile bindings/python/Makefile bindings/perl/Makefile"
+ ac_config_files="$ac_config_files Makefile libhocr.pc src/Makefile po/Makefile.in tests/Makefile examples/Makefile examples/hocr-gtk/Makefile examples/hocr/Makefile examples/bindings/Makefile examples/bindings/python/Makefile examples/bindings/python/simple/Makefile examples/bindings/python/pygtk/Makefile examples/bindings/perl/Makefile examples/bindings/pascal/Makefile examples/bindings/java/Makefile examples/bindings/java/imagej-plugin/Makefile bindings/Makefile bindings/python/Makefile bindings/perl/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -21939,6 +22000,14 @@
"examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
"examples/hocr-gtk/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/hocr-gtk/Makefile" ;;
"examples/hocr/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/hocr/Makefile" ;;
+ "examples/bindings/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/bindings/Makefile" ;;
+ "examples/bindings/python/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/bindings/python/Makefile" ;;
+ "examples/bindings/python/simple/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/bindings/python/simple/Makefile" ;;
+ "examples/bindings/python/pygtk/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/bindings/python/pygtk/Makefile" ;;
+ "examples/bindings/perl/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/bindings/perl/Makefile" ;;
+ "examples/bindings/pascal/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/bindings/pascal/Makefile" ;;
+ "examples/bindings/java/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/bindings/java/Makefile" ;;
+ "examples/bindings/java/imagej-plugin/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/bindings/java/imagej-plugin/Makefile" ;;
"bindings/Makefile" ) CONFIG_FILES="$CONFIG_FILES bindings/Makefile" ;;
"bindings/python/Makefile" ) CONFIG_FILES="$CONFIG_FILES bindings/python/Makefile" ;;
"bindings/perl/Makefile" ) CONFIG_FILES="$CONFIG_FILES bindings/perl/Makefile" ;;
@@ -22128,6 +22197,10 @@
s, at PE_MODULES_PATH@,$PE_MODULES_PATH,;t t
s, at WITH_PERL_TRUE@,$WITH_PERL_TRUE,;t t
s, at WITH_PERL_FALSE@,$WITH_PERL_FALSE,;t t
+s, at JAVA_DEV_KIT_PATH@,$JAVA_DEV_KIT_PATH,;t t
+s, at IMAGEJ_SOURCE_PATH@,$IMAGEJ_SOURCE_PATH,;t t
+s, at WITH_JAVA_TRUE@,$WITH_JAVA_TRUE,;t t
+s, at WITH_JAVA_FALSE@,$WITH_JAVA_FALSE,;t t
s, at PACKAGE_CFLAGS@,$PACKAGE_CFLAGS,;t t
s, at PACKAGE_LIBS@,$PACKAGE_LIBS,;t t
s, at LIBOBJS@,$LIBOBJS,;t t
@@ -22756,6 +22829,8 @@
have swig ${have_swig}
have python ${have_python}
have perl ${have_perl}
+ hava java ${have_java}
+ javac ${with_java_sdk_dir}/bin/javac
build hocr ${cmd}
build hocr-gtk ${gtk}
@@ -22763,8 +22838,11 @@
build python binding ${build_python}
build perl binding ${build_perl}
+ build java binding ${build_java}
- perl site lib path: $PE_MODULES_PATH
- python site lib path: $PY_MODULES_PATH
+ perl site lib path: ${PE_MODULES_PATH}
+ python site lib path: ${PY_MODULES_PATH}
+ java sdk path: ${JAVA_DEV_KIT_PATH}
+ imagej source path: ${IMAGEJ_SOURCE_PATH}
"
Modified: pkg/hocr/trunk/configure.in
==============================================================================
--- pkg/hocr/trunk/configure.in (original)
+++ pkg/hocr/trunk/configure.in Sun Jan 15 21:21:02 2006
@@ -2,7 +2,7 @@
AC_INIT(configure.in)
AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE(hocr, 0.7.1)
+AM_INIT_AUTOMAKE(hocr, 0.8.0)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
@@ -102,6 +102,8 @@
dnl =======================================================================================
+dnl =======================================================================================
+
build_python=no
AC_ARG_ENABLE(python, [ --enable-python build python binding [default=no]], build_python="$enableval", build_python=no)
@@ -179,6 +181,40 @@
dnl =======================================================================================
+build_java=no
+have_java=no
+
+AC_ARG_ENABLE(java, [ --enable-java build java binding [default=no]], build_java="$enableval", build_java=no)
+
+AC_ARG_WITH(java-sdk-dir, [ --with-java-sdk-dir=PATH path to java sdk ])
+AC_ARG_WITH(java-imagej-dir, [ --with-imagej-dir=PATH path to imagej source ])
+
+JAVA_DEV_KIT_PATH=$with_java_sdk_dir
+AC_SUBST([JAVA_DEV_KIT_PATH])
+
+IMAGEJ_SOURCE_PATH=$with_imagej_dir
+AC_SUBST([IMAGEJ_SOURCE_PATH])
+
+if test "x$with_java_sdk_dir" = "x"; then
+ build_java=no
+fi
+
+if test "x$with_imagej_dir" = "x"; then
+ build_java=no
+fi
+
+if test -f ${with_java_sdk_dir}/bin/javac; then
+ have_java=yes
+fi
+
+if test "x$have_java" = "xno"; then
+ build_java=no
+fi
+
+AM_CONDITIONAL(WITH_JAVA, test "x$build_java" = "xyes")
+
+dnl =======================================================================================
+
dnl =======================================================================================
AC_SUBST(PACKAGE_CFLAGS)
@@ -195,6 +231,14 @@
examples/Makefile
examples/hocr-gtk/Makefile
examples/hocr/Makefile
+examples/bindings/Makefile
+examples/bindings/python/Makefile
+examples/bindings/python/simple/Makefile
+examples/bindings/python/pygtk/Makefile
+examples/bindings/perl/Makefile
+examples/bindings/pascal/Makefile
+examples/bindings/java/Makefile
+examples/bindings/java/imagej-plugin/Makefile
bindings/Makefile
bindings/python/Makefile
bindings/perl/Makefile
@@ -211,6 +255,8 @@
have swig ${have_swig}
have python ${have_python}
have perl ${have_perl}
+ hava java ${have_java}
+ javac ${with_java_sdk_dir}/bin/javac
build hocr ${cmd}
build hocr-gtk ${gtk}
@@ -218,8 +264,11 @@
build python binding ${build_python}
build perl binding ${build_perl}
+ build java binding ${build_java}
- perl site lib path: $PE_MODULES_PATH
- python site lib path: $PY_MODULES_PATH
+ perl site lib path: ${PE_MODULES_PATH}
+ python site lib path: ${PY_MODULES_PATH}
+ java sdk path: ${JAVA_DEV_KIT_PATH}
+ imagej source path: ${IMAGEJ_SOURCE_PATH}
"
Modified: pkg/hocr/trunk/debian/changelog
==============================================================================
--- pkg/hocr/trunk/debian/changelog (original)
+++ pkg/hocr/trunk/debian/changelog Sun Jan 15 21:21:02 2006
@@ -1,3 +1,9 @@
+hocr (0.8-1) unstable; urgency=low
+
+ * New upstream release
+
+ -- Baruch Even <baruch at debian.org> Sun, 15 Jan 2006 21:19:01 +0000
+
hocr (0.7.1-2) unstable; urgency=low
* Add bindings for Python & Perl.
Modified: pkg/hocr/trunk/examples/Makefile.am
==============================================================================
--- pkg/hocr/trunk/examples/Makefile.am (original)
+++ pkg/hocr/trunk/examples/Makefile.am Sun Jan 15 21:21:02 2006
@@ -1,13 +1,9 @@
## Process this file with automake to produce Makefile.in
+SUBDIRS = hocr-gtk hocr bindings
+
EXTRA_DIST = \
hocr-qt/hocr_qt.pro \
hocr-qt/hocr_qt.cpp \
hocr-qt/hocr_qt.h \
- hocr-qt/main.cpp \
- bindings/python/hocr_py.py \
- bindings/pygtk/pygtk-hocr.py \
- bindings/pygtk/pygtk-hocr.glade \
- bindings/perl/hocr_perl.pl
-
-SUBDIRS = hocr-gtk hocr
+ hocr-qt/main.cpp
Modified: pkg/hocr/trunk/examples/Makefile.in
==============================================================================
--- pkg/hocr/trunk/examples/Makefile.in (original)
+++ pkg/hocr/trunk/examples/Makefile.in Sun Jan 15 21:21:02 2006
@@ -82,8 +82,10 @@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
HAVE_LIB = @HAVE_LIB@
+IMAGEJ_SOURCE_PATH = @IMAGEJ_SOURCE_PATH@
INSTOBJEXT = @INSTOBJEXT@
INTLLIBS = @INTLLIBS@
+JAVA_DEV_KIT_PATH = @JAVA_DEV_KIT_PATH@
LIB = @LIB@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
@@ -123,10 +125,10 @@
have_python = @have_python@
have_swig = @have_swig@
-EXTRA_DIST = hocr-qt/hocr_qt.pro hocr-qt/hocr_qt.cpp hocr-qt/hocr_qt.h hocr-qt/main.cpp bindings/python/hocr_py.py bindings/pygtk/pygtk-hocr.py bindings/pygtk/pygtk-hocr.glade bindings/perl/hocr_perl.pl
+SUBDIRS = hocr-gtk hocr bindings
+EXTRA_DIST = hocr-qt/hocr_qt.pro hocr-qt/hocr_qt.cpp hocr-qt/hocr_qt.h hocr-qt/main.cpp
-SUBDIRS = hocr-gtk hocr
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
@@ -241,8 +243,7 @@
subdir = examples
distdir: $(DISTFILES)
- $(mkinstalldirs) $(distdir)/bindings/perl $(distdir)/bindings/pygtk \
- $(distdir)/bindings/python $(distdir)/hocr-qt
+ $(mkinstalldirs) $(distdir)/hocr-qt
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
Modified: pkg/hocr/trunk/examples/hocr-gtk/Makefile.am
==============================================================================
--- pkg/hocr/trunk/examples/hocr-gtk/Makefile.am (original)
+++ pkg/hocr/trunk/examples/hocr-gtk/Makefile.am Sun Jan 15 21:21:02 2006
@@ -7,7 +7,8 @@
if WITH_GTKSPELL
INCLUDES = \
- -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DWITH_GTKSPELL\
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DLOGO=\""$(datadir)/pixmaps/hocr1-128.png\"" \
+ -DWITH_GTKSPELL\
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
@PACKAGE_CFLAGS@ @gtk_CFLAGS@ @gtkspell_CFLAGS@ -I$(top_srcdir)/src
@@ -20,7 +21,7 @@
else
INCLUDES = \
- -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DLOGO=\""$(datadir)/pixmaps/hocr1-128.png\"" \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
@PACKAGE_CFLAGS@ @gtk_CFLAGS@ -I$(top_srcdir)/src
@@ -40,7 +41,7 @@
hocr_gtk_SOURCES = \
hocr-gtk.c \
interface.c interface.h \
- callbacks.c callbacks.h
+ callbacks.c callbacks.h
hocr_gtk_DEPENDENCIES = $(DEPS)
Modified: pkg/hocr/trunk/examples/hocr-gtk/Makefile.in
==============================================================================
--- pkg/hocr/trunk/examples/hocr-gtk/Makefile.in (original)
+++ pkg/hocr/trunk/examples/hocr-gtk/Makefile.in Sun Jan 15 21:21:02 2006
@@ -82,8 +82,10 @@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
HAVE_LIB = @HAVE_LIB@
+IMAGEJ_SOURCE_PATH = @IMAGEJ_SOURCE_PATH@
INSTOBJEXT = @INSTOBJEXT@
INTLLIBS = @INTLLIBS@
+JAVA_DEV_KIT_PATH = @JAVA_DEV_KIT_PATH@
LIB = @LIB@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
@@ -126,8 +128,8 @@
EXTRA_DIST = hocr.desktop
#endif
- at WITH_GTK_TRUE@@WITH_GTKSPELL_TRUE at INCLUDES = -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DWITH_GTKSPELL -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" @PACKAGE_CFLAGS@ @gtk_CFLAGS@ @gtkspell_CFLAGS@ -I$(top_srcdir)/src
- at WITH_GTK_TRUE@@WITH_GTKSPELL_FALSE at INCLUDES = -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" @PACKAGE_CFLAGS@ @gtk_CFLAGS@ -I$(top_srcdir)/src
+ at WITH_GTK_TRUE@@WITH_GTKSPELL_TRUE at INCLUDES = -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DLOGO=\""$(datadir)/pixmaps/hocr1-128.png\"" -DWITH_GTKSPELL -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" @PACKAGE_CFLAGS@ @gtk_CFLAGS@ @gtkspell_CFLAGS@ -I$(top_srcdir)/src
+ at WITH_GTK_TRUE@@WITH_GTKSPELL_FALSE at INCLUDES = -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DLOGO=\""$(datadir)/pixmaps/hocr1-128.png\"" -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" @PACKAGE_CFLAGS@ @gtk_CFLAGS@ -I$(top_srcdir)/src
#if WITH_WIN32
#hocr_gtk_LDADD = ../../src/*.o @PACKAGE_LIBS@ @gtk_LIBS@ $(INTLLIBS)
@@ -141,7 +143,7 @@
@WITH_GTK_TRUE at bin_PROGRAMS = hocr-gtk
- at WITH_GTK_TRUE@hocr_gtk_SOURCES = hocr-gtk.c interface.c interface.h callbacks.c callbacks.h
+ at WITH_GTK_TRUE@hocr_gtk_SOURCES = hocr-gtk.c interface.c interface.h callbacks.c callbacks.h
@WITH_GTK_TRUE at hocr_gtk_DEPENDENCIES = $(DEPS)
@@ -339,8 +341,9 @@
done
callbacks.o: callbacks.c ../../config.h callbacks.h interface.h \
../../src/hocr.h ../../src/consts.h ../../src/hocr_textbuffer.h \
- ../../src/hocr_pixbuf.h ../../src/hocr_object.h
-hocr-gtk.o: hocr-gtk.c ../../config.h interface.h
+ ../../src/hocr_pixbuf.h ../../src/hocr_object.h \
+ ../../src/hocr_pixbuf.h
+hocr-gtk.o: hocr-gtk.c ../../config.h interface.h callbacks.h
interface.o: interface.c ../../config.h callbacks.h interface.h
info-am:
Modified: pkg/hocr/trunk/examples/hocr-gtk/callbacks.c
==============================================================================
--- pkg/hocr/trunk/examples/hocr-gtk/callbacks.c (original)
+++ pkg/hocr/trunk/examples/hocr-gtk/callbacks.c Sun Jan 15 21:21:02 2006
@@ -27,8 +27,11 @@
# include <config.h>
#endif
-#include <gtk/gtk.h>
+#include <glib.h>
#include <glib/gprintf.h>
+#include <glib/gstdio.h>
+
+#include <gtk/gtk.h>
#ifdef WITH_GTKSPELL
#include <gtkspell/gtkspell.h>
@@ -37,12 +40,10 @@
#include "callbacks.h"
#include "interface.h"
#include "hocr.h"
+#include "hocr_pixbuf.h"
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
-GdkPixbuf *pixbuf = NULL;
-GdkPixbuf *vis_pixbuf = NULL;
-
typedef struct _text_struct
{
GtkTextBuffer *text_buffer;
@@ -343,7 +344,7 @@
char *filename;
GtkWidget *my_file_chooser =
- gtk_file_chooser_dialog_new ("hocr save text",
+ gtk_file_chooser_dialog_new (_("hocr save text"),
GTK_WINDOW (window1),
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL,
@@ -365,6 +366,197 @@
}
void
+on_save_picture_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+ gint result;
+ char *filename;
+ GError *error = NULL;
+ gchar **filename_split;
+ GtkWidget *dialog;
+ GtkWidget *my_file_chooser;
+
+ /* check that user gave a suffix */
+ if (!pixbuf)
+ {
+ dialog = gtk_message_dialog_new
+ (GTK_WINDOW (window1),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("Error wile saving:\nNo picture to save"));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ return;
+ }
+
+ my_file_chooser =
+ gtk_file_chooser_dialog_new (_("hocr save picture"),
+ GTK_WINDOW (window1),
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE,
+ GTK_RESPONSE_ACCEPT, NULL);
+
+ result = gtk_dialog_run (GTK_DIALOG (my_file_chooser));
+
+ if (result == GTK_RESPONSE_ACCEPT)
+ {
+ filename = gtk_file_chooser_get_filename
+ (GTK_FILE_CHOOSER (my_file_chooser));
+ if (filename)
+ {
+ filename_split = g_strsplit (filename, ".", 2);
+
+ /* check that user gave a suffix */
+ if (!filename_split[1] || !filename_split[0])
+ {
+ dialog = gtk_message_dialog_new
+ (GTK_WINDOW (window1),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _
+ ("Error wile saving:\nCan't save %s, no suffix"),
+ filename);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+ /* user did gave a suffixe */
+ else
+ {
+ if (gdk_pixbuf_save
+ (pixbuf, filename, filename_split[1],
+ &error, NULL))
+ {
+ dialog = gtk_message_dialog_new
+ (GTK_WINDOW (window1),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_CLOSE,
+ _("File %s saved"), filename);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+ else
+ {
+ dialog = gtk_message_dialog_new
+ (GTK_WINDOW (window1),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Error wile saving:\n%s",
+ error->message);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+ }
+
+ g_strfreev (filename_split);
+ }
+ }
+
+ gtk_widget_destroy (my_file_chooser);
+}
+
+gboolean
+draw_pixbuf (gpointer data)
+{
+ /* set the window title */
+ gtk_window_set_title (GTK_WINDOW (window1), _("hocr-gtk - xsane"));
+
+ on_toolbutton_zoom_fit_clicked (NULL, NULL);
+
+ return FALSE;
+}
+
+gpointer
+run_xsane (gpointer data)
+{
+ GError *error = NULL;
+ gchar *xsane_pipe_pathname = NULL;
+ gchar *xsane_command_line = NULL;
+
+ /* check for pipe to xsane and create if missing */
+ xsane_pipe_pathname = g_strdup_printf ("%s%s%s", g_get_home_dir (),
+ G_DIR_SEPARATOR_S,
+ ".hocr-gtk-xsane-pipe.pnm");
+ xsane_command_line =
+ g_strdup_printf ("xsane -s -n -N '%s'", xsane_pipe_pathname);
+ /* remove pipe if exist */
+ g_remove (xsane_pipe_pathname);
+ if (g_spawn_command_line_sync (xsane_command_line,
+ NULL, NULL, NULL, &error))
+ /* read file */
+ {
+ GdkPixbuf *new_pixbuf = NULL;
+
+ new_pixbuf =
+ gdk_pixbuf_new_from_file (xsane_pipe_pathname, NULL);
+
+ /* check if realy a picture file */
+ if (new_pixbuf)
+ {
+ /* unreff old picture */
+ if (pixbuf)
+ {
+ g_object_unref (pixbuf);
+ }
+
+ /* replace old pixbuf */
+ pixbuf = new_pixbuf;
+
+ gtk_timeout_add (100, draw_pixbuf, (gpointer) NULL);
+ }
+ }
+
+ /* free path name string */
+ g_free (xsane_pipe_pathname);
+ g_free (xsane_command_line);
+ gtk_window_deiconify (GTK_WINDOW (window1));
+ return data;
+}
+
+void
+on_xsane_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+ /* only one run is posible */
+ if (!g_static_mutex_trylock (&mutex))
+ return;
+
+ /* is xsane present */
+ if (!g_find_program_in_path ("xsane"))
+ {
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new
+ (GTK_WINDOW (window1),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Error wile opening xsane:\nCan't find xsane on system path.");
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+ else
+ {
+ /* gtk_window_iconify (GTK_WINDOW (window1)); */
+ g_thread_create (run_xsane, NULL, FALSE, NULL);
+ }
+
+ /* unlock mutex */
+ g_static_mutex_unlock (&mutex);
+
+ return;
+}
+
+void
on_toolbutton_apply_clicked (GtkToolButton * toolbutton, gpointer user_data)
{
GtkTextBuffer *text_buffer;
@@ -372,13 +564,10 @@
height = gdk_pixbuf_get_height (vis_pixbuf);
width = gdk_pixbuf_get_width (vis_pixbuf);
-
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
-
if (pixbuf)
{
do_ocr (pixbuf, text_buffer);
-
if (vis_pixbuf)
{
g_object_unref (vis_pixbuf);
@@ -388,7 +577,6 @@
vis_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
width, height,
GDK_INTERP_BILINEAR);
-
gtk_image_set_from_pixbuf (GTK_IMAGE (image), vis_pixbuf);
}
}
@@ -396,6 +584,9 @@
void
on_toolbutton_about_clicked (GtkToolButton * toolbutton, gpointer user_data)
{
+ GError *error = NULL;
+ GdkPixbuf *hocr_logo = gdk_pixbuf_new_from_file (LOGO, &error);
+
static const gchar *authors[] = {
"Yaacov Zamir <kzamir at walla.co.il>",
NULL
@@ -404,18 +595,16 @@
"Yaacov Zamir <kzamir at walla.co.il>",
NULL
};
-
- gtk_show_about_dialog (GTK_WINDOW (window1), "name", _("HOCR-GTK"),
+ static const char *artists[] = {
+ "Shlomi Israel <sijproject at gmail.com>",
+ NULL
+ };
+ gtk_show_about_dialog (GTK_WINDOW (window1),
+ "name", _("HOCR-GTK"),
"version", VERSION,
- "copyright",
- "Copyright \xc2\xa9 2005 Yaacov Zamir",
- "comments",
- _
- ("HOCR-GTK - Hebrew character recognition software.\n\
-This project is supported by a grant form the Israeli Internet Association."),
- "authors", authors, "documenters", documenters,
- "translator-credits", _("translator_credits"),
- NULL);
+ "copyright", "Copyright \xc2\xa9 2005 Yaacov Zamir", "comments", _("HOCR-GTK - Hebrew character recognition software.\n\
+This project is supported by a grant form the Israeli Internet Association."), "authors", authors,
+ "documenters", documenters, "translator-credits", _("translator_credits"), "artists", artists, "website", "http://hocr.berlios.de", "logo", hocr_logo, NULL);
}
void
@@ -425,7 +614,6 @@
height = gdk_pixbuf_get_height (vis_pixbuf);
width = gdk_pixbuf_get_width (vis_pixbuf);
-
if (pixbuf)
{
if (vis_pixbuf)
@@ -435,12 +623,13 @@
}
vis_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
- (int) ((double) width *
+ (int) ((double)
+ width *
1.2),
- (int) ((double) height *
+ (int) ((double)
+ height *
1.2),
GDK_INTERP_BILINEAR);
-
gtk_image_set_from_pixbuf (GTK_IMAGE (image), vis_pixbuf);
}
}
@@ -452,7 +641,6 @@
height = gdk_pixbuf_get_height (vis_pixbuf);
width = gdk_pixbuf_get_width (vis_pixbuf);
-
if (pixbuf)
{
if (vis_pixbuf)
@@ -462,12 +650,13 @@
}
vis_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
- (int) ((double) width *
+ (int) ((double)
+ width *
0.8),
- (int) ((double) height *
+ (int) ((double)
+ height *
0.8),
GDK_INTERP_BILINEAR);
-
gtk_image_set_from_pixbuf (GTK_IMAGE (image), vis_pixbuf);
}
}
@@ -480,10 +669,8 @@
gtk_window_get_size (GTK_WINDOW (window1), &window_width,
&window_height);
window_width -= 20;
-
height = gdk_pixbuf_get_height (pixbuf);
width = gdk_pixbuf_get_width (pixbuf);
-
if (pixbuf)
{
if (vis_pixbuf)
@@ -495,11 +682,13 @@
vis_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
window_width,
(int) ((double)
- window_width *
- (double) height /
- (double) width),
+ window_width
+ *
+ (double)
+ height /
+ (double)
+ width),
GDK_INTERP_BILINEAR);
-
gtk_image_set_from_pixbuf (GTK_IMAGE (image), vis_pixbuf);
}
}
@@ -511,15 +700,14 @@
GtkSpell *spell = NULL;
spell = gtkspell_get_from_text_view (GTK_TEXT_VIEW (textview));
-
if (spell)
{
gtkspell_detach (spell);
}
else
{
- spell = gtkspell_new_attach (GTK_TEXT_VIEW (textview), NULL,
- NULL);
+ spell = gtkspell_new_attach (GTK_TEXT_VIEW (textview),
+ NULL, NULL);
gtkspell_set_language (spell, "he_IL", NULL);
}
}
@@ -530,7 +718,6 @@
GdkEvent * event, gpointer user_data)
{
set_rc_file ();
-
if (pixbuf)
{
g_object_unref (pixbuf);
@@ -544,7 +731,6 @@
}
g_free (font_name);
-
gtk_main_quit ();
return FALSE;
}
@@ -553,7 +739,6 @@
on_toolbutton_quit_clicked (GtkToolButton * toolbutton, gpointer user_data)
{
set_rc_file ();
-
if (pixbuf)
{
g_object_unref (pixbuf);
@@ -567,7 +752,6 @@
}
g_free (font_name);
-
gtk_main_quit ();
}
@@ -605,9 +789,8 @@
/* create font dialog */
fsd = gtk_font_selection_dialog_new (_("Set text font"));
- gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG
- (fsd), font_name);
-
+ gtk_font_selection_dialog_set_font_name
+ (GTK_FONT_SELECTION_DIALOG (fsd), font_name);
/* run dialog */
result = gtk_dialog_run (GTK_DIALOG (fsd));
switch (result)
@@ -615,15 +798,14 @@
case GTK_RESPONSE_OK:
/* get the new font name */
g_free (font_name);
- font_name = g_strdup (gtk_font_selection_dialog_get_font_name
- (GTK_FONT_SELECTION_DIALOG (fsd)));
-
+ font_name =
+ g_strdup
+ (gtk_font_selection_dialog_get_font_name
+ (GTK_FONT_SELECTION_DIALOG (fsd)));
/* Change default font throughout the text widget */
font_desc = pango_font_description_from_string (font_name);
-
gtk_widget_modify_font (textview, font_desc);
pango_font_description_free (font_desc);
-
break;
default:
/* do nothing since dialog was cancelled */
@@ -674,79 +856,63 @@
GError *error = NULL;
gchar *content;
+ /* do not use file if has command line args */
+ if (usr_cmd_line_args)
+ return;
/* get menu items */
-
/* color boxes ? */
color_text_box_arg = gtk_check_menu_item_get_active
(GTK_CHECK_MENU_ITEM (color_text_box));
-
/* color misread fonts ? */
color_misread_arg = gtk_check_menu_item_get_active
(GTK_CHECK_MENU_ITEM (color_misread));
-
/* do ocr ? */
ocr_arg = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (ocr));
-
/* use dict ? */
use_dict_arg =
gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (use_dict));
-
/* use nikud ? */
use_nikud_arg =
gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM
(use_nikud));
-
/* use spaces ? */
use_spaces_arg =
gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM
(use_spaces));
-
/* use indentation ? */
use_indent_arg =
gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM
(use_indent));
-
/* get path */
pathname = g_strdup_printf ("%s%s%s", g_get_home_dir (),
G_DIR_SEPARATOR_S, ".hocr-gtk.rc");
-
/* create new key file data */
key_file = g_key_file_new ();
-
/* color boxes ? */
g_key_file_set_boolean (key_file, "hocr-gtk",
"color_text_box", color_text_box_arg);
-
/* color misread fonts ? */
g_key_file_set_boolean (key_file, "hocr-gtk",
"color_misread_arg", color_misread_arg);
-
/* do ocr ? */
g_key_file_set_boolean (key_file, "hocr-gtk", "ocr_arg", ocr_arg);
-
/* use dict ? */
g_key_file_set_boolean (key_file, "hocr-gtk",
"use_dict_arg", use_dict_arg);
-
/* use nikud ? */
g_key_file_set_boolean (key_file, "hocr-gtk",
"use_nikud_arg", use_nikud_arg);
-
/* use spaces ? */
g_key_file_set_boolean (key_file, "hocr-gtk",
"use_spaces_arg", use_spaces_arg);
-
/* use indentation ? */
g_key_file_set_boolean (key_file, "hocr-gtk",
"use_indent_arg", use_indent_arg);
-
/* font name */
g_key_file_set_string (key_file, "hocr-gtk", "font_name", font_name);
-
/* save data */
content = g_key_file_to_data (key_file, NULL, NULL);
g_file_set_contents (pathname, content, -1, &error);
-
g_key_file_free (key_file);
g_free (content);
g_free (pathname);
@@ -759,10 +925,12 @@
GError *error = NULL;
PangoFontDescription *font_desc;
+ /* do not use file if has command line args */
+ if (usr_cmd_line_args)
+ return;
/* get path */
pathname = g_strdup_printf ("%s%s%s", g_get_home_dir (),
G_DIR_SEPARATOR_S, ".hocr-gtk.rc");
-
/* is file exist ? */
if (g_file_test (pathname, G_FILE_TEST_EXISTS))
{
@@ -770,56 +938,53 @@
/* create new key file data */
key_file = g_key_file_new ();
-
if (g_key_file_load_from_file (key_file, pathname, 0, &error))
{
/* color boxes ? */
color_text_box_arg =
- g_key_file_get_boolean (key_file, "hocr-gtk",
+ g_key_file_get_boolean (key_file,
+ "hocr-gtk",
"color_text_box",
&error);
-
/* color misread fonts ? */
color_misread_arg =
- g_key_file_get_boolean (key_file, "hocr-gtk",
+ g_key_file_get_boolean (key_file,
+ "hocr-gtk",
"color_misread_arg",
&error);
-
/* do ocr ? */
ocr_arg =
g_key_file_get_boolean (key_file, "hocr-gtk",
"ocr_arg", &error);
-
/* use dict ? */
use_dict_arg =
- g_key_file_get_boolean (key_file, "hocr-gtk",
+ g_key_file_get_boolean (key_file,
+ "hocr-gtk",
"use_dict_arg", &error);
-
/* use nikud ? */
use_nikud_arg =
- g_key_file_get_boolean (key_file, "hocr-gtk",
+ g_key_file_get_boolean (key_file,
+ "hocr-gtk",
"use_nikud_arg",
&error);
-
/* use spaces ? */
use_spaces_arg =
- g_key_file_get_boolean (key_file, "hocr-gtk",
+ g_key_file_get_boolean (key_file,
+ "hocr-gtk",
"use_spaces_arg",
&error);
-
/* use indentation ? */
use_indent_arg =
- g_key_file_get_boolean (key_file, "hocr-gtk",
+ g_key_file_get_boolean (key_file,
+ "hocr-gtk",
"use_indent_arg",
&error);
-
/* font name */
if (font_name)
g_free (font_name);
-
- font_name = g_key_file_get_string (key_file, "hocr-gtk",
- "font_name", &error);
-
+ font_name =
+ g_key_file_get_string (key_file, "hocr-gtk",
+ "font_name", &error);
}
g_key_file_free (key_file);
@@ -835,37 +1000,27 @@
/* color boxes ? */
gtk_check_menu_item_set_active
(GTK_CHECK_MENU_ITEM (color_text_box), color_text_box_arg);
-
/* color misread fonts ? */
gtk_check_menu_item_set_active
(GTK_CHECK_MENU_ITEM (color_misread), color_misread_arg);
-
/* do ocr ? */
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (ocr), ocr_arg);
-
/* use dict ? */
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_dict),
use_dict_arg);
-
/* use nikud ? */
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_nikud),
use_nikud_arg);
-
/* use spaces ? */
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_spaces),
- use_spaces_arg);
-
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
+ (use_spaces), use_spaces_arg);
/* use indentation ? */
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_indent),
- use_indent_arg);
-
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
+ (use_indent), use_indent_arg);
/* Change default font throughout the text widget */
font_desc = pango_font_description_from_string (font_name);
-
gtk_widget_modify_font (textview, font_desc);
pango_font_description_free (font_desc);
-
g_free (pathname);
-
return;
}
Modified: pkg/hocr/trunk/examples/hocr-gtk/callbacks.h
==============================================================================
--- pkg/hocr/trunk/examples/hocr-gtk/callbacks.h (original)
+++ pkg/hocr/trunk/examples/hocr-gtk/callbacks.h Sun Jan 15 21:21:02 2006
@@ -25,6 +25,9 @@
#include <gtk/gtk.h>
+#ifndef __CALLBACKS_H__
+#define __CALLBACKS_H__
+
gboolean
on_window1_delete_event (GtkWidget * widget,
GdkEvent * event, gpointer user_data);
@@ -66,6 +69,10 @@
void on_save_activate (GtkMenuItem * menuitem, gpointer user_data);
+void on_save_picture_activate (GtkMenuItem * menuitem, gpointer user_data);
+
+void on_xsane_activate (GtkMenuItem * menuitem, gpointer user_data);
+
void on_quit_activate (GtkMenuItem * menuitem, gpointer user_data);
void on_font_activate (GtkMenuItem * menuitem, gpointer user_data);
@@ -85,3 +92,5 @@
void get_rc_file ();
void set_rc_file ();
+
+#endif /* __CALLBACKS_H__ */
Modified: pkg/hocr/trunk/examples/hocr-gtk/hocr-gtk.c
==============================================================================
--- pkg/hocr/trunk/examples/hocr-gtk/hocr-gtk.c (original)
+++ pkg/hocr/trunk/examples/hocr-gtk/hocr-gtk.c Sun Jan 15 21:21:02 2006
@@ -27,15 +27,56 @@
# include <config.h>
#endif
+#include <unistd.h>
+#include <sys/stat.h>
+
#include <glib.h>
#include <gtk/gtk.h>
#include "interface.h"
+#include "callbacks.h"
+
+int
+print_help ()
+{
+ printf ("hocr-gtk %s - Hebrew OCR program\n", VERSION);
+ printf ("http://hocr.berlios.de\n");
+ printf ("USAGE: hocr-gtk [OPTION]... [-o][-i file]\n\n");
+
+ printf ("Help options\n\
+ -h Show this help message\n");
+ printf ("Application options\n\
+ -c, Do OCR on picture\n\
+ -c, Color text boxes\n\
+ -d, Use internal dictionary to guess\n\
+ misread fonts.\n\
+ -n, Try to guess nikud for fonts.\n\
+ -s, Use spaces for tabs.\n\
+ -t, Indent indented lines.\n");
+
+ printf ("GTK+\n\
+ --gdk-debug=FLAGS Gdk debugging flags to set\n\
+ --gdk-no-debug=FLAGS Gdk debugging flags to unset\n\
+ --display=DISPLAY X display to use\n\
+ --screen=SCREEN X screen to use\n\
+ --sync Make X calls synchronous\n\
+ --name=NAME Program name as used by the window\n\
+ manager\n\
+ --class=CLASS Program class as used by the window\n\
+ manager\n\
+ --gtk-debug=FLAGS Gtk+ debugging flags to set\n\
+ --gtk-no-debug=FLAGS Gtk+ debugging flags to unset\n\
+ --g-fatal-warnings Make all warnings fatal\n\
+ --gtk-module=MODULE Load an additional Gtk module\n\
+\n");
+
+ return 0;
+}
int
main (int argc, char *argv[])
{
- GtkWidget *window1;
+ char c;
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
@@ -44,10 +85,136 @@
#endif
gtk_init (&argc, &argv);
-
- if (!g_thread_supported ()) g_thread_init (NULL);
-
+
+ /* init thread system if not init already */
+ if (!g_thread_supported ())
+ g_thread_init (NULL);
+
+ /* create main window */
window1 = create_window1 ();
+
+ /* no pixbuf at start */
+ pixbuf = NULL;
+ vis_pixbuf = NULL;
+
+ /* get command line arguments */
+ usr_cmd_line_args = FALSE;
+ color_text_box_arg = FALSE;
+ color_misread_arg = FALSE;
+ ocr_arg = FALSE;
+ use_dict_arg = FALSE;
+ use_nikud_arg = FALSE;
+ use_spaces_arg = FALSE;
+ gboolean use_indent_arg = FALSE;
+
+ while ((c = getopt (argc, argv, "ocdnsthi:")) != EOF)
+ {
+ switch (c)
+ {
+ case 'i':
+ if (optarg)
+ {
+ pixbuf = gdk_pixbuf_new_from_file (optarg,
+ NULL);
+
+ /* check if realy a picture file */
+ if (pixbuf)
+ {
+ char title[255];
+
+ /* set the window title */
+ g_snprintf (title, 255, "%s - %s",
+ _("hocr-gtk"), optarg);
+ gtk_window_set_title (GTK_WINDOW
+ (window1), title);
+
+ on_toolbutton_zoom_fit_clicked (NULL,
+ NULL);
+ }
+ else
+ {
+ printf ("%s: %s %s\n", _("hocr-gtk"),
+ _("can't open picture file -"),
+ optarg);
+ }
+ }
+ break;
+ case 'c':
+ color_text_box_arg = TRUE;
+ color_misread_arg = TRUE;
+ usr_cmd_line_args = TRUE;
+ break;
+ case 'o':
+ ocr_arg = TRUE;
+ usr_cmd_line_args = TRUE;
+ break;
+ case 'd':
+ use_dict_arg = TRUE;
+ usr_cmd_line_args = TRUE;
+ break;
+ case 'n':
+ use_nikud_arg = TRUE;
+ usr_cmd_line_args = TRUE;
+ break;
+ case 's':
+ use_spaces_arg = TRUE;
+ usr_cmd_line_args = TRUE;
+ break;
+ case 't':
+ use_indent_arg = TRUE;
+ usr_cmd_line_args = TRUE;
+ break;
+ case 'h':
+ print_help ();
+
+ return 0;
+ break;
+ default:
+ print_help ();
+
+ return 0;
+ break;
+ }
+ }
+
+ /* if got cmd line args set menu items */
+ if (usr_cmd_line_args)
+ {
+ /* color boxes ? */
+ gtk_check_menu_item_set_active
+ (GTK_CHECK_MENU_ITEM (color_text_box),
+ color_text_box_arg);
+
+ /* color misread fonts ? */
+ gtk_check_menu_item_set_active
+ (GTK_CHECK_MENU_ITEM (color_misread),
+ color_misread_arg);
+
+ /* do ocr ? */
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (ocr),
+ ocr_arg);
+
+ /* use dict ? */
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_dict),
+ use_dict_arg);
+
+ /* use nikud ? */
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_nikud),
+ use_nikud_arg);
+
+ /* use spaces ? */
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
+ (use_spaces), use_spaces_arg);
+
+ /* use indentation ? */
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
+ (use_indent), use_indent_arg);
+ }
+
+ /* readf rc file */
+ get_rc_file ();
+
+ /* run program */
gtk_widget_show (window1);
gtk_main ();
Modified: pkg/hocr/trunk/examples/hocr-gtk/hocr.desktop
==============================================================================
--- pkg/hocr/trunk/examples/hocr-gtk/hocr.desktop (original)
+++ pkg/hocr/trunk/examples/hocr-gtk/hocr.desktop Sun Jan 15 21:21:02 2006
@@ -3,8 +3,8 @@
Name=hocr
Name[he]=hocr
Exec=hocr-gtk
-Icon=text-editor
+Icon=hocr1-48
Terminal=false
Type=Application
-Categories=GTK;Application;Graphics;RasterGraphics;OCR;
+Categories=GTK;Application;Office;OCR;
StartupNotify=true
Modified: pkg/hocr/trunk/examples/hocr-gtk/interface.c
==============================================================================
--- pkg/hocr/trunk/examples/hocr-gtk/interface.c (original)
+++ pkg/hocr/trunk/examples/hocr-gtk/interface.c Sun Jan 15 21:21:02 2006
@@ -75,6 +75,10 @@
GtkWidget *apply;
GtkWidget *save;
GtkWidget *separatormenuitem1;
+ GtkWidget *save_picture;
+ GtkWidget *save_picture_image;
+ GtkWidget *xsane;
+ GtkWidget *separatormenuitem2;
GtkWidget *quit;
GtkWidget *menuitem2;
GtkWidget *menuitem2_menu;
@@ -106,9 +110,6 @@
GtkWidget *toolbutton_zoom_in;
GtkWidget *toolbutton_zoom_out;
GtkWidget *toolbutton_zoom_fit;
- GtkWidget *toolitem3;
- GtkWidget *vseparator3;
- GtkWidget *toolbutton_about;
/* image */
GtkWidget *vpaned1;
@@ -125,7 +126,7 @@
window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (window1, 600, 300);
gtk_window_maximize (GTK_WINDOW (window1));
- gtk_window_set_title (GTK_WINDOW (window1), _("hocr-gui"));
+ gtk_window_set_title (GTK_WINDOW (window1), _("hocr-gtk"));
vbox1 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox1);
@@ -161,6 +162,24 @@
gtk_container_add (GTK_CONTAINER (menuitem1_menu), separatormenuitem1);
gtk_widget_set_sensitive (separatormenuitem1, FALSE);
+ save_picture = gtk_image_menu_item_new_with_label (_("Save Picture"));
+ save_picture_image =
+ gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
+ gtk_widget_show (save_picture_image);
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (save_picture),
+ save_picture_image);
+ gtk_widget_show (save_picture);
+ gtk_container_add (GTK_CONTAINER (menuitem1_menu), save_picture);
+
+ xsane = gtk_menu_item_new_with_label (_("Xsane"));
+ gtk_widget_show (xsane);
+ gtk_container_add (GTK_CONTAINER (menuitem1_menu), xsane);
+
+ separatormenuitem2 = gtk_separator_menu_item_new ();
+ gtk_widget_show (separatormenuitem2);
+ gtk_container_add (GTK_CONTAINER (menuitem1_menu), separatormenuitem2);
+ gtk_widget_set_sensitive (separatormenuitem2, FALSE);
+
quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
gtk_widget_show (quit);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), quit);
@@ -363,20 +382,6 @@
gtk_widget_show (toolbutton_zoom_fit);
gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_zoom_fit);
- toolitem3 = (GtkWidget *) gtk_tool_item_new ();
- gtk_widget_show (toolitem3);
- gtk_container_add (GTK_CONTAINER (toolbar), toolitem3);
- vseparator3 = gtk_vseparator_new ();
- gtk_widget_show (vseparator3);
- gtk_container_add (GTK_CONTAINER (toolitem3), vseparator3);
-
- toolbutton_about =
- (GtkWidget *) gtk_tool_button_new_from_stock ("gtk-about");
- gtk_widget_show (toolbutton_about);
- gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_about);
- gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_about), tooltips,
- _("About this application"), NULL);
-
/* image */
vpaned1 = gtk_vpaned_new ();
gtk_widget_show (vpaned1);
@@ -451,16 +456,11 @@
g_signal_connect ((gpointer) toolbutton_zoom_fit, "clicked",
G_CALLBACK (on_toolbutton_zoom_fit_clicked), NULL);
- g_signal_connect ((gpointer) toolbutton_about, "clicked",
- G_CALLBACK (on_toolbutton_about_clicked), NULL);
#ifdef WITH_GTKSPELL
g_signal_connect ((gpointer) toolbutton_spell, "clicked",
G_CALLBACK (on_toolbutton_spell_clicked), NULL);
#endif
- /* readf rc file */
- get_rc_file();
-
/* menu */
g_signal_connect ((gpointer) open, "activate",
G_CALLBACK (on_open_activate), NULL);
@@ -468,6 +468,10 @@
G_CALLBACK (on_apply_activate), NULL);
g_signal_connect ((gpointer) save, "activate",
G_CALLBACK (on_save_activate), NULL);
+ g_signal_connect ((gpointer) save_picture, "activate",
+ G_CALLBACK (on_save_picture_activate), NULL);
+ g_signal_connect ((gpointer) xsane, "activate",
+ G_CALLBACK (on_xsane_activate), NULL);
g_signal_connect ((gpointer) quit, "activate",
G_CALLBACK (on_quit_activate), NULL);
g_signal_connect ((gpointer) font, "activate",
Modified: pkg/hocr/trunk/examples/hocr-gtk/interface.h
==============================================================================
--- pkg/hocr/trunk/examples/hocr-gtk/interface.h (original)
+++ pkg/hocr/trunk/examples/hocr-gtk/interface.h Sun Jan 15 21:21:02 2006
@@ -28,6 +28,9 @@
# include <config.h>
#endif
+#ifndef __INTERFACE_H__
+#define __INTERFACE_H__
+
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
@@ -77,6 +80,7 @@
char *font_name;
/* user pref */
+gboolean usr_cmd_line_args;
gboolean color_text_box_arg;
gboolean color_misread_arg;
gboolean ocr_arg;
@@ -87,3 +91,9 @@
/* user interface for window */
GtkWidget *create_window1 (void);
+
+/* the pixbuf used bey the interface and OCR systems */
+GdkPixbuf *pixbuf;
+GdkPixbuf *vis_pixbuf;
+
+#endif /* __INTERFACE_H__ */
Modified: pkg/hocr/trunk/examples/hocr-qt/hocr_qt.cpp
==============================================================================
--- pkg/hocr/trunk/examples/hocr-qt/hocr_qt.cpp (original)
+++ pkg/hocr/trunk/examples/hocr-qt/hocr_qt.cpp Sun Jan 15 21:21:02 2006
@@ -38,8 +38,8 @@
scrollArea->setWidget (imageLabel);
textEdit = new QTextEdit;
- textEdit->setAlignment (Qt::AlignRight);
-
+ textEdit->setLayoutDirection( Qt::RightToLeft );
+
createActions ();
createToolBars ();
@@ -215,8 +215,7 @@
hocr_engine->set_brightness (100);
// get text into the text edit window
- textEdit->append (QString::fromUtf8 (hocr_engine->do_ocr ()));
- textEdit->setAlignment (Qt::AlignRight);
+ textEdit->setPlainText( QString::fromUtf8(hocr_engine->do_ocr ()) );
// if not set_pixels to 0 the next <free (hocr)>
// will free the original image window picture !
Modified: pkg/hocr/trunk/examples/hocr/Makefile.in
==============================================================================
--- pkg/hocr/trunk/examples/hocr/Makefile.in (original)
+++ pkg/hocr/trunk/examples/hocr/Makefile.in Sun Jan 15 21:21:02 2006
@@ -82,8 +82,10 @@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
HAVE_LIB = @HAVE_LIB@
+IMAGEJ_SOURCE_PATH = @IMAGEJ_SOURCE_PATH@
INSTOBJEXT = @INSTOBJEXT@
INTLLIBS = @INTLLIBS@
+JAVA_DEV_KIT_PATH = @JAVA_DEV_KIT_PATH@
LIB = @LIB@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
Modified: pkg/hocr/trunk/examples/hocr/hocr-cmd.c
==============================================================================
--- pkg/hocr/trunk/examples/hocr/hocr-cmd.c (original)
+++ pkg/hocr/trunk/examples/hocr/hocr-cmd.c Sun Jan 15 21:21:02 2006
@@ -41,11 +41,16 @@
{
printf ("hocr %s - Hebrew OCR program\n", VERSION);
printf ("http://hocr.berlios.de\n");
- printf ("USAGE: hocr [OPTION]... -i pic_filename [-o text_filename] [-f html/text]\n");
- printf (" -d, Use internal dictionary to guess misread fonts.\n");
- printf (" -n, Try to guess nikud for fonts.\n");
- printf (" -s, Use spaces for tabs.\n");
- printf (" -t, Indent indented lines.\n");
+ printf ("USAGE: hocr [OPTION]... [-i] [pnm_file]\n\n");
+ printf (" If the pnm file is a single dash, or no pnm file\n\
+ is given, PNM data is read from stdin\n\n");
+ printf (" -o file, output to text file.\n");
+ printf (" -f format, output format can be 'html' or 'text'.\n");
+ printf (" -d, Use internal dictionary to guess misread fonts.\n");
+ printf (" -n, Try to guess nikud for fonts.\n");
+ printf (" -s, Use spaces for tabs.\n");
+ printf (" -t, Indent indented lines.\n");
+ printf (" -p file, write PPM image with boxes around detected characters.\n");
printf ("\n");
return 0;
@@ -116,10 +121,12 @@
int opt_n = 0;
int opt_s = 0;
int opt_t = 0;
+ int opt_p = 0;
char c;
char filename_in[STRING_MAX_SIZE];
char filename_out[STRING_MAX_SIZE];
+ char pnm_filename_out[STRING_MAX_SIZE];
char format_out[STRING_MAX_SIZE];
hocr_pixbuf *pix;
@@ -129,8 +136,12 @@
* default output is text file
*/
format_out[0] = 't';
+ /*
+ * default input file is stdin
+ */
+ filename_in[0] = '\0';
- while ((c = getopt (argc, argv, "dnsthi:o:f:")) != EOF)
+ while ((c = getopt (argc, argv, "dnsthi:o:f:p:")) != EOF)
{
switch (c)
{
@@ -155,6 +166,13 @@
opt_f = 1;
}
break;
+ case 'p':
+ if (optarg && strlen (optarg) < STRING_MAX_SIZE)
+ {
+ strcpy (pnm_filename_out, optarg);
+ opt_p = 1;
+ }
+ break;
case 'd':
opt_d = 1;
break;
@@ -178,7 +196,30 @@
}
}
- if (opt_i == 0)
+ /* check for one extra parameter */
+ if (argc == (optind + 1))
+ {
+ /* i already have a file name: must be an error */
+ if (opt_i == 1)
+ {
+ print_help ();
+ exit (0);
+ }
+ /* this is a file name */
+ if (opt_i == 0 && strlen (argv[optind]) < STRING_MAX_SIZE)
+ {
+ /* check for command fomrat "hocr filename" */
+ strcpy (filename_in, argv[optind]);
+
+ /* some times pepole use '-' to indecate stdin */
+ if (filename_in[0] == '-' && filename_in[1] == '\0')
+ filename_in[0] = '\0';
+
+ opt_i = 1;
+ }
+ }
+ /* if not one extra parameter must be no parameters */
+ else if (argc != optind)
{
print_help ();
exit (0);
@@ -204,26 +245,31 @@
/* use dict ? */
if (opt_d)
- pix->command |= HOCR_COMMAND_DICT;
+ pix->command |= HOCR_COMMAND_DICT;
/* use nikud ? */
if (opt_n)
- pix->command |= HOCR_COMMAND_NIKUD;
-
+ pix->command |= HOCR_COMMAND_NIKUD;
+
/* use spaces ? */
if (opt_s)
- pix->command |= HOCR_COMMAND_USE_SPACE_FOR_TAB;
-
+ pix->command |= HOCR_COMMAND_USE_SPACE_FOR_TAB;
+
/* use indentation ? */
if (opt_t)
- pix->command |= HOCR_COMMAND_USE_INDENTATION;
-
+ pix->command |= HOCR_COMMAND_USE_INDENTATION;
+
+ /* color misread font and text boxes */
+ if (opt_p)
+ pix->command |=
+ HOCR_COMMAND_COLOR_BOXES | HOCR_COMMAND_COLOR_MISREAD;
+
/* create text buffer */
text = hocr_text_buffer_new ();
if (!text)
{
- printf ("hocr-gnome: can\'t allocate memory for text out\n");
+ printf ("hocr: can\'t allocate memory for text out\n");
return 0;
}
@@ -233,19 +279,29 @@
hocr_do_ocr (pix, text);
/*
- * unref memory
- */
- hocr_pixbuf_unref (pix);
-
- /*
* print out the text
*/
- if (opt_o == 1)
+ if (opt_o)
save_text (filename_out, format_out, text->text);
else
save_text (NULL, format_out, text->text);
- /* unref text_buffer */
+ /*
+ * save ppm file
+ */
+ if (opt_p && !hocr_pixbuf_save_as_pnm (pix, pnm_filename_out))
+ {
+ printf ("hocr: can't write pnm file %s\n", pnm_filename_out);
+ }
+
+ /*
+ * unref hocr_pixbuf
+ */
+ hocr_pixbuf_unref (pix);
+
+ /*
+ * unref text_buffer
+ */
hocr_text_buffer_unref (text);
return 0;
Modified: pkg/hocr/trunk/examples/hocr/hocr.1
==============================================================================
--- pkg/hocr/trunk/examples/hocr/hocr.1 (original)
+++ pkg/hocr/trunk/examples/hocr/hocr.1 Sun Jan 15 21:21:02 2006
@@ -7,12 +7,13 @@
.PP
.SH "SYNOPSIS"
.B hocr
-[\fIOPTION\fR] [\fB-i\fR] \fIpnm file\fR
+[\fIOPTION\fR] [\fB-i\fR] [\fIpnm file\fR]
.fi
.SH DESCRIPTION
hocr is an optical character recognition program that can be used from
-the command line. It takes input in PBM
-format, and writes recognized utf-8 Hebrew text to \fBstdout\fR. input pbm file must be a binary black and white pnm file (magic "P4/5").
+the command line. It takes input in pbm
+format, and writes recognized utf-8 Hebrew text to \fBstdout\fR. Input pbm file must be a binary black and white pnm file (magic "P4/5").
+If the pnm file is a single dash (or no file given), PNM data is read from \fBstdin\fR.
.PP
.SH OPTIONS
.TP
@@ -40,6 +41,9 @@
\fB\-f\fR \fIformat\fR
output \fIformat\fR (html text)
.TP
+\fB\-p\fR \fIfile\fR
+write PPM image with boxes around detected characters to \fIfile\fR.
+.TP
.SH "SEE ALSO"
gocr(1), ocrad(1)
.SH "AUTHOR"
Modified: pkg/hocr/trunk/libhocr.pc
==============================================================================
--- pkg/hocr/trunk/libhocr.pc (original)
+++ pkg/hocr/trunk/libhocr.pc Sun Jan 15 21:21:02 2006
@@ -5,6 +5,6 @@
Name: libhocr
Description: A c library for hebrew optical character recognition
-Version: 0.7.1
+Version: 0.8.0
Libs: -L${libdir} -lm -lhocr
Cflags: -I${includedir}
Modified: pkg/hocr/trunk/ltmain.sh
==============================================================================
--- pkg/hocr/trunk/ltmain.sh (original)
+++ pkg/hocr/trunk/ltmain.sh Sun Jan 15 21:21:02 2006
@@ -43,7 +43,7 @@
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION="1.5.22 Debian 1.5.22-1"
+VERSION="1.5.22 Debian 1.5.22-2"
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
# See if we are running on zsh, and set the options which allow our
Modified: pkg/hocr/trunk/po/he.gmo
==============================================================================
Binary files. No diff available.
Modified: pkg/hocr/trunk/po/he.po
==============================================================================
--- pkg/hocr/trunk/po/he.po (original)
+++ pkg/hocr/trunk/po/he.po Sun Jan 15 21:21:02 2006
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: hocr 0.4.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-01-02 20:25+0200\n"
+"POT-Creation-Date: 2006-01-15 01:03+0200\n"
"PO-Revision-Date: 2005-08-17 02:49+0300\n"
"Last-Translator: kzamir <kzamir at walla.co.il>\n"
"Language-Team: Hebrew <LL at li.org>\n"
@@ -16,142 +16,172 @@
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: examples/hocr-gtk/interface.c:128
-msgid "hocr-gui"
+#. set the window title
+#: examples/hocr-gtk/interface.c:129 examples/hocr-gtk/callbacks.c:298
+msgid "hocr-gtk"
msgstr ""
-#: examples/hocr-gtk/interface.c:140
+#: examples/hocr-gtk/interface.c:141
msgid "_File"
msgstr "קובץ"
-#: examples/hocr-gtk/interface.c:168
+#: examples/hocr-gtk/interface.c:165
+msgid "Save Picture"
+msgstr "שמור תמונה"
+
+#: examples/hocr-gtk/interface.c:174
+msgid "Xsane"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:187
msgid "_Edit"
msgstr "עריכה"
-#: examples/hocr-gtk/interface.c:199
+#: examples/hocr-gtk/interface.c:218
msgid "Color boxes"
msgstr "צבע מסגרות"
-#: examples/hocr-gtk/interface.c:202
+#: examples/hocr-gtk/interface.c:221
msgid "Color text boxes"
msgstr "צבע מסגרות של אזורי טקסט"
-#: examples/hocr-gtk/interface.c:208
+#: examples/hocr-gtk/interface.c:227
msgid "Color misread"
msgstr "צבע אותיות"
-#: examples/hocr-gtk/interface.c:211
+#: examples/hocr-gtk/interface.c:230
msgid "Color misread fonts"
msgstr "צבע אותיות שלא פענחו"
-#: examples/hocr-gtk/interface.c:216
+#: examples/hocr-gtk/interface.c:235
msgid "Clear"
msgstr "נקה"
-#: examples/hocr-gtk/interface.c:220
+#: examples/hocr-gtk/interface.c:239
msgid "Clear text each time you ocr new scan"
msgstr "נקה את אזור הטקסט לפני פענוח טקסט חדש"
-#: examples/hocr-gtk/interface.c:223
+#: examples/hocr-gtk/interface.c:242
msgid "Ocr"
msgstr ""
-#: examples/hocr-gtk/interface.c:227
+#: examples/hocr-gtk/interface.c:246
msgid "Try to recognize fonts in scaned text"
msgstr "נסה לפענח אותיות"
-#: examples/hocr-gtk/interface.c:230
+#: examples/hocr-gtk/interface.c:249
msgid "Use dictionary"
msgstr "מילון"
-#: examples/hocr-gtk/interface.c:235
-#, fuzzy
+#: examples/hocr-gtk/interface.c:254
msgid ""
"Try to guess unrecognized fonts in scaned text using internal dictionary"
msgstr "נסה לתקן מילים שגויות בעזרת מילון פנימי"
-#: examples/hocr-gtk/interface.c:239
+#: examples/hocr-gtk/interface.c:258
msgid "Use nikud"
msgstr "ניקוד"
-#: examples/hocr-gtk/interface.c:243
+#: examples/hocr-gtk/interface.c:262
msgid "Try to guess nikud"
msgstr "נסה לנחש את הניקוד של האות המזוהה"
-#: examples/hocr-gtk/interface.c:246
+#: examples/hocr-gtk/interface.c:265
msgid "Use spaces"
-msgstr "רווח"
+msgstr "רווחים"
-#: examples/hocr-gtk/interface.c:250
+#: examples/hocr-gtk/interface.c:269
msgid "Use spaces for tabs"
msgstr "השתמש ברווחים במקום סימני טאב"
-#: examples/hocr-gtk/interface.c:255
+#: examples/hocr-gtk/interface.c:274
msgid "Use indentation"
msgstr "עימוד"
-#: examples/hocr-gtk/interface.c:259
+#: examples/hocr-gtk/interface.c:278
msgid "Try to guess line indentation"
msgstr "נסה לנחש את העימוד של השורה המזוהה"
-#: examples/hocr-gtk/interface.c:263
+#: examples/hocr-gtk/interface.c:282
msgid "_View"
msgstr "מראה"
-#: examples/hocr-gtk/interface.c:287
+#: examples/hocr-gtk/interface.c:306
msgid "_Help"
msgstr "עזרה"
-#: examples/hocr-gtk/interface.c:294
+#: examples/hocr-gtk/interface.c:313
msgid "_About"
msgstr "אודות"
-#: examples/hocr-gtk/interface.c:311
+#: examples/hocr-gtk/interface.c:330
msgid "Open a new picture for the OCR"
msgstr "פתח תמונה חדשה לצורך פענוח"
-#: examples/hocr-gtk/interface.c:318
+#: examples/hocr-gtk/interface.c:337
msgid "Convert picture to text"
msgstr "נסה לפענח תמונה"
-#: examples/hocr-gtk/interface.c:325
+#: examples/hocr-gtk/interface.c:344
msgid "Save the text created by the OCR"
msgstr "שמור את הטקסט המפוענח"
-#: examples/hocr-gtk/interface.c:341
+#: examples/hocr-gtk/interface.c:360
msgid "Spell check the text"
msgstr "בדוק איות"
-#: examples/hocr-gtk/interface.c:378
-msgid "About this application"
-msgstr "אודות ישום זה"
+#: examples/hocr-gtk/callbacks.c:347
+msgid "hocr save text"
+msgstr "שמור קובץ טקסט"
+
+#: examples/hocr-gtk/callbacks.c:386
+msgid ""
+"Error wile saving:\n"
+"No picture to save"
+msgstr ""
+"שגיאה בעת שמירה:\n"
+"אין תמונה לשמור"
+
+#: examples/hocr-gtk/callbacks.c:395
+msgid "hocr save picture"
+msgstr "שמור קובץ תמונה"
+
+#: examples/hocr-gtk/callbacks.c:422
+#, c-format
+msgid ""
+"Error wile saving:\n"
+"Can't save %s, no suffix"
+msgstr ""
+"שגיאה בעת שמירה:\n"
+"אין סיומת לקובץ %s"
+
+#: examples/hocr-gtk/callbacks.c:440
+#, c-format
+msgid "File %s saved"
+msgstr "הקובץ %s נשמר"
#. set the window title
-#: examples/hocr-gtk/callbacks.c:297
-msgid "hocr-gtk"
+#: examples/hocr-gtk/callbacks.c:471
+msgid "hocr-gtk - xsane"
msgstr ""
-#: examples/hocr-gtk/callbacks.c:408
+#: examples/hocr-gtk/callbacks.c:603
msgid "HOCR-GTK"
msgstr ""
-#: examples/hocr-gtk/callbacks.c:414
+#: examples/hocr-gtk/callbacks.c:605
msgid ""
"HOCR-GTK - Hebrew character recognition software.\n"
"This project is supported by a grant form the Israeli Internet Association."
msgstr ""
+"HOCR-GTK - מזהה אופטי עברי.\n"
+"פרויקט זה נתמך על-ידי מענק של איגוד האינטרנט הישראלי."
-#: examples/hocr-gtk/callbacks.c:417
+#: examples/hocr-gtk/callbacks.c:607
msgid "translator_credits"
msgstr "יעקב זמיר"
#. create font dialog
-#: examples/hocr-gtk/callbacks.c:607
+#: examples/hocr-gtk/callbacks.c:791
msgid "Set text font"
msgstr "קבע את אותיות אזור הטקסט"
-
-#~ msgid "HOCR-GTK - Hebrew character recognition software"
-#~ msgstr "HOCR-GTK - מזהה אותיות אופטי עברי"
-
-#~ msgid "Quit this program"
-#~ msgstr "סגור ישום זה"
Modified: pkg/hocr/trunk/po/hocr-gtk.pot
==============================================================================
--- pkg/hocr/trunk/po/hocr-gtk.pot (original)
+++ pkg/hocr/trunk/po/hocr-gtk.pot Sun Jan 15 21:21:02 2006
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-01-02 20:25+0200\n"
+"POT-Creation-Date: 2006-01-15 01:03+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: LANGUAGE <LL at li.org>\n"
@@ -16,135 +16,166 @@
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: examples/hocr-gtk/interface.c:128
-msgid "hocr-gui"
+#. set the window title
+#: examples/hocr-gtk/interface.c:129 examples/hocr-gtk/callbacks.c:298
+msgid "hocr-gtk"
msgstr ""
-#: examples/hocr-gtk/interface.c:140
+#: examples/hocr-gtk/interface.c:141
msgid "_File"
msgstr ""
-#: examples/hocr-gtk/interface.c:168
+#: examples/hocr-gtk/interface.c:165
+msgid "Save Picture"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:174
+msgid "Xsane"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:187
msgid "_Edit"
msgstr ""
-#: examples/hocr-gtk/interface.c:199
+#: examples/hocr-gtk/interface.c:218
msgid "Color boxes"
msgstr ""
-#: examples/hocr-gtk/interface.c:202
+#: examples/hocr-gtk/interface.c:221
msgid "Color text boxes"
msgstr ""
-#: examples/hocr-gtk/interface.c:208
+#: examples/hocr-gtk/interface.c:227
msgid "Color misread"
msgstr ""
-#: examples/hocr-gtk/interface.c:211
+#: examples/hocr-gtk/interface.c:230
msgid "Color misread fonts"
msgstr ""
-#: examples/hocr-gtk/interface.c:216
+#: examples/hocr-gtk/interface.c:235
msgid "Clear"
msgstr ""
-#: examples/hocr-gtk/interface.c:220
+#: examples/hocr-gtk/interface.c:239
msgid "Clear text each time you ocr new scan"
msgstr ""
-#: examples/hocr-gtk/interface.c:223
+#: examples/hocr-gtk/interface.c:242
msgid "Ocr"
msgstr ""
-#: examples/hocr-gtk/interface.c:227
+#: examples/hocr-gtk/interface.c:246
msgid "Try to recognize fonts in scaned text"
msgstr ""
-#: examples/hocr-gtk/interface.c:230
+#: examples/hocr-gtk/interface.c:249
msgid "Use dictionary"
msgstr ""
-#: examples/hocr-gtk/interface.c:235
+#: examples/hocr-gtk/interface.c:254
msgid ""
"Try to guess unrecognized fonts in scaned text using internal dictionary"
msgstr ""
-#: examples/hocr-gtk/interface.c:239
+#: examples/hocr-gtk/interface.c:258
msgid "Use nikud"
msgstr ""
-#: examples/hocr-gtk/interface.c:243
+#: examples/hocr-gtk/interface.c:262
msgid "Try to guess nikud"
msgstr ""
-#: examples/hocr-gtk/interface.c:246
+#: examples/hocr-gtk/interface.c:265
msgid "Use spaces"
msgstr ""
-#: examples/hocr-gtk/interface.c:250
+#: examples/hocr-gtk/interface.c:269
msgid "Use spaces for tabs"
msgstr ""
-#: examples/hocr-gtk/interface.c:255
+#: examples/hocr-gtk/interface.c:274
msgid "Use indentation"
msgstr ""
-#: examples/hocr-gtk/interface.c:259
+#: examples/hocr-gtk/interface.c:278
msgid "Try to guess line indentation"
msgstr ""
-#: examples/hocr-gtk/interface.c:263
+#: examples/hocr-gtk/interface.c:282
msgid "_View"
msgstr ""
-#: examples/hocr-gtk/interface.c:287
+#: examples/hocr-gtk/interface.c:306
msgid "_Help"
msgstr ""
-#: examples/hocr-gtk/interface.c:294
+#: examples/hocr-gtk/interface.c:313
msgid "_About"
msgstr ""
-#: examples/hocr-gtk/interface.c:311
+#: examples/hocr-gtk/interface.c:330
msgid "Open a new picture for the OCR"
msgstr ""
-#: examples/hocr-gtk/interface.c:318
+#: examples/hocr-gtk/interface.c:337
msgid "Convert picture to text"
msgstr ""
-#: examples/hocr-gtk/interface.c:325
+#: examples/hocr-gtk/interface.c:344
msgid "Save the text created by the OCR"
msgstr ""
-#: examples/hocr-gtk/interface.c:341
+#: examples/hocr-gtk/interface.c:360
msgid "Spell check the text"
msgstr ""
-#: examples/hocr-gtk/interface.c:378
-msgid "About this application"
+#: examples/hocr-gtk/callbacks.c:347
+msgid "hocr save text"
+msgstr ""
+
+#: examples/hocr-gtk/callbacks.c:386
+msgid ""
+"Error wile saving:\n"
+"No picture to save"
+msgstr ""
+
+#: examples/hocr-gtk/callbacks.c:395
+msgid "hocr save picture"
+msgstr ""
+
+#: examples/hocr-gtk/callbacks.c:422
+#, c-format
+msgid ""
+"Error wile saving:\n"
+"Can't save %s, no suffix"
+msgstr ""
+
+#: examples/hocr-gtk/callbacks.c:440
+#, c-format
+msgid "File %s saved"
msgstr ""
#. set the window title
-#: examples/hocr-gtk/callbacks.c:297
-msgid "hocr-gtk"
+#: examples/hocr-gtk/callbacks.c:471
+msgid "hocr-gtk - xsane"
msgstr ""
-#: examples/hocr-gtk/callbacks.c:408
+#: examples/hocr-gtk/callbacks.c:603
msgid "HOCR-GTK"
msgstr ""
-#: examples/hocr-gtk/callbacks.c:414
+#: examples/hocr-gtk/callbacks.c:605
msgid ""
"HOCR-GTK - Hebrew character recognition software.\n"
"This project is supported by a grant form the Israeli Internet Association."
msgstr ""
-#: examples/hocr-gtk/callbacks.c:417
+#: examples/hocr-gtk/callbacks.c:607
msgid "translator_credits"
msgstr ""
#. create font dialog
-#: examples/hocr-gtk/callbacks.c:607
+#: examples/hocr-gtk/callbacks.c:791
msgid "Set text font"
msgstr ""
Modified: pkg/hocr/trunk/src/Makefile.in
==============================================================================
--- pkg/hocr/trunk/src/Makefile.in (original)
+++ pkg/hocr/trunk/src/Makefile.in Sun Jan 15 21:21:02 2006
@@ -82,8 +82,10 @@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
HAVE_LIB = @HAVE_LIB@
+IMAGEJ_SOURCE_PATH = @IMAGEJ_SOURCE_PATH@
INSTOBJEXT = @INSTOBJEXT@
INTLLIBS = @INTLLIBS@
+JAVA_DEV_KIT_PATH = @JAVA_DEV_KIT_PATH@
LIB = @LIB@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
Modified: pkg/hocr/trunk/src/consts.h
==============================================================================
--- pkg/hocr/trunk/src/consts.h (original)
+++ pkg/hocr/trunk/src/consts.h Sun Jan 15 21:21:02 2006
@@ -51,6 +51,9 @@
#define NORMAL_FONT_WIDTH 20
#define NORMAL_FONT_HIGHT 30
+#define MIN_FONT_WEIGHT 4
+#define MAX_FONT_WEIGHT 1200
+
#define MAX_LINE_HIGHT 50
#define MIN_LINE_HIGHT 20
Modified: pkg/hocr/trunk/src/font_layout.c
==============================================================================
--- pkg/hocr/trunk/src/font_layout.c (original)
+++ pkg/hocr/trunk/src/font_layout.c Sun Jan 15 21:21:02 2006
@@ -199,28 +199,30 @@
}
int
-find_font_baseline_eq (hocr_box line, hocr_box * fonts,
- hocr_line_eq * base_line, hocr_line_eq * top_line,
- int avg_font_hight, int num_of_fonts)
+find_font_lines_eq_for_fonts (hocr_box line, hocr_box * fonts,
+ double *top_a, double *top_b, double *base_a,
+ double *base_b,
+ int avg_font_hight, int start_at_font,
+ int end_at_font)
{
int i;
- int start_counter, end_counter;
+ int counter, start_counter, end_counter;
int x_start, x_end;
int y_start_down, y_end_down;
int y_start_up, y_end_up;
int font_hight;
-
- /* skip first two letters, they may be line numbering */
- int start_at = (num_of_fonts > NUM_OF_FONTS_TO_AVG * 4) ? 2 : 0;
+ int num_of_fonts = end_at_font - start_at_font;
/* if not enogh fonts then just return the line */
if (num_of_fonts < NUM_OF_FONTS_TO_AVG)
{
/* top line is more aqurate in most hebrew textst */
- base_line->a = 0;
- base_line->b = line.y1 + avg_font_hight + 1;
- top_line->a = 0;
- top_line->b = line.y1;
+ *base_a = 0;
+ *base_b =
+ (fonts[start_at_font].y1 + fonts[end_at_font].y1) / 2 +
+ avg_font_hight + 1;
+ *top_a = 0;
+ *top_b = (fonts[start_at_font].y1 + fonts[end_at_font].y1) / 2;
return 1;
}
@@ -235,14 +237,15 @@
start_counter = 0;
end_counter = 0;
+
/* skip first two letters, they may be line numbering */
- i = start_at;
- while (i < num_of_fonts)
+ i = start_at_font;
+ while (i <= end_at_font)
{
if (fonts[i].hight <
- ((1000 + 1.7 * FONT_ASSEND) * avg_font_hight / 1000)
+ ((1000 + 1.5 * FONT_ASSEND) * avg_font_hight / 1000)
&& fonts[i].hight >
- ((1000 - 1.5 * FONT_ASSEND) * avg_font_hight / 1000))
+ ((1000 - 1.7 * FONT_ASSEND) * avg_font_hight / 1000))
{
/* take only first NUM_OF_FONTS_TO_AVG to avg */
if (start_counter < NUM_OF_FONTS_TO_AVG)
@@ -258,14 +261,14 @@
}
/* skip first two letters, they may be line numbering */
- i = num_of_fonts - start_at;
- while (i > 0)
+ i = end_at_font;
+ while (i >= start_at_font)
{
i--;
if (fonts[i].hight <
- ((1000 + 1.7 * FONT_ASSEND) * avg_font_hight / 1000)
+ ((1000 + 1.5 * FONT_ASSEND) * avg_font_hight / 1000)
&& fonts[i].hight >
- ((1000 - 1.5 * FONT_ASSEND) * avg_font_hight / 1000))
+ ((1000 - 1.7 * FONT_ASSEND) * avg_font_hight / 1000))
{
/* take only last NUM_OF_FONTS_TO_AVG to avg */
if (end_counter < NUM_OF_FONTS_TO_AVG)
@@ -283,10 +286,12 @@
if (start_counter == 0 || end_counter == 0)
{
/* top line is more aqurate in most hebrew textst */
- base_line->a = 0;
- base_line->b = line.y1 + avg_font_hight + 1;
- top_line->a = 0;
- top_line->b = line.y1;
+ *base_a = 0;
+ *base_b =
+ (fonts[start_at_font].y1 + fonts[end_at_font].y1) / 2 +
+ avg_font_hight + 1;
+ *top_a = 0;
+ *top_b = (fonts[start_at_font].y1 + fonts[end_at_font].y1) / 2;
return 1;
}
@@ -303,19 +308,163 @@
if ((x_end - x_start) == 0)
{
/* top line is more aqurate in most hebrew textst */
- base_line->a = 0;
- base_line->b = line.y1 + font_hight + 1;
- top_line->a = 0;
- top_line->b = line.y1;
+ *base_a = 0;
+ *base_b =
+ (fonts[start_at_font].y1 + fonts[end_at_font].y1) / 2 +
+ font_hight + 1;
+ *top_a = 0;
+ *top_b = (fonts[start_at_font].y1 + fonts[end_at_font].y1) / 2;
return 1;
}
/* make line equation (x_end - x_start) is not zero */
- top_line->a = (double) (y_end_up - y_start_up) / (double) (x_end - x_start);
- base_line->a = (double) (y_end_down - y_start_down) / (double) (x_end - x_start);
-
- top_line->b = y_start_up - top_line->a * x_start;
- base_line->b = y_start_down - base_line->a * x_start + 1;
+ *top_a = (double) (y_end_up - y_start_up) / (double) (x_end - x_start);
+ *base_a =
+ (double) (y_end_down - y_start_down) / (double) (x_end -
+ x_start);
+
+ *top_b = y_start_up - *top_a * x_start;
+ *base_b = y_start_down - *base_a * x_start + 1;
+
+ return 0;
+}
+
+int
+find_font_baseline_eq (hocr_box line, hocr_box * fonts,
+ hocr_line_eq * base_line, hocr_line_eq * top_line,
+ int avg_font_hight, int num_of_fonts)
+{
+ int i;
+ double top_a, top_b, base_a, base_b;
+ int counter;
+
+ /* get avg font hight for this line */
+ i = 0;
+ counter = 0;
+ while (i < num_of_fonts)
+ {
+ if (fonts[i].hight <
+ ((1000 + 1.5 * FONT_ASSEND) * avg_font_hight / 1000)
+ && fonts[i].hight >
+ ((1000 - 1.7 * FONT_ASSEND) * avg_font_hight / 1000))
+ {
+ counter++;
+ }
+ i++;
+ }
+
+ /* if less then NUM_OF_FONTS_TO_AVG * 2 make one line */
+ //if (counter < 2 * NUM_OF_FONTS_TO_AVG)
+ {
+ find_font_lines_eq_for_fonts (line, fonts,
+ &top_a, &top_b, &base_a,
+ &base_b,
+ avg_font_hight, 0,
+ num_of_fonts - 1);
+
+ top_line->x1 = line.x2;
+ base_line->x1 = top_line->x1;
+ base_line->a1 = base_a;
+ base_line->b1 = base_b;
+ top_line->a1 = top_a;
+ top_line->b1 = top_b;
+
+ return 1;
+ }
+
+ /* if more them NUM_OF_FONTS_TO_AVG * 2 and less them
+ * NUM_OF_FONTS_TO_AVG * 4 make 2 lines */
+ if (counter >= 2 * NUM_OF_FONTS_TO_AVG &&
+ counter < 4 * NUM_OF_FONTS_TO_AVG)
+ {
+ find_font_lines_eq_for_fonts (line, fonts,
+ &top_a, &top_b, &base_a,
+ &base_b,
+ avg_font_hight, 0,
+ num_of_fonts / 2);
+
+ top_line->x1 = fonts[num_of_fonts / 2].x2;
+ base_line->x1 = top_line->x1;
+ base_line->a1 = base_a;
+ base_line->b1 = base_b;
+ top_line->a1 = top_a;
+ top_line->b1 = top_b;
+
+ find_font_lines_eq_for_fonts (line, fonts,
+ &top_a, &top_b, &base_a,
+ &base_b,
+ avg_font_hight, num_of_fonts / 2,
+ num_of_fonts - 1);
+
+ top_line->x2 = line.x2;
+ base_line->x2 = top_line->x2;
+ base_line->a2 = base_a;
+ base_line->b2 = base_b;
+ top_line->a2 = top_a;
+ top_line->b2 = top_b;
+
+ return 1;
+ }
+
+ /* if more them NUM_OF_FONTS_TO_AVG * 4 make 4 lines */
+ if (counter >= 4 * NUM_OF_FONTS_TO_AVG)
+ {
+ find_font_lines_eq_for_fonts (line, fonts,
+ &top_a, &top_b, &base_a,
+ &base_b,
+ avg_font_hight, 0,
+ num_of_fonts / 4);
+
+ top_line->x1 = fonts[num_of_fonts / 4].x2;
+ base_line->x1 = top_line->x1;
+ base_line->a1 = base_a;
+ base_line->b1 = base_b;
+ top_line->a1 = top_a;
+ top_line->b1 = top_b;
+
+ find_font_lines_eq_for_fonts (line, fonts,
+ &top_a, &top_b, &base_a,
+ &base_b,
+ avg_font_hight, num_of_fonts / 4,
+ 2 * num_of_fonts / 4);
+
+ top_line->x2 = fonts[2 * num_of_fonts / 4].x2;
+ base_line->x2 = top_line->x2;
+ base_line->a2 = base_a;
+ base_line->b2 = base_b;
+ top_line->a2 = top_a;
+ top_line->b2 = top_b;
+
+ find_font_lines_eq_for_fonts (line, fonts,
+ &top_a, &top_b, &base_a,
+ &base_b,
+ avg_font_hight,
+ 2 * num_of_fonts / 4,
+ 3 * num_of_fonts / 4);
+
+ top_line->x3 = fonts[3 * num_of_fonts / 4].x2;
+ base_line->x3 = top_line->x3;
+ base_line->a3 = base_a;
+ base_line->b3 = base_b;
+ top_line->a3 = top_a;
+ top_line->b3 = top_b;
+
+ find_font_lines_eq_for_fonts (line, fonts,
+ &top_a, &top_b, &base_a,
+ &base_b,
+ avg_font_hight,
+ 3 * num_of_fonts / 4,
+ num_of_fonts - 1);
+
+ top_line->x4 = line.x2;
+ base_line->x4 = top_line->x4;
+ base_line->a4 = base_a;
+ base_line->b4 = base_b;
+ top_line->a4 = top_a;
+ top_line->b4 = top_b;
+
+ return 1;
+ }
return 0;
}
Modified: pkg/hocr/trunk/src/font_recognition.c
==============================================================================
--- pkg/hocr/trunk/src/font_recognition.c (original)
+++ pkg/hocr/trunk/src/font_recognition.c Sun Jan 15 21:21:02 2006
@@ -2585,7 +2585,7 @@
font.y2 = low_line_y;
font.hight = font.y2 - font.y1;
/* recalc font for the object inside line */
- obj = hocr_pixbuf_get_objects_in_box (pix, font, object_array);
+ obj = hocr_pixbuf_get_objects_in_box (pix, font, object_array, MAX_OBJECTS_IN_FONT);
font.x1 = pix->objects[obj].x1;
font.x2 = pix->objects[obj].x2;
font.y1 = pix->objects[obj].y1;
@@ -2603,11 +2603,11 @@
box.hight = font.y2 - font.y1;
box.width = font.x2 - font.x1;
/* count objects in font */
- obj = hocr_pixbuf_get_objects_in_box (pix, font, object_array);
- number_of_object_in_font = count_object_array (object_array);
+ obj = hocr_pixbuf_get_objects_in_box (pix, font, object_array, MAX_OBJECTS_IN_FONT);
+ number_of_object_in_font = count_object_array (object_array, MAX_OBJECTS_IN_FONT);
/* count objects in box */
- box_obj = hocr_pixbuf_get_objects_in_box (pix, box, box_object_array);
- number_of_object_in_box = count_object_array (box_object_array);
+ box_obj = hocr_pixbuf_get_objects_in_box (pix, box, box_object_array, MAX_OBJECTS_IN_FONT);
+ number_of_object_in_box = count_object_array (box_object_array, MAX_OBJECTS_IN_FONT);
/* get font proportions */
short_font = font.hight < (0.8 * (double) avg_font_hight);
tall_font = font.hight > (1.2 * (double) avg_font_hight);
@@ -3370,9 +3370,9 @@
under_font_object =
hocr_pixbuf_get_objects_inside_box (pix,
under_font_box,
- under_font_object_array);
+ under_font_object_array, MAX_OBJECTS_IN_FONT);
number_of_object_under_font =
- count_object_array (under_font_object_array);
+ count_object_array (under_font_object_array, MAX_OBJECTS_IN_FONT);
/* one sign under font can be kamatz patach hirik */
if (!found_nikud && number_of_object_under_font == 1)
@@ -3500,9 +3500,9 @@
over_font_object =
hocr_pixbuf_get_objects_inside_box (pix,
over_font_box,
- over_font_object_array);
+ over_font_object_array, MAX_OBJECTS_IN_FONT);
number_of_object_over_font =
- count_object_array (over_font_object_array);
+ count_object_array (over_font_object_array, MAX_OBJECTS_IN_FONT);
/* one sign over font can be shin sin or holam */
if (number_of_object_over_font == 1)
Modified: pkg/hocr/trunk/src/hocr.c
==============================================================================
--- pkg/hocr/trunk/src/hocr.c (original)
+++ pkg/hocr/trunk/src/hocr.c Sun Jan 15 21:21:02 2006
@@ -82,7 +82,8 @@
if (only_main_object)
{
- obj = hocr_pixbuf_get_objects_in_box (pix, rect, object_array);
+ obj = hocr_pixbuf_get_objects_in_box (pix, rect, object_array,
+ MAX_OBJECTS_IN_FONT);
}
for (y = rect.y1 + 1; y <= (rect.y2 - 1); y++)
@@ -168,7 +169,7 @@
int tabs = 0;
int indent = 0;
int font_number = 0;
-
+
/* init the progress indicators */
pix->progress = 0;
pix->progress_phase = 0;
@@ -199,6 +200,9 @@
pix->progress_phase = 1;
hocr_pixbuf_create_object_map (pix);
+ /* clean picture from small object arteffacts */
+ hocr_pixbuf_clean (pix);
+
/* get columns for this page */
pix->progress_phase = 2;
fill_columns_array (pix, columns, &num_of_columns_in_page, MAX_COLUMNS);
@@ -344,12 +348,6 @@
&(line_eqs[c][i][1]),
avg_font_hight_in_page,
num_of_fonts[c][i]);
- /* if line is very not horizontal return error */
- if ((line_eqs[c][i][0].a *
- line_eqs[c][i][0].a) > (1.0 / 1000.0))
- {
- num_of_fonts[c][i] = 0;
- }
}
}
@@ -371,7 +369,7 @@
lines[c * MAX_LINES +
i].x1,
lines[c * MAX_LINES +
- i].x2, 2, 0);
+ i].x2, 1, 100);
color_hocr_line_eq (pix, &(line_eqs[c][i][1]),
lines[c * MAX_LINES +
i].x1,
@@ -401,8 +399,7 @@
i * MAX_FONTS_IN_LINE +
j].hight >
(3.5 *
- (double)
- avg_font_hight_in_page))
+ (double) avg_font_hight_in_page))
continue;
color_hocr_box (pix,
fonts[c * MAX_LINES *
@@ -465,7 +462,8 @@
for (j = 0; j < num_of_fonts[c][i]; j++)
{
/* progress the progress indicator */
- /* start at 128 because 128 is the end of object count */
+ /* start at 128 because 128 is the end
+ * of object count */
pix->progress =
128 +
((double) font_number /
@@ -546,8 +544,7 @@
i * MAX_FONTS_IN_LINE +
j].hight >
(3.5 *
- (double)
- avg_font_hight_in_page))
+ (double) avg_font_hight_in_page))
{
/* check for end of word */
if (end_of_word)
Modified: pkg/hocr/trunk/src/hocr_object.c
==============================================================================
--- pkg/hocr/trunk/src/hocr_object.c (original)
+++ pkg/hocr/trunk/src/hocr_object.c Sun Jan 15 21:21:02 2006
@@ -31,11 +31,11 @@
#include "hocr_object.h"
int
-clean_object_array (unsigned int *object_array)
+clean_object_array (unsigned int *object_array, int size)
{
int i;
- for (i = 0; i < MAX_OBJECTS_IN_FONT; i++)
+ for (i = 0; i < size; i++)
object_array[i] = 0;
return 0;
@@ -43,11 +43,11 @@
int
is_in_object_array (unsigned int obj,
- unsigned int *object_array)
+ unsigned int *object_array, int size)
{
int i;
- for (i = 0; i < MAX_OBJECTS_IN_FONT; i++)
+ for (i = 0; i < size; i++)
if (object_array[i] == obj)
return TRUE;
@@ -55,11 +55,11 @@
}
int
-count_object_array (unsigned int *object_array)
+count_object_array (unsigned int *object_array, int size)
{
int i;
- for (i = 0; i < MAX_OBJECTS_IN_FONT && object_array[i]; i++) ;
+ for (i = 0; i < size && object_array[i]; i++) ;
return i;
}
Modified: pkg/hocr/trunk/src/hocr_object.h
==============================================================================
--- pkg/hocr/trunk/src/hocr_object.h (original)
+++ pkg/hocr/trunk/src/hocr_object.h Sun Jan 15 21:21:02 2006
@@ -39,12 +39,12 @@
} hocr_object;
/* object helper functions */
-int clean_object_array (unsigned int *object_array);
+int clean_object_array (unsigned int *object_array, int size);
int
is_in_object_array (unsigned int obj,
- unsigned int *object_array);
+ unsigned int *object_array, int size);
-int count_object_array (unsigned int *object_array);
+int count_object_array (unsigned int *object_array, int size);
#endif
Modified: pkg/hocr/trunk/src/hocr_pixbuf.c
==============================================================================
--- pkg/hocr/trunk/src/hocr_pixbuf.c (original)
+++ pkg/hocr/trunk/src/hocr_pixbuf.c Sun Jan 15 21:21:02 2006
@@ -38,7 +38,14 @@
int
hocr_line_eq_get_y (hocr_line_eq line, int x)
{
- return (int) (line.a * (double) x + line.b);
+ if (x < line.x1)
+ return (int) (line.a1 * (double) x + line.b1);
+ else if (x < line.x2)
+ return (int) (line.a2 * (double) x + line.b2);
+ else if (x < line.x3)
+ return (int) (line.a3 * (double) x + line.b3);
+
+ return (int) (line.a4 * (double) x + line.b4);
}
/*
@@ -239,27 +246,53 @@
int gray_scale = FALSE;
int dippnes = 1;
- /* open file */
- file = fopen (filename, "r");
- if (!file)
- return NULL;
+ /* if no input file name use stdin for input */
+ if (!filename || filename[0] == '\0')
+ {
+ file = stdin;
+ }
+ else
+ {
+ /* open file */
+ file = fopen (filename, "r");
+ if (!file)
+ return NULL;
+ }
/* allocate memory for pixbuf */
new_pixbuf = (hocr_pixbuf *) malloc (sizeof (hocr_pixbuf));
if (!new_pixbuf)
+ {
+ if (file)
+ {
+ fclose (file);
+ }
return NULL;
+ }
/* read magic number "P4" for pbm file */
char_read = hocr_pbm_getc (file);
if (char_read != 'P')
+ {
+ if (file)
+ {
+ fclose (file);
+ }
return NULL;
+ }
char_read = hocr_pbm_getc (file);
if (char_read == '4')
gray_scale = FALSE;
else if (char_read == '5')
gray_scale = TRUE;
else
+ {
+ if (file)
+ {
+ fclose (file);
+ }
return NULL;
+ }
/* read header */
new_pixbuf->n_channels = 3;
@@ -277,13 +310,25 @@
if (gray_scale)
dippnes = hocr_pbm_getint (file);
if (dippnes > 255)
+ {
+ if (file)
+ {
+ fclose (file);
+ }
return NULL;
+ }
/* allocate memory for data */
new_pixbuf->pixels =
malloc (new_pixbuf->height * new_pixbuf->rowstride);
if (!(new_pixbuf->pixels))
+ {
+ if (file)
+ {
+ fclose (file);
+ }
return NULL;
+ }
/* read data */
for (y = 0; y < new_pixbuf->height; y++)
@@ -300,10 +345,59 @@
}
}
+ /* if regular file - close it */
+ if (file)
+ {
+ fclose (file);
+ }
+
/* return the new pixbuf to user */
return new_pixbuf;
}
+/**
+ @brif writes hocr_pixbuf to ppm or pgm file
+
+ @param pixbuf hocr_pixbuf 8 or 24 bpp
+ @param filenme save as file name
+ @return 1=ok, 0=error
+ */
+int
+hocr_pixbuf_save_as_pnm (hocr_pixbuf * pixbuf, char *filename)
+{
+ FILE *fp;
+
+ fp = fopen (filename, "wb");
+
+ if (!fp)
+ return 0;
+
+ if (pixbuf->n_channels == 3)
+ {
+ /*
+ * write raw ppm
+ * ppm header: P6 <width> <height> <maxval>
+ */
+ fprintf (fp, "P6 %d %d 255\n", pixbuf->width, pixbuf->height);
+ }
+ else
+ {
+ /*
+ * write raw pgm (assume 8 bits per pixel - one channel)
+ * 1 bpp is not supported!!
+ * pgm header: P5 <width> <height> <maxval>
+ */
+ fprintf (fp, "P5 %d %d 255\n", pixbuf->width, pixbuf->height);
+ }
+
+ /* this might be a huge write... */
+ fwrite (pixbuf->pixels, 1, pixbuf->height * pixbuf->rowstride, fp);
+
+ fclose (fp);
+
+ return 1;
+}
+
hocr_pixbuf *
hocr_pixbuf_new (void)
{
@@ -600,10 +694,14 @@
pix->objects[i].y2 - pix->objects[i].y1;
pix->objects[i].width =
pix->objects[i].x2 - pix->objects[i].x1;
- if (pix->objects[i].weight < 6
+ if (pix->objects[i].weight < 4
|| pix->objects[i].hight < 1
|| pix->objects[i].width < 1)
pix->objects[i].name = 0;
+ if (pix->objects[i].weight > 1200
+ || pix->objects[i].hight > 100
+ || pix->objects[i].width > 100)
+ pix->objects[i].name = 0;
}
else
{
@@ -616,9 +714,111 @@
return 0;
}
+int
+hocr_pixbuf_clean (hocr_pixbuf * pix)
+{
+ int x, y;
+ unsigned int object, object1, object2, object3,
+ object4, object5, object6, object7, object8, object9;
+
+ /* make shure null object has zero weight */
+ pix->objects[0].weight = 0;
+
+ /* check all pixes and clean objects that are two large or too small */
+ for (y = 1; y < pix->height; y++)
+ {
+ for (x = 1; x < pix->width; x++)
+ {
+
+ /* if pixel on but not in an object */
+ if (hocr_pixbuf_get_pixel (pix, x, y) && !pix->
+ objects[hocr_pixbuf_get_object (pix, x, y)].
+ name)
+ {
+ /* clean */
+ hocr_pixbuf_set_pixel (pix, x, y, 0, 0xffff);
+ hocr_pixbuf_set_pixel (pix, x, y, 1, 2500);
+ hocr_pixbuf_set_pixel (pix, x, y, 2, 1500);
+ }
+
+ /* smoth things */
+ /* get a 3x3 pixels */
+ object1 = hocr_pixbuf_get_pixel (pix, x, y);
+ object2 = hocr_pixbuf_get_pixel (pix, x, y + 1);
+ object3 = hocr_pixbuf_get_pixel (pix, x, y + 2);
+
+ object4 = hocr_pixbuf_get_pixel (pix, x + 1, y);
+ object5 = hocr_pixbuf_get_pixel (pix, x + 1, y + 1);
+ object6 = hocr_pixbuf_get_pixel (pix, x + 1, y + 2);
+
+ object7 = hocr_pixbuf_get_pixel (pix, x + 2, y);
+ object8 = hocr_pixbuf_get_pixel (pix, x + 2, y + 1);
+ object9 = hocr_pixbuf_get_pixel (pix, x + 2, y + 2);
+
+ /* add and remove dots */
+ if (!object5)
+ {
+
+ if ((object1 && object2 && object3
+ && object4 && object6) ||
+ (object7 && object8 && object9
+ && object4 && object6) ||
+ (object1 && object4 && object7
+ && object2 && object8) ||
+ (object3 && object6 && object9
+ && object2 && object8))
+ {
+ object = hocr_pixbuf_get_object (pix,
+ x + 1,
+ y);
+ if (!object)
+ object = hocr_pixbuf_get_object
+ (pix, x + 1, y + 2);
+
+ hocr_pixbuf_set_pixel (pix, x + 1,
+ y + 1, 0, 0);
+ hocr_pixbuf_set_pixel (pix, x + 1,
+ y + 1, 1, 0);
+ hocr_pixbuf_set_pixel (pix, x + 1,
+ y + 1, 2, 0);
+ hocr_pixbuf_set_object (pix, x + 1,
+ y + 1, object);
+ }
+ }
+ else
+ {
+ if ((!object1 && !object2 && !object3
+ && !object4 && !object6) ||
+ (!object7 && !object8 && !object9
+ && !object4 && !object6) ||
+ (!object1 && !object4 && !object7
+ && !object2 && !object8) ||
+ (!object3 && !object6 && !object9
+ && !object2 && !object8))
+ {
+ hocr_pixbuf_set_pixel (pix, x + 1,
+ y + 1, 0,
+ 0xffff);
+ hocr_pixbuf_set_pixel (pix, x + 1,
+ y + 1, 1,
+ 2500);
+ hocr_pixbuf_set_pixel (pix, x + 1,
+ y + 1, 2,
+ 1500);
+ hocr_pixbuf_set_object (pix, x + 1,
+ y + 1, 0);
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
unsigned int
hocr_pixbuf_get_objects_in_box (hocr_pixbuf *
- pix, hocr_box box, unsigned int *object_array)
+ pix, hocr_box box, unsigned int *object_array,
+ int size)
{
int x, y;
int i = 0;
@@ -627,15 +827,14 @@
/* make sure none object have zero weight */
pix->objects[0].weight = 0;
- clean_object_array (object_array);
+ clean_object_array (object_array, size);
for (x = box.x1; x < box.x2; x++)
for (y = box.y1; y < box.y2; y++)
{
if ((object =
hocr_pixbuf_get_object (pix, x, y)) &&
!(is_in_object_array
- (object, object_array))
- && (i < MAX_OBJECTS_IN_FONT))
+ (object, object_array, size)) && (i < size))
{
/* add object to object array */
object_array[i] = object;
@@ -653,7 +852,8 @@
unsigned int
hocr_pixbuf_get_objects_inside_box (hocr_pixbuf
* pix,
- hocr_box box, unsigned int *object_array)
+ hocr_box box, unsigned int *object_array,
+ int size)
{
int x, y;
int i = 0;
@@ -662,7 +862,7 @@
/* make sure none object have zero weight */
pix->objects[0].weight = 0;
- clean_object_array (object_array);
+ clean_object_array (object_array, size);
for (x = box.x1; x < box.x2; x++)
for (y = box.y1; y < box.y2; y++)
{
@@ -673,8 +873,7 @@
pix->objects[object].y1 >= box.y1 &&
pix->objects[object].y2 <= box.y2 &&
!(is_in_object_array
- (object, object_array))
- && (i < MAX_OBJECTS_IN_FONT))
+ (object, object_array, size)) && (i < size))
{
/* add object to object array */
object_array[i] = object;
Modified: pkg/hocr/trunk/src/hocr_pixbuf.h
==============================================================================
--- pkg/hocr/trunk/src/hocr_pixbuf.h (original)
+++ pkg/hocr/trunk/src/hocr_pixbuf.h Sun Jan 15 21:21:02 2006
@@ -36,11 +36,23 @@
/** line equation structore used by hocr
a and b in the equation are Y = a X + b
+ y = a1 x + b1 | x < X1
+ y = a2 x + b2 | x < X2 ...
*/
typedef struct
{
- double a;
- double b;
+ int x1;
+ double a1;
+ double b1;
+ int x2;
+ double a2;
+ double b2;
+ int x3;
+ double a3;
+ double b3;
+ int x4;
+ double a4;
+ double b4;
} hocr_line_eq;
typedef struct
@@ -107,11 +119,13 @@
@param pix pointer to hocr_pixbuf struct.
@param box pointer to hocr_pixbuf struct.
@param object_array an array of object to fill.
+ @param size of object_array
@return the most havy object in the box.
*/
unsigned int
hocr_pixbuf_get_objects_in_box (hocr_pixbuf * pix, hocr_box box,
- unsigned int *object_array);
+ unsigned int *object_array,
+ int size);
/**
@brief get objects inside a box
@@ -119,12 +133,14 @@
@param pix pointer to hocr_pixbuf struct.
@param box pointer to hocr_pixbuf struct.
@param object_array an array of object to fill.
+ @param size of object_array
@return the most havy object in the box.
*/
unsigned int
hocr_pixbuf_get_objects_inside_box (hocr_pixbuf * pix,
hocr_box box,
- unsigned int *object_array);
+ unsigned int *object_array,
+ int size);
/**
@brief get number of channels
@@ -232,6 +248,15 @@
hocr_pixbuf *hocr_pixbuf_new_from_file (const char *filename);
/**
+ @brif writes hocr_pixbuf to ppm or pgm file
+
+ @param pixbuf hocr_pixbuf 8 or 24 bpp
+ @param filenme save as file name
+ @return 1=ok, 0=error
+ */
+ int hocr_pixbuf_save_as_pnm (hocr_pixbuf * pixbuf, char *filename);
+
+/**
@brief creats a new empty hocr_pixbuf struct
@return pointer to a newly allocate hocr_pixbuf, or null if can not open file.
@@ -253,6 +278,13 @@
*/
int hocr_pixbuf_create_object_map (hocr_pixbuf * pix);
+/**
+ @brief clean artaffects from pixbuf
+
+ @ param pix pointer to hocr_pixbuf struct.
+ */
+ int hocr_pixbuf_clean (hocr_pixbuf * pix);
+
#ifdef __cplusplus
}
#endif
Modified: pkg/hocr/trunk/src/hocr_textbuffer.c
==============================================================================
--- pkg/hocr/trunk/src/hocr_textbuffer.c (original)
+++ pkg/hocr/trunk/src/hocr_textbuffer.c Sun Jan 15 21:21:02 2006
@@ -67,6 +67,9 @@
int
hocr_text_buffer_unref (hocr_text_buffer * text_buffer)
{
+ if (text_buffer->text)
+ free (text_buffer->text);
+
if (text_buffer)
free (text_buffer);
Modified: pkg/hocr/trunk/src/hocrpp.h
==============================================================================
--- pkg/hocr/trunk/src/hocrpp.h (original)
+++ pkg/hocr/trunk/src/hocrpp.h Sun Jan 15 21:21:02 2006
@@ -30,6 +30,8 @@
#include <hocr_textbuffer.h>
#include <hocr_pixbuf.h>
+#include <string.h>
+
/**
@brief the libhocr namespace.
*/
@@ -303,8 +305,7 @@
if (!(h->pixels))
return NULL;
- for (i = 0; i < length; i++)
- (h->pixels)[i] = ((unsigned char *) p)[i];
+ memcpy (h->pixels, p, length);
return (char *) (h->pixels);
}
@@ -393,7 +394,6 @@
hocr_pixbuf * h;
hocr_text_buffer *t;
- int opt_f;
int opt_d;
int opt_n;
int opt_s;
Modified: pkg/hocr/trunk/tests/Makefile.in
==============================================================================
--- pkg/hocr/trunk/tests/Makefile.in (original)
+++ pkg/hocr/trunk/tests/Makefile.in Sun Jan 15 21:21:02 2006
@@ -82,8 +82,10 @@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
HAVE_LIB = @HAVE_LIB@
+IMAGEJ_SOURCE_PATH = @IMAGEJ_SOURCE_PATH@
INSTOBJEXT = @INSTOBJEXT@
INTLLIBS = @INTLLIBS@
+JAVA_DEV_KIT_PATH = @JAVA_DEV_KIT_PATH@
LIB = @LIB@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
More information about the Debian-hebrew-package
mailing list