Giter VIP home page Giter VIP logo

larex's Introduction

larex

Build verification with Maven

LAREX is a semi-automatic open-source tool for layout analysis on early printed books. It uses a rule based connected components approach which is very fast, easily comprehensible for the user and allows an intuitive manual correction if necessary. The PAGE XML format is used to support integration into existing OCR workflows. Evaluations showed that LAREX provides an efficient and flexible way to segment pages of early printed books.

Please feel free to visit the tool homepage. A short user manual is available here.

Table of Contents

Additional information about developing for LAREX see here

Installation

Docker

This guide uses Docker and allows a platform agnostic installation of LAREX

Production

Development

  • Configure development/build.sh, run cd development and sh build.sh

Linux

This guide uses Tomcat 8, Java 8 and Ubuntu (please adjust accordingly for your setup)

  • Install required packages: apt-get install tomcat8 maven openjdk-8-jdk
  • Clone Repository: git clone https://github.com/OCR4all/LAREX.git
  • Compile: mvn clean install -f LAREX/pom.xml.
  • Copy or link the created war file to Tomcat:
    • Copy cp LAREX/target/Larex.war /var/lib/tomcat8/webapps/Larex.war
    • Link: sudo ln -s $PWD/LAREX/target/Larex.war /var/lib/tomcat8/webapps/Larex.war
  • Start Tomcat: systemctl start tomcat8
    • (Restart Tomcat via systemctl restart tomcat8)
    • (To start Tomcat automatically at system boot systemctl enable tomcat8)

Windows

This guide uses Eclipse to simplify the setup on Windows

  • Install Eclipse IDE for Enterprise Java Developers from the official website
  • Download Tomcat 8 or up from the official website
  • Create a Tomcat server in eclipse:
    • Open Window -> Show View -> Other... -> Server -> Servers
    • Click prompt to add a new server, select Apache -> Tomcat <version> Server -> Next-> set your Tomcat installation directory -> Finish.
  • Clone Repository:
    • File -> Import -> Git -> Projects from Git -> Clone URI -> Set URI: https://github.com/OCR4all/LAREX.git -> [✓] master -> Next > -> Next > -> Import as gernal project -> Finish
  • Set as Maven Project:
  • Import Project
    • Right click on Larex -> Configure -> Convert to Maven Project -> Finish
  • Update maven project (if not updated automatically)
    • Rightclick on Larex -> Maven -> Update Project... -> OK
  • Start Larex
    • Right click on Larex -> Run As -> Run on Server.

macOS

