Skip to content

Commit

Permalink
Add OCR identification.
Browse files Browse the repository at this point in the history
Show Tesseract OCR info in the console when starting Audiveris.
  • Loading branch information
maximumspatium committed Apr 16, 2017
1 parent 2610a7c commit 1ee696c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/org/audiveris/omr/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.audiveris.omr.constant.ConstantSet;
import org.audiveris.omr.log.LogUtil;
import org.audiveris.omr.sheet.BookManager;
import org.audiveris.omr.text.tesseract.TesseractOCR;
import org.audiveris.omr.ui.MainGui;
import org.audiveris.omr.ui.symbol.MusicFont;
import org.audiveris.omr.util.ClassUtil;
Expand Down Expand Up @@ -378,13 +379,14 @@ private static void showEnvironment ()
if (constants.showEnvironment.isSet()) {
logger.info(
"Environment:\n" + "- Audiveris: {}\n" + "- OS: {}\n"
+ "- Architecture: {}\n" + "- Java VM: {}",
+ "- Architecture: {}\n" + "- Java VM: {}\n" + "- OCR Engine: {}",
WellKnowns.TOOL_REF + ":" + WellKnowns.TOOL_BUILD,
System.getProperty("os.name") + " " + System.getProperty("os.version"),
System.getProperty("os.arch"),
System.getProperty("java.vm.name") + " (build "
+ System.getProperty("java.vm.version") + ", " + System.getProperty("java.vm.info")
+ ")");
+ ")",
TesseractOCR.getInstance().identify());
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/main/org/audiveris/omr/text/OCR.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ enum LayoutMode
*/
boolean isAvailable ();

/**
* Return OCR engine identification.
*
* @return string containing the name and the version of the OCR engine.
*/
String identify();

/**
* Launch the recognition of the provided image, whose language is specified.
*
Expand Down
13 changes: 13 additions & 0 deletions src/main/org/audiveris/omr/text/tesseract/TesseractOCR.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ public boolean isAvailable ()
return constants.useOCR.isSet();
}

//----------//
// identify //
//----------//
@Override
public String identify()
{
if (isAvailable()) {
return "Tesseract OCR, version " + TessBaseAPI.Version().getString();
} else {
return "OCR engine not available";
}
}

//-----------//
// recognize //
//-----------//
Expand Down

0 comments on commit 1ee696c

Please sign in to comment.