Giter Site home page Giter Site logo

queuecumber / doccreator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from doccreator/doccreator

0.0 1.0 0.0 293.54 MB

DIAR software for synthetic document image and groundtruth generation, with various degradation models for data augmentation

Home Page: http://doc-creator.labri.fr

License: GNU Lesser General Public License v3.0

CMake 3.98% Shell 0.65% C++ 94.88% C 0.13% QMake 0.04% GLSL 0.33%

doccreator's Introduction

# DocCreator

 DocCrator is an open source, cross-platform software allowing to generate synthetic document images and the accompanying groundtruth. Various degradation models can be applied on original document images to create virtually unlimited amounts of different images.

 Citation: if you use DocCreator in Reaserch work for publication, please cite:
 Journet, N.; Visani, M.; Mansencal, B.; Van-Cuong, K.; Billy, A. DocCreator: A New Software for Creating Synthetic Ground-Truthed Document Images. J. Imaging 2017, 3, 62. 
 http://www.mdpi.com/2313-433X/3/4/62


This program should compile under linux (with gcc & clang), Mac OS (with clang) and Microsoft Windows 10 (with Visual Studio 2017).
It has been tested on Fedora (19->28), Ubuntu (14.04->18.04), Mac OS (10.9->10.11), Windows 10.


Dependencies
============

The program uses the following libraries:
OpenCV (2.4.x or 3.x)
Qt 5

Tesseract is optional. If it is not found on the system, it will be compiled from (provided) sources. However, you will need to have network access during the configuration step to download tessdata, tesseract languages data.

CMake is used for compilation.


#Linux

On Ubuntu (14.04 and above), you can install the required binary packages with the following command:
sudo apt-get install libopencv-dev qtbase5-dev qtdeclarative5-dev libqt5xmlpatterns5-dev cmake
You may also have to set Qt5 as default with:
sudo apt-get install qt5-default
You can install tesseract with the following command:
sudo apt-get install tesseract-ocr tesseract-ocr-fra libtesseract-dev libleptonica-dev

On Fedora (21 or 22), you can install the required binary packages with the following command as root:
yum install opencv-devel qt5-qtbase-devel qt5-qtxmlpatterns-devel cmake 
On Fedora (23 and above), you can install the required binary packages with the following command as root:
dnf install opencv-devel qt5-qtbase-devel qt5-qtxmlpatterns-devel cmake gcc-c++
You can install tesseract with the following command as root:
dnf install tesseract tesseract-devel tesseract-langpack-fra leptonica leptonica-devel libpng-devel


To compile with clang on linux:
- you need to have libc++
  On Ubuntu, you can install libc++ with the following command:
  sudo apt-get install libc++-dev libc++abi-dev
  Warning: on Ubuntu 16.04, you may have to edit /usr/include/c++/v1/string
  cf https://stackoverflow.com/questions/37096062/get-a-basic-c-program-to-compile-using-clang-on-ubuntu-16/38385967#38385967
- you need to have OpenCV 3.1 or above.
  See below how to build OpenCV form sources.


#Mac

On OSX (10.9, 10.10 or 10.11) with Homebrew, you can install the required dependencies with the following commands:
brew install qt5
brew linkapps qt5
brew link --force qt5
brew tap homebrew/science
brew install opencv

#OpenCV from sources

You can also install OpenCV from sources (if it is not provided by your distribution or if you want a newer version for example).

OpenCV is also built with CMake.
You can use the following command to build a minimal OpenCV version compatible with Document Creator:

cmake <PATH_TO_CMakeLists.txt> -DCMAKE_INSTALL_PREFIX=<INSTALL_PREFIX> -DBUILD_opencv_highgui=ON -DENABLE_FAST_MATH=ON -DBUILD_DOCS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DWITH_CUDA=OFF -DWITH_CUFFT=OFF -DWITH_FFMPEG=OFF -DWITH_GIGEAPI=OFF -DWITH_JASPER=OFF -DWITH_LIBV4L=OFF  -DWITH_MATLAB=OFF -DWITH_OPENCL=OFF -DWITH_OPENCLAMDBLAS=OFF -DWITH_OPENCLAMDFFT=OFF -DWITH_OPENEXR=OFF -DWITH_PVAPI=OFF -DWITH_V4L=OFF -DWITH_VTK=OFF -DWITH_WEBP=OFF -DWITH_1394=OFF -DBUILD_opencv_apps=OFF -DBUILD_opencv_calib3d=OFF -DBUILD_opencv_dnn=OFF -DBUILD_opencv_features2d=OFF -DBUILD_opencv_flann=OFF -DBUILD_opencv_ml=OFF -DBUILD_opencv_objdetect=OFF -DBUILD_opencv_shape=OFF -DBUILD_opencv_stitching=OFF -DBUILD_opencv_superres=OFF  -DBUILD_opencv_ts=OFF -DBUILD_opencv_video=OFF -DBUILD_opencv_videoio=ON -DBUILD_opencv_videostab=OFF -DBUILD_opencv_world=OFF -DBUILD_opencv_highgui=ON -DPYTHON2_EXECUTABLE="" -DPYTHON3_EXECUTABLE="" -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DWITH_QUICKTIME=OFF -DHAVE_QTKIT=FALSE

with corrected <PATH_TO_CMakeLists.txt> and <INSTALL_PREFIX>.