Note: LAREX is mainly developed on Linux so the macOS build introductions may be outdated from time to time. If this is the case, feel free to contact us This guide uses homebrew (please adjust accordingly for your setup).

  • Install Homebrew (see https://brew.sh/) and run brew update.
  • Install required packages:
    • brew cask install adoptopenjdk8
    • brew install tomcat git maven
  • (Verify Tomcat installation):
    • brew services list tomcat should be listed in the output of this command
  • Clone Repository:
    • git clone https://github.com/OCR4all/LAREX.git
  • Compile:
    • run mvn clean install -f LAREX/pom.xml.
  • Copy or link the created war file to Tomcat
    • Copy: cp LAREX/target/Larex.war /usr/local/Cellar/tomcat/[version]/libexec/webapps/Larex.war
    • Link: ln -s $PWD/LAREX/target/Larex.war /usr/local/Cellar/tomcat/[version]/libexec/webapps/Larex.war
  • Start Tomcat:
    • brew services start tomcat
    • (Restart Tomcat via brew services restart tomcat)

Usage

Access in browser

Go to localhost:8080/Larex.

Using your own images and books

You can add your own books by copying them to src/webapp/resources/books

(Or an alternative direction set in the config file. See section Configuration for more information).

Book directories must have the following structure:

bookDir/
├── <book_name>/ 
│    ├── <page_name>.png 
│    └── <page_name>.xml
└── <book2_name>/
     └── …

More information

Detailed information about the usage of LAREX can be found in the OCR4all getting started guides.

See sections and chapters about Segmentation, Ground Truth Correction and Post Correction.

Configuration

LAREX contains a configuration file (src/webapp/WEB-INF/larex.properties) with a few settings that can be set before running the application.

bookpath

The setting bookpath sets the file path of the books folder.

e.g. bookpath=/home/user/books (Linux)

e.g. bookpath=C:\Users\user\Documents\books (Windows)

LAREX will load the books from this folder.

[default /src/main/webapp/resources/books]

localsave

The setting localsave tells the application how to handle results locally when saved.

Please note:
To work properly in local mode it's required that the Page@imageFilename-attribute matches the actual filename (apart from the extension). This label will be used for local storage.

<mode>=[bookpath|savedir|none]

bookpath: save the result in the bookpath

savedir: save the result in a defined savedir

none: do not save the result locally [default]

e.g. localsave:bookpath

savedir

The setting savedir is needed if localsave mode is set to "savedir".

e.g. savedir=/home/user/save (Linux)

e.g. savedir=C:\Users\user\Documents\save (Windows)

websave

The setting websave tells the application how to handle results on the browser side when saved.

<value>=[true|false]

true: download the result after saving [default]

false: no action after saving

e.g. websave=true

modes

Set the accessible modes in the LAREX GUI <value>=[[segment][edit][lines][text]] A combination of the modes "segment", "edit", "lines" and "text" can be set as a space separated string. e.g. modes=segment lines

The order of those modes in the string also determines which mode is opened on startup, with the first in the list being opened as main mode. The mode "segment" can be replaced with "edit" in order to hide all auto segmentation features. ("edit" will be ignored if both are present)

[Default] modes=segment lines text

directrequest

This setting enables or disables the direct open feature.

<value>=[enable|disable]

This feature allows users to load a book from everywhere on the servers drive as well as to alter the options websave, localsave and savedir.

enable: enable direct request

disable: disable direct request [default]

e.g. directrequest=enable

This feature should be used with caution but is very useful when using LAREX in a workflow with other web applications. (e.g. in Docker)

The easiest direct request would be via a html form with the values bookpath, bookname, websave (optional), localsave (optional) and savedir (optional).

<form action="http://localhost:8080/Larex/direct" method="POST">
	bookpath: <input type="text" name="bookpath"/><br>
	bookname: <input type="text" name="bookname"/><br>
	websave: <input type="text" name="websave"/><br>
	localsave: <input type="text" name="localsave"/><br>
	savedir: <input type="text" name="savedir"/><br>
	modes: <input type="text" name="modes"/><br>
	<input type="submit"/>
</form>

OCR4all UI mode

This setting enables or disables OCR4all UI mode.

<value>=[enable|disable]

This setting allows displaying and/or hiding certain UI elements when LAREX is used in combination with OCR4all.

enable: enable OCR4all UI mode

disable: disable OCR4all UI mode [default]

e.g. ocr4all=enable

Citing LAREX

If you are using LAREX please cite:

Reul, C., Springmann, U., Puppe, F.: Larex: A semi-automatic open-source tool for layout analysis and region extraction on early printed books Proceedings of the 2nd International Conference on Digital Access to Textual Cultural Heritage (2017)

@inproceedings{reul2017larex,
  title={Larex: A semi-automatic open-source tool for layout analysis and region extraction on early printed books},
  author={Reul, Christian and Springmann, Uwe and Puppe, Frank},
  booktitle={Proceedings of the 2nd International Conference on Digital Access to Textual Cultural Heritage},
  pages={137--142},
  year={2017}
}

larex's People

Contributors

andbue avatar b-eyselein avatar chaddy314 avatar chreul avatar chwick avatar crater2150 avatar dependabot[bot] avatar hbaier-dev avatar kbulert avatar kolophonium0 avatar m3ssman avatar maxnth avatar nesbi avatar ooduor avatar witiko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

larex's Issues

Jump to page

It should be possible to quickly jump to a certain page. Since the numbering of the pages depends on the file names and might be inconsistent the best solution would probably be a extendable drop down menu showing the file names. This menu should also indicate which pages have already been segmented.

Add TIF support

The webapp currently only supports image types common to webapplications.
TIF is not supported.
This should be changed given the importance of the TIF format in digitization workflows.

Merge several selected segments

It should be possible to merge several selected segments:

  • Each segment should get connected to its closest neighbour.
  • After merging, the type dialogue should pop-up so a new type can be assigned right away. Alternatively, the initial type of the biggest single segment could be assigned.

Resize/expand and move polygons for regions and fixed segments

A user should be able to move and resize polygons for regions and fixed segments.
Such a operation currently requires the user to delete and recreate the polygon.

Current goals are to add options for:

  • moving polygons for regions and fixed segments
  • resizing/expanding rectangle polygons of regions
  • resizing/expanding polygons of fixed segments

A distinction between rectangle polygons and un-regular polygons has to be made.
It must be possible to scale/expand a rectangular polygon at his edges and corners while maintaining a rectangular shape.
Resizing the polygons of fixed segments could be a more complicated issue. Those polygons do not have to be rectangles and un-regular polygons should behave differently than rectangles.

Non-permanent ignore regions

While the RoI should always be permanent, ignore rectangles or polygons by default should only be valid for the current page. Optimally, the user should be able to choose between permanent and non-permanent.

Add reading order to the webview

The webapplication does currently not support creating or changing the reading order.
Files created by export to PageXML are lacking this order.

Resizing: catchment area

If a region/segment is very small, it is cumbersome to select its border.
There should be a minimum value for the catchment area while resizing.

Zoom cap and anti aliasing

I'm not sure if it is necessary to be able to zoom in to about 10,000,000%. A cap might be in order.
Furthermore, anti aliasing looks weird and should be turned off,

Segments opacity occasionally stuck on "selected"

Moving or scaling fixed segments will change the opacity of the segments body to "selected".
Reopening the page or segmenting will reset it to normal.

Edit: Same happens occasionally when working with the reading order.

Aborting to move or scale a segment can cause it to be highlighted, even if the cursor is no longer above the segment. Hovering over the segment again will solve this.

Saving final result

  • When saving the final result via "Export PageXML" (should be renamed to "Save Result" or something similar) the corresponding page should be marked by a symbol (just like when downloading the PageXML).
  • When returning to a page whose final result has been already saved, the final result should be displayed instead of the result that was produced by the automatic segmentation.
  • A keyboard shortcut would be nice.

Segment select Issues

  • It should be possible to deselect a single segment while keeping the rest of the selected segments (Ctrl + left click).
  • Selected segments should get deselected when the user clicks at a spot where no segments are located.
  • It should be possible to add several segements to a selection by holding down Ctrl and selecting the additional segments by drawing a rectangle.

Select several segments

When the user clicks somewhere on the page where no segments are located the already selected segments shouldn't get deselected if Ctrl is still pressed.

Add image segmentation modi

It should be possible to choose between different segmentation modi:

  • none (detected image contours are ignored)
  • contour only (the original image contour is used)
  • straight rect (a straight bounding rectangle is fitted around the detected contour)
  • rotated rect (a rotated ...)

Open type dropdown with one click

When right clicking on an inactive segment it should become active and the type dropdown should open right away.
Right now it sometimes requires two clicks (left click to activate, right click for dropdown). This seems to depend on the operating system as the problem never (?) occurs when running windows.

Keep active thumbnail centered

When selecting a new page the corresponding thumbnail should be centered vertically (if possible) so the user doesn't have to scroll all the time while working through the scans.

error when adding images at runtime

If a new images is added to a book diretory while LAREX is running and the book is open in the LAREX editor, an exception is thrown when clicking on the new image (or the last image of the book):
java.lang.IndexOutOfBoundsException: Index: 7, Size: 7
at java.util.LinkedList.checkElementIndex(LinkedList.java:555)
at java.util.LinkedList.get(LinkedList.java:476)
at com.web.model.Book.getPage(Book.java:46)
at com.web.facade.LarexFacade.segmentPages(LarexFacade.java:106)
at com.web.controller.ViewerController.segment(ViewerController.java:86)

multiple regions have the same color

Colors for the regions page_number, image, paragraph, marginal and ignore are set manually, the other regions are getting a computer generated color assigned.
This leads to different regions sharing a similar color.

Current goals are:

  • unique colors for every region by default (at least as unique as possible) (03b768e)
  • settings for the user to change a region's color (9bd2288)

Add and edit reading order

Add the functionality to add and edit a reading order for each page.

Current goals are to add options for:

  • auto generate a reading order top to bottom
  • edit the current reading order
  • hide reading order
  • creating a new reading order via mouse

Zooming while creating a polygon

It is possible to zoom while creating a polygon.
The polygon stays in relation to the screen instead of the page image.
It would be better if it stayed in relation to the page.

Hide segmentation

It should be possible to hide the current segmentation result (keyboard shortcut...) as it can be distracting when manually marking an image etc.
This setting should stay active until the user disables it (shortcut), runs the segmentation or switches to another page.

Add region of interest (RoI) modus

In order to exclude page periphery (if present) a RoI modus is required.
The user should be able to mark the interesting region of the page by drawing a rectangle. The remaining borders should then be marked as an ignore region.

show filename as tooltip

It would be helpful if a tooltip could show the filename of an image in the left bar of the viewer.

Move/Scale multiple objects at once

Scaling and moving region polygons or fixed segments is at the moment restricted to the object last selected.
Scaling and moving multiple objects should be implemented and tested.

Regions types in "create region"

  • Region types which are already in use shouldn't be displayed in the "create region" dialogue.
  • Region types should be displayed in alphabetical order.

Adding fixed segments without re-running the segmentation

It should be possible to add fixed segments without re-running the segmentation.
When the result is saved/exported fixed segments which have been added after the last segmentation run should be treated as final segments. Obviously, this could lead to overlapping segments but to deal with this lies within the responsibility of the user.

Add save/load settings functionality

It should be possible to save and load parameter and region settings for an individual book so they can be used again after closing the tool.

Shortcuts for saving

There should be shortcuts for saving (Ctrl+S) and Exporting (Ctrl+E) a segmentation result.

Traffic should be reduced

Opening a book currently loads all of its pages in full resolution from the server.
This can lead to unwanted and unneeded web traffic and should be avoided

Current goals are:

  • only loading page images by demand
  • using down scaled images for the page preview

Region maxOccurence

The maxOccurence region parameter seems to be buggy (and kinda useless) and should be temporarily disabled/removed.
It's misspelled anyways :-).

Visibility of the functions to move, scale and delete objects.

Moving, scaling and deleting an object can only be done by selecting the object and pressing the keys m, s or del respectively. The access to those functionalities is not obvious enough.

The following change to the context menu is proposed:
contextmenuchange

Creating a region object or fixed segment could still open the current context menu, while right clicking existing objects would open the enhanced context menu.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.