
* src/Makefile.am: Add toolchain subdir. * src/toolchain/Makefile.am, * src/toolchain/nepomuk/Makefile.am, * src/toolchain/nepomuk/text_extraction.cc: New. --- scribo/ChangeLog | 10 +++++ scribo/src/Makefile.am | 3 +- .../{tests/primitive => src/toolchain}/Makefile.am | 6 +-- .../{tests => src}/toolchain/nepomuk/Makefile.am | 35 +++++++++---------- .../toolchain/nepomuk/text_extraction.cc | 36 ++++++++++++++------ 5 files changed, 56 insertions(+), 34 deletions(-) copy scribo/{tests/primitive => src/toolchain}/Makefile.am (91%) copy scribo/{tests => src}/toolchain/nepomuk/Makefile.am (65%) copy scribo/{tests => src}/toolchain/nepomuk/text_extraction.cc (75%) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 807bdc8..3b094e0 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,15 @@ 2010-10-25 Guillaume Lazzara <z@lrde.epita.fr> + Add a new toolchain. + + * src/Makefile.am: Add toolchain subdir. + + * src/toolchain/Makefile.am, + * src/toolchain/nepomuk/Makefile.am, + * src/toolchain/nepomuk/text_extraction.cc: New. + +2010-10-25 Guillaume Lazzara <z@lrde.epita.fr> + * scribo/core/line_info.hh: Fix line statistics. 2010-10-25 Guillaume Lazzara <z@lrde.epita.fr> diff --git a/scribo/src/Makefile.am b/scribo/src/Makefile.am index 52df66d..d3f686b 100644 --- a/scribo/src/Makefile.am +++ b/scribo/src/Makefile.am @@ -26,7 +26,8 @@ SUBDIRS = \ misc \ postprocessing \ preprocessing \ - text + text \ + toolchain # Disabled for the moment: # table diff --git a/scribo/tests/primitive/Makefile.am b/scribo/src/toolchain/Makefile.am similarity index 91% copy from scribo/tests/primitive/Makefile.am copy to scribo/src/toolchain/Makefile.am index 82c773a..36cfff4 100644 --- a/scribo/tests/primitive/Makefile.am +++ b/scribo/src/toolchain/Makefile.am @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with Olena. If not, see <http://www.gnu.org/licenses/>. -include $(top_srcdir)/scribo/tests/tests.mk - -SUBDIRS = \ - link +include $(top_srcdir)/scribo/scribo.mk +SUBDIRS = nepomuk \ No newline at end of file diff --git a/scribo/tests/toolchain/nepomuk/Makefile.am b/scribo/src/toolchain/nepomuk/Makefile.am similarity index 65% copy from scribo/tests/toolchain/nepomuk/Makefile.am copy to scribo/src/toolchain/nepomuk/Makefile.am index 4bce3bd..07c2c33 100644 --- a/scribo/tests/toolchain/nepomuk/Makefile.am +++ b/scribo/src/toolchain/nepomuk/Makefile.am @@ -13,33 +13,32 @@ # # You should have received a copy of the GNU General Public License # along with Olena. If not, see <http://www.gnu.org/licenses/>. -# - -## Process this file through Automake to create Makefile.in. - -include $(top_srcdir)/scribo/tests/tests.mk - -check_PROGRAMS = +include $(top_srcdir)/scribo/scribo.mk +bin_PROGRAMS = if HAVE_QT +if HAVE_MAGICKXX if HAVE_TESSERACT -check_PROGRAMS += text_extraction +bin_PROGRAMS += \ +text_extraction + text_extraction_SOURCES = text_extraction.cc -text_extraction_CXXFLAGS = $(QT_CXXFLAGS) $(AM_CXXFLAGS) -text_extraction_CPPFLAGS = $(QT_CPPFLAGS) $(AM_CPPFLAGS) \ +text_extraction_CPPFLAGS = $(AM_CPPFLAGS) \ + $(MAGICKXX_CPPFLAGS) \ $(TESSERACT_CPPFLAGS) \ - $(TIFF_CPPFLAGS) -text_extraction_LDFLAGS = $(QT_LDFLAGS) $(LDFLAGS) \ + $(TIFF_CPPFLAGS) \ + $(QT_CPPFLAGS) +text_extraction_LDFLAGS = $(AM_LDFLAGS) \ + $(MAGICKXX_LDFLAGS) \ $(TESSERACT_LDFLAGS) \ $(TIFF_LDFLAGS) \ - -lpthread -text_extraction_LDADD = $(QT_LIBS) $(LDADD) + $(QT_LDFLAGS) \ + $(QT_LIBS) \ + -lpthread endif HAVE_TESSERACT -endif HAVE_QT - - -TESTS = $(check_PROGRAMS) +endif HAVE_MAGICKXX +endif HAVE_QT \ No newline at end of file diff --git a/scribo/tests/toolchain/nepomuk/text_extraction.cc b/scribo/src/toolchain/nepomuk/text_extraction.cc similarity index 75% copy from scribo/tests/toolchain/nepomuk/text_extraction.cc copy to scribo/src/toolchain/nepomuk/text_extraction.cc index 027ad99..e5e2de4 100644 --- a/scribo/tests/toolchain/nepomuk/text_extraction.cc +++ b/scribo/src/toolchain/nepomuk/text_extraction.cc @@ -23,22 +23,36 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -/// \file -/// -/// Test of scribo::toolchain::nepomuk::text_extraction +#include <libgen.h> +#include <iostream> +#include <QtCore/QDebug> -#include <QtGui/QImage> -#include <QtCore> +#include <scribo/debug/usage.hh> #include <scribo/toolchain/nepomuk/text_extraction.hh> -#include "tests/data.hh" -int main() +const char *args_desc[][2] = { - QImage ima(SCRIBO_IMG_DIR "/wildly.pbm"); + { "input.*", "An image." }, + {0, 0} +}; + + + + +int main(int argc, char* argv[]) +{ + if (argc != 2) + return scribo::debug::usage(argv, + "Extract text in a document.\n\n" + "Common usage: ./text_extraction input.*", + "<image>", + args_desc); + + + QImage ima(argv[1]); QSet<QString> words = scribo::toolchain::nepomuk::text_extraction(ima); - mln_assertion(words.size() == 1); - mln_assertion(words.contains("Wildly")); - return 0; + foreach(QString w, words) + qDebug() << w; } -- 1.5.6.5