For Visual Studio 2017 x64, you can use the following command to generate a .sln file:
cmake <PATH_TO_CMakeLists.txt> -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX=<INSTALL_PREFIX> -DBUILD_opencv_highgui=ON -DENABLE_FAST_MATH=ON -DBUILD_DOCS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DWITH_CUDA=OFF -DWITH_CUFFT=OFF -DWITH_FFMPEG=OFF -DWITH_GIGEAPI=OFF -DWITH_JASPER=OFF -DWITH_LIBV4L=OFF  -DWITH_MATLAB=OFF -DWITH_OPENCL=OFF -DWITH_OPENCLAMDBLAS=OFF -DWITH_OPENCLAMDFFT=OFF -DWITH_OPENEXR=OFF -DWITH_PVAPI=OFF -DWITH_V4L=OFF -DWITH_VTK=OFF -DWITH_WEBP=OFF -DWITH_1394=OFF -DBUILD_opencv_apps=OFF -DBUILD_opencv_calib3d=OFF -DBUILD_opencv_dnn=OFF -DBUILD_opencv_features2d=OFF -DBUILD_opencv_flann=OFF -DBUILD_opencv_ml=OFF -DBUILD_opencv_objdetect=OFF -DBUILD_opencv_shape=OFF -DBUILD_opencv_stitching=OFF -DBUILD_opencv_superres=OFF -DBUILD_opencv_ts=OFF -DBUILD_opencv_video=OFF -DBUILD_opencv_videoio=ON -DBUILD_opencv_videostab=OFF -DBUILD_opencv_world=OFF -DBUILD_opencv_highgui=ON -DPYTHON2_EXECUTABLE="" -DPYTHON3_EXECUTABLE="" -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DWITH_QUICKTIME=OFF -DHAVE_QTKIT=FALSE

Then open the .sln file with Visual Studio,
check that you have "Release" and "x64" for the "Solution configurations" and "Solution platforms" (comboboxes in the toolbar),
then go to the menu "Build" and do "Build solution".
To install OpenCV in the target directory (<INSTALL_PREFIX>), in the "Solution explorer" (on the right), right click on "INSTALL" in CMakeTargets and choose "Build".
It will install OpenCV in <INSTALL_PREFIX>, and in particular .lib files and OpenCVConfig.cmake should be in <INSTALL_PREFIX>/x64/vc15/lib and .dll files should be in <INSTALL_PREFIX>/x64/vc15/bin.

You then have to set the OPENCV_DIR environment variable for OpenCV to be found by CMake.
You can open a cmd prompt "CMD.exe" with Administrator privileges (right click), and do:
setx -m OPENCV_DIR <INSTALL_PREFIX>

Compilation
================

CMake is used for configuration & compilation.
The following commands allow to build DocCreator.

On Linux and Mac, type the following commands from a terminal:

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=<MyInstallationPrefix>
make
make install 

You can then launch the executable:

<MyInstallationPrefix>/bin/DocCreator


On Windows, with Visual Studio :
First, open a "Developer Command Prompt for VS 2017" 
(you can check that OPENCV_DIR is correctly set by doing: echo %OPENCV_DIR%)
go to the source directory,
mkdir build
cd build
cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH=<QT_PATH> -DCMAKE_INSTALL_PREFIX=<MyInstallationPrefix>
For example <QT_PATH> can be replaced by C:/Qt/5.9.1/msvc2017_64

Then you can open the generated .sln file with Visual Studio.
Check that you have "Release" and "x64" for the "Solution configurations" and "Solution platforms" (comboboxes in the toolbar),
then go to the menu "Build" and do "Build solution".
To install DocCreator in the target directory (<MyInstallationPrefix>), in the "Solution explorer" (on the right), right click on "INSTALL" in CMakeTargets and choose "Build".

You then have to copy some files to <MyInstallationPrefix>/programs directory :
- from OpenCV <INSTALL_PREFIX>/x64/vc15/bin :
  opencv_coreXXX.dll, opencv_highguiXXX.dll, opencv_imgcodecsXXX.dll, opencv_imgprocXXX.dll, opencv_photoXXX.dll, opencv_videoioXXX.dll (XXX has to be replaced by 330 for OpenCV 3.3)
- from Qt :
  - from <QT_PATH>/bin :
     Qt5Core.dll, Qt5Gui.dll, Qt5Network.dll, Qt5OpenGL.dll, qt5PrintSupport.dll, Qt5Widgets.dll, Qt5Xml.dll, Qt5XmlPatterns.dll,
	 libEGL.dll, libGLESv2.dll, d3dcompiler_47.dll
  - from <QT_PATH>/plugins :
     imageformats directory
	 platforms directory


You can then launch the executable:

<MyInstallationPrefix>/programs/DocCreator.exe




Troubleshooting
===============

#If you encounter a problem with Qt during the cmake process, ensure that the qmake executable is in your PATH
# You maye have to do:
export PATH=/Users/XXX/Qt/5.6/clang_64/bin:$PATH
#or
export PATH=/usr/local/opt/qt5/bin:$PATH
#before executing "cmake .."

#If you encounter a problem with OpenCV during the cmake process, you may have to specify the directory containing the file OpenCVConfig.cmake
#For example
OpenCV_DIR=/Users/XXX/tools/share/OpenCV cmake ..

#On Windows, if the compiler is not correctly found by cmake 
 you may have more informations in the file build/CMakeFiles/CMakeError.log
 In particular, if ucrtd.lib is not found, you may have to install "Windows SDK".
Last version of Windows 10 SDK should be available from https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk
 (tested with version 10.0.15063.468).

#If CMake prints the following error :
  "Found OpenCV Windows Pack but it has no binaries compatible with your configuration."
  it may indicate that you have a mismatch between the architectures of OpenCV libs and your compiler.
  For example, OpenCV libs may have been build for 64-bit architcture but your are trying to compile for 32-bit.

#If you encounter a problem during the make process, it may be related to the C++11 detection
#edit CMakeLists.txt and add (or remove) the following line before the first "AD_SUBDIRECTORY" line
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#then restart the construction process
rm -rf CMakeCache.txt CMakeFiles
cmake ..
make


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.