Giter Club home page Giter Club logo

doccreator's Introduction

DocCreator License: LGPL v3

Build Status

DocCreator 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

The current devlopment branch is pybind11

Dependencies

The program has the following dependencies :

  • OpenCV (3.x or 4.x)
  • Qt 5
  • Tesseract [optional] If Tesseract 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 configuration.
  • Ninja [optional]. On Windows in particular, it may be convenient to install ninja to build all from the command line.
  • C++ compiler This program should compile on linux (with gcc & clang), Mac OS (with clang) and Microsoft Windows 10 (with Visual Studio 2017). It has been tested on Fedora (19->30), Ubuntu (14.04->19.04), Mac OS (10.9->10.14), Windows 10.

Linux

On linux, your distribution may provide the binary packages for all required dependencies.

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:

CMake

On linux, CMake is often provided by the distribution.
Binary packages of CMake last versions are available from https://cmake.org/download/
cmake must be in your PATH. You should be able to print cmake version with the following commande: cmake --version

Ninja

[Optionnal]
Binary packages of Ninja are available from https://github.com/ninja-build/ninja/releases
ninja must be in your PATH. You should be able to print ninja version with the following commande: ninja --version

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

Qt

On linux, it is recommanded to use packages provided by the distribution. See above for instructions.
On Mac and Windows, the open source version of Qt may be installed with the Qt Download Installer, downloaded from https://www.qt.io/download
On Windows, you will have to choose the version to install according to the compiler that you use and the target architecture. For example, "MSVC 2017 64-bit" if you use Microsoft Visual Studio 2017 on a 64-bit processor.

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 configure a minimal OpenCV version compatible with DocCreator:

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>.

On Windows

With IDE

CMake can generate a .sln solution file to open with Visual Studio.

First, open a "Developer Command Prompt" ("Developer Command Prompt for VS 2017" for VS17 for example).
cd <OpenCV_SOURCES_DIRECTORY>
mkdir build
cd build

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.

With ninja

CMake can generate a ninja build. The whole compilation is done from the command line.

First, open a "Native Tools Command Prompt" ("x64 Native Tools Command Prompt for VS 2017" for VS17 on x86-64 for example).
cd <OpenCV_SOURCES_DIRECTORY>
mkdir build
cd build

cmake <PATH_TO_CMakeLists.txt> -G "Ninja" -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 build with:
ninja
and install with:
ninja install

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.

Linux / macOS

On Linux and Mac, type the following commands from a terminal:
cd <DocCreatorDirectory>
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=<MyInstallationPrefix>
make
make install
You can also pass other options to cmake. See below.

You can then launch the executable:
<MyInstallationPrefix>/bin/DocCreator

Windows

On Windows, with Visual Studio:
First, open a "Developer Command Prompt" ("Developer Command Prompt for VS 2017" for VS17 for example). (you can check that OPENCV_DIR is correctly set by doing: echo %OPENCV_DIR%) go to the source directory,
cd <DocCreatorDirectory>
mkdir build
cd build

With IDE

CMake can generate a .sln solution file to open with Visual Studio.

For Visual Studio 2017:

cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH=<QT_PATH> -DCMAKE_INSTALL_PREFIX=<MyInstallationPrefix>

or for Visual Studio 2019 (with CMake 3.14.6 or above, in "Developer Command Prompt for VS 2019"):

cmake .. -G "Visual Studio 16 2019" -A "x64" -DCMAKE_PREFIX_PATH=<QT_PATH> -DCMAKE_INSTALL_PREFIX=<MyInstallationPrefix>

<QT_PATH> is the path to installed Qt configuration for this compiler. <QT_PATH> is for example C:/Qt/5.12.4/msvc2017_64 You can also pass other options to cmake. See below.

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 (), in the "Solution explorer" (on the right), right click on "INSTALL" in CMakeTargets and choose "Build".

With Ninja

CMake can generate a ninja build. The whole compilation is done from the command line.

cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=<QT_PATH> -DCMAKE_INSTALL_PREFIX=<MyInstallationPrefix>

You can also pass other options to cmake. See below.

then build with:
ninja
then install with:
ninja install

You can then launch the executable:
<MyInstallationPrefix>/programs/DocCreator.exe

CMake options

-DBUILD_OTHER_PROGS=ON

When configuring DocCreator with cmake, you can pass the option -DBUILD_OTHER_PROGS=ON to cmake. It will be build other example programs using DocCreator framework.
In particular, it will build:
* DocCreatorDegradator that allows to apply degradation effects on all the images of a given directory and save produced images in a new directory. You can change the applied degradation effects in software/DocCreator/src/Degradator/main.cpp
* DocCreatorMakeFont that allows to create DocCreator old-fonts from existing (TrueType) fonts. You can save the produced files in data/font to use these fonts in DocCreator.

-DBUILD_OTHER_PROGS_3D=ON

When configuring DocCreator with cmake, you can pass the option -DBUILD_OTHER_PROGS_3D=ON to cmake. It will be build other example programs using DocCreator 3D code.

-DBUILD_TESTING=ON

When configuring DocCreator with cmake, you can pass the option -DBUILD_TESTING=ON to cmake. It will be build degradations unit tests.

FAQ

See FAQ.md.

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, on linux and macOS:
    OpenCV_DIR=/Users/XXX/tools/share/OpenCV cmake ..
    On Windows, to set the OpenCV_DIR environment variable, you may open a cmd prompt "CMD.exe" with Administrator privileges (right click), and do:
    setx -m OPENCV_DIR <INSTALL_PREFIX>
    You will have to open a new terminal. You can print and check that the variable is correctly set with:
    echo %OpenCV_DIR%

  • 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 architecture but your are trying to compile for 32-bit. On Windows with Visual Studio in particular, if you use a "Native Tools Command Prompt", check that it is for the correct architecture. For example "x64 Native Command Prompt" and not "x86 Native Command Prompt" for x86_64.

  • If CMake fails to download one of the dependencies and prints this kind of error:

  error: downloading
  https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz
  failed: status code=1 string="Unsupported protocol", log=Protocol "https"
  not supported or disabled in libcurl

the problem seems to be that the CURL library shipped with CMake is not build with SSL support. You may have to compile CMake from sources enabling using a CURL library with SSL support.

  • 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

  • On Windows, with Visual Studio, if you encounter a link problem with tesseract, it may be that you compiled in Debug mode instead of Release mode. Indeed, DocCreator tries to link with tesseract305.lib, but tesseract305d.lib is generated in Debug mode.

  • On Windows, if you encounter a problem when the program is launched, it may be that the various required libraries (dll) are not correctly found.
    You then may have to copy some files to /programs directory [if they are not present]:

  • 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

doccreator's People

Contributors

borismansencal avatar qlamu avatar queuecumber 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

doccreator's Issues

DocCreator can sometimes crash upon loading large images

Hi,

I've experienced some crashes with DocCreator. Some of my co-worker also have this problem as well. All of us are using different OSes (Windows, Linux, MacOS)
The issue can happen randomly, so it's hard to track why. I suspect that it occurs when loading a folder with large images.

Ground truth file type

I have noticed that the ground-truth XML file type .od is not specified anywhere. May I know which file type is it? Is there any chance to convert it into commonly used formats such as PageXML?

create mesh file

Hi,
thank you for this great tool.
is there a documentation on how to create mesh files? currently, there are 17 brs files in the repository how can we generate more?

Call DocCreator with Command Line Arguments

Hi,

I installed the DocCreator via the installer from the website and I can process images and noise them. Now I want to access the features via command line to integrate the noise process into my workflow. Is this somehow possible?

Support non latin characters

Hi,
I've been trying to create a synthetic documents with non latin characters, for example: arabic, greek, chinese. The default fonts don't support such characters so I built the DocCreatorMakeFont and DocCreator from source (current master). I then converted arabic TTF to XML old font and imported it into the DocCreator. Creating a new text field and pasting some arabic in it resulted in console output:
=> character not found in Font: "ن"

Describe the solution you'd like
DocCreator is able to handle non-latin fonts

Additional context
I did not try other non-latin languages and fonts, but I expect that other won't work either

OS: Ubuntu 20.04.3 LTS

DocCreator segfaults

After doing font extraction and layout extraction (filling with lorem ipsum), saving the XML and reopening, whenever I click on a region, I get the following segmentation violation crash:

gdb stack frame
Thread 1 "DocCreator" received signal SIGSEGV, Segmentation fault.
Models::Font::getCharacter (this=this@entry=0x0, charValue=...)
    at DocCreator/framework/src/models/font.cpp:61
61	  auto it = _characterMap.find(charValue);
(gdb) bt full
#0  Models::Font::getCharacter(QString const&) const (this=this@entry=0x0, charValue=...)
    at DocCreator/framework/src/models/font.cpp:61
        it = <optimized out>
#1  0x000055555561cdbb in GraphicsTextBlockItem::drawCharacter(Doc::DocCharacter*, int, Doc::DocStyle*, Doc::DocParagraph*)
    (this=0x555557035600, c=0x5555574cb3c0, offset=0, style=0x555556d4e610, p=0x5555574cb270)
    at DocCreator/software/DocCreator/src/Document/GraphicsTextBlockItem.cpp:354
        docTextBlock = 0x5555574cb1e0
        cDisplay = {static null = {<No data fields>}, d = 0x5555574cb310}
        font = 0x0
        character = <optimized out>
        data = <optimized out>
        characterImage = <incomplete type>
        right = <optimized out>
        base = <optimized out>
        left = <optimized out>
        item = <optimized out>
#2  0x000055555561d23f in GraphicsTextBlockItem::drawString(Doc::DocString*, int, Doc::DocParagraph*)
    (this=this@entry=0x555557035600, s=s@entry=0x555556fc3620, offset=offset@entry=0, p=p@entry=0x5555574cb270) at DocCreator/software/DocCreator/src/Document/GraphicsTextBlockItem.cpp:291
        c = 0x5555574cb3c0
        __for_range = <optimized out>
#3  0x000055555561d31b in GraphicsTextBlockItem::drawParagraph(Doc::DocParagraph*, int)
    (this=0x555557035600, p=0x5555574cb270, offset=0)
    at DocCreator/software/DocCreator/src/Document/GraphicsTextBlockItem.cpp:275
        s = 0x555556fc3620
        __for_range = 
            @0x7fffffffc7b0: {<QListSpecialMethods<Doc::DocString*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x555556ea6e40}, d = 0x555--Type <RET> for more, q to quit, c to continue without paging--c
556ea6e40}}
#4  0x000055555561d4a1 in GraphicsTextBlockItem::draw(bool) (this=0x555557035600) at DocCreator/software/DocCreator/src/Document/GraphicsTextBlockItem.cpp:186
        p = 0x5555574cb270
        __for_range = @0x7fffffffc810: {<QListSpecialMethods<Doc::DocParagraph*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x555556981590}, d = 0x555556981590}}
        docTextBlock = 0x5555574cb1e0
        paragraphs = {<QListSpecialMethods<Doc::DocParagraph*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x555556981590}, d = 0x555556981590}}
        firstParagraph = <optimized out>
        offset = 0
#5  0x0000555555602456 in ADocumentView<Doc::DocTextBlock>::drawElement(Doc::DocTextBlock*, bool) (this=this@entry=0x555557035680, element=<optimized out>, complete=complete@entry=false) at DocCreator/software/DocCreator/src/Document/ADocumentView.hpp:40
#6  0x00005555556046d1 in ADocumentView<Doc::DocTextBlock>::drawElement(Doc::DocTextBlock*, bool) (complete=false, element=<optimized out>, this=0x555557035680) at DocCreator/software/DocCreator/src/Document/ADocumentView.hpp:40
        graphicTextBlock = 0x555557035600
        docTextBlock = <optimized out>
        currentBlock = 0x555557035600
        page = 0x555556fec6e0
        current = <optimized out>
        it1 = <optimized out>
        it1End = <optimized out>
#7  GraphicsPageItem::draw(bool) (this=0x555556a2a9d0, complete=<optimized out>) at DocCreator/software/DocCreator/src/Document/GraphicsPageItem.cpp:222
        graphicTextBlock = 0x555557035600
        docTextBlock = <optimized out>
        currentBlock = 0x555557035600
        page = 0x555556fec6e0
        current = <optimized out>
        it1 = <optimized out>
        it1End = <optimized out>
#8  0x0000555555618676 in ADocumentView<Doc::Page>::drawElement(Doc::Page*, bool) (this=0x555556a2a9e0, element=<optimized out>, complete=<optimized out>) at DocCreator/software/DocCreator/src/Document/ADocumentView.hpp:40
#9  0x000055555561b213 in ADocumentView<Doc::Document>::drawElement(Doc::Document*, bool) (complete=false, element=0x555556d785b0, this=0x555556977920) at DocCreator/software/DocCreator/src/Document/ADocumentView.hpp:40
        document = 0x555556d785b0
#10 ADocumentView<Doc::Document>::drawElement(Doc::Document*, bool) (complete=false, element=0x555556d785b0, this=0x555556977920) at DocCreator/software/DocCreator/src/Document/ADocumentView.hpp:40
        document = 0x555556d785b0
#11 DocumentView::draw(bool) (this=<optimized out>, complete=<optimized out>) at DocCreator/software/DocCreator/src/Document/DocumentView.cpp:148
        document = 0x555556d785b0
#12 0x0000555555605686 in ADocumentView<Doc::Document>::drawElement(Doc::Document*, bool) (this=0x5555563136e0, element=<optimized out>, complete=complete@entry=false) at DocCreator/software/DocCreator/src/Document/ADocumentView.hpp:40
#13 0x0000555555605bf5 in ADocumentView<Doc::Document>::drawElement(Doc::Document*, bool) (complete=false, element=<optimized out>, this=<optimized out>) at DocCreator/software/DocCreator/src/Document/ADocumentView.hpp:40
        currentTextBlock = <optimized out>
        currentStyle = 0x555556d4e610
#14 DocumentController::setOffset(int) (this=0x5555567e24a0, value=<optimized out>) at DocCreator/software/DocCreator/src/Document/DocumentController.cpp:366
        currentTextBlock = <optimized out>
        currentStyle = 0x555556d4e610
#15 0x000055555561c586 in GraphicsTextBlockItem::setCursorFromPosition(QPointF) (this=this@entry=0x555557035600, pos=...) at DocCreator/software/DocCreator/src/Document/GraphicsCharacterItem.hpp:29
        isReturn = <optimized out>
        cursorBefore = <optimized out>
        controller = <optimized out>
        charItem = 0x555556d6af40
        __for_range = @0x5555570356b0: {<QListSpecialMethods<GraphicsCharacterItem*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff6738760 <QListData::shared_null>}, d = 0x7ffff6738760 <QListData::shared_null>}}
#16 0x000055555561c702 in GraphicsTextBlockItem::mousePressEvent(QGraphicsSceneMouseEvent*) (this=0x555557035600, event=<optimized out>) at DocCreator/software/DocCreator/src/Document/GraphicsTextBlockItem.cpp:441
        docController = <optimized out>
        docTextBlock = 0x5555574cb1e0
#17 0x00007ffff7537b4a in QGraphicsItem::sceneEvent(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007ffff755b627 in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007ffff7563acb in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007ffff7563cff in QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007ffff756d27a in QGraphicsScene::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007ffff7230a66 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007ffff723a0f0 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007ffff665593a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#25 0x00007ffff758a22b in QGraphicsView::mousePressEvent(QMouseEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#26 0x00007ffff72732d1 in QWidget::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#27 0x00007ffff7320d52 in QFrame::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#28 0x00007ffff758b421 in QGraphicsView::viewportEvent(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#29 0x00007ffff665564b in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#30 0x00007ffff7230a55 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#31 0x00007ffff723a343 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#32 0x00007ffff665593a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#33 0x00007ffff7239457 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#34 0x00007ffff728f35d in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#35 0x00007ffff72921ec in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#36 0x00007ffff7230a66 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#37 0x00007ffff723a0f0 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#38 0x00007ffff665593a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#39 0x00007ffff6bff7d3 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#40 0x00007ffff6c0110b in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#41 0x00007ffff6bdb35b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#42 0x00007fffeb49132e in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#43 0x00007ffff482a17d in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#44 0x00007ffff482a400 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#45 0x00007ffff482a4a3 in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#46 0x00007ffff66ad565 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#47 0x00007ffff66544db in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#48 0x00007ffff665c246 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#49 0x00005555555a5d49 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at DocCreator/software/DocCreator/src/main.cpp:47
        a = <incomplete type>
        w = 0x555555fee580

(I can also share the core dump upon request.)

Not sure what exactly you need to reproduce, so I have packaged all data files you might need:

doccreator-crash.zip

My platform:

  • Linux Mint 20 x86_64
  • DocCreator aedf944 (cmake build with GCC c++ 9.3.0)
  • QT 5.12
  • OpenCV 4.2.0
  • cmake 3.16.3

Segmentation error with random degradation with holes on the border right of a small image (python)

Hello,
With python there is a segmentation error when I use a random degradation with holes on a small image and with the border right. With the border left everything works.
These images are in png format.

This is the code :

print(img.shape)
HOLE_PATTERN="data/pattern16.png"
imgHole = cv2.imread(HOLE_PATTERN)
print(imgHole.shape)
#img_hole = DocCreatorPy.addHoleAtRandom(img, imgHole, 1, DocCreatorPy.HoleType.BORDER, 0.3, DocCreatorPy.HoleSide.BORDER_LEFT, belowColor=(255, 255, 255, 255))
img_hole = DocCreatorPy.addHoleAtRandom(img, imgHole, 1, DocCreatorPy.HoleType.BORDER, 0.3, DocCreatorPy.HoleSide.BORDER_RIGHT, belowColor=(255, 255, 255, 255))
output="degraded_hole.png"
cv2.imwrite(output, img_hole)
print("wrote", output)

and this is the result :

(150, 122, 3)
(664, 486, 3)
Erreur de segmentation

Platform :
Debian GNU/Linux 10 (buster)
Python version 3.8.6
cv2 version 4.5.1
numpy version 1.19.5
DocCreator/WHEELS_OSMESA modified on 2021-04-20

Install issue on Ubuntu 16.04: error: ‘string’ does not name a type

While trying to install on Ubuntu 16.04, I encountered the following problem:

In file included from /usr/local/include/tesseract/ltrresultiterator.h:26:0,
                 from /usr/local/include/tesseract/resultiterator.h:26,
                 from /usr/local/include/tesseract/baseapi.h:31,
                 from /home/jbc/DocCreator/software/DocCreator/src/FontGenerator/OCRDialog.cpp:20:
/usr/local/include/tesseract/unichar.h:164:10: error: ‘string’ does not name a type
   static string UTF32ToUTF8(const std::vector<char32>& str32);
          ^
software/DocCreator/CMakeFiles/DocCreator.dir/build.make:1826 : la recette pour la cible « software/DocCreator/CMakeFiles/DocCreator.dir/src/FontGenerator/OCRDialog.cpp.o » a échouée
make[2]: *** [software/DocCreator/CMakeFiles/DocCreator.dir/src/FontGenerator/OCRDialog.cpp.o] Erreur 1
CMakeFiles/Makefile2:256 : la recette pour la cible « software/DocCreator/CMakeFiles/DocCreator.dir/all » a échouée

I tried to modify /usr/include/c++/v1/stringas per https://stackoverflow.com/questions/37096062/get-a-basic-c-program-to-compile-using-clang-on-ubuntu-16/38385967#38385967, and even to create a symbolic link withln -s /usr/include/libcxxabi/__cxxabi_config.h /usr/include/c++/v1/__cxxabi_config.h`, as suggested in the comments, but I still get this error.

I also tried, as suggested in the Troubleshooting section, to uncomment the line

#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

But, after that, I get another error,

[ 17%] Building CXX object software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/CMakeFiles/lzhamdecomp.dir/lzham_assert.cpp.o
In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h:9:0,
                 from /usr/include/c++/5/cstdint:41,
                 from /usr/include/c++/5/bits/char_traits.h:420,
                 from /usr/include/c++/5/string:40,
                 from /usr/include/c++/5/random:40,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_core.h:250,
                 from /home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_assert.cpp:3:
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:48:17: error: expected unqualified-id before numeric constant
    const uint8  UINT8_MAX  = 0xFFU;
                 ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:48:17: error: expected ‘)’ before numeric constant
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:50:17: error: expected unqualified-id before numeric constant
    const uint16 UINT16_MAX = 0xFFFFU;
                 ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:50:17: error: expected ‘)’ before numeric constant
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:52:17: error: expected unqualified-id before numeric constant
    const uint32 UINT32_MAX = 0xFFFFFFFFU;
                 ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:52:17: error: expected ‘)’ before numeric constant
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:54:17: error: expected unqualified-id before numeric constant
    const uint64 UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL;    //0xFFFFFFFFFFFFFFFFui64;
                 ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:54:17: error: expected ‘)’ before numeric constant
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:56:16: error: expected unqualified-id before ‘-’ token
    const int8  INT8_MIN  = -128;
                ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:56:16: error: expected ‘)’ before ‘-’ token
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:57:16: error: expected unqualified-id before numeric constant
    const int8  INT8_MAX  = 127;
                ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:57:16: error: expected ‘)’ before numeric constant
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:58:16: error: expected unqualified-id before ‘-’ token
    const int16 INT16_MIN = -32768;
                ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:58:16: error: expected ‘)’ before ‘-’ token
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:59:16: error: expected unqualified-id before numeric constant
    const int16 INT16_MAX = 32767;
                ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:59:16: error: expected ‘)’ before numeric constant
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:60:16: error: expected unqualified-id before ‘-’ token
    const int32 INT32_MIN = (-2147483647 - 1);
                ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:60:16: error: expected ‘)’ before ‘-’ token
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:61:16: error: expected unqualified-id before numeric constant
    const int32 INT32_MAX = 2147483647;
                ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:61:16: error: expected ‘)’ before numeric constant
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:62:16: error: expected unqualified-id before ‘-’ token
    const int64 INT64_MIN = (int64)0x8000000000000000ULL; //(-9223372036854775807i64 - 1);
                ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:62:16: error: expected ‘)’ before ‘-’ token
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:63:16: error: expected unqualified-id before numeric constant
    const int64 INT64_MAX = (int64)0x7FFFFFFFFFFFFFFFULL; //9223372036854775807i64;
                ^
/home/jbc/Data/F/LAKME/01_ocerisation/DocCreator/DocCreator/software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/lzham_types.h:63:16: error: expected ‘)’ before numeric constant
software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/CMakeFiles/lzhamdecomp.dir/build.make:65 : la recette pour la cible « software/DocCreator/src/Degradations/Distortion3DModel/thirdparty/lzham_codec/lzhamdecomp/CMakeFiles/lzhamdecomp.dir/lzham_assert.cpp.o » a échouée

how to generate old type fonts

Thank you for your greate job,

  • DocCreatorMakeFont that allows to create DocCreator old-fonts from existing (TrueType) fonts. You can save the produced files in data/font to use these fonts in DocCreator.

I found this description on README, did it means we can produce old fonts from TrueType fonts automaticallly?

How to place the random texts only at certain positions?

Given a background, is it possible to specify the locations (top-left of text) only at which the random texts should be put?

Example use-case:
Using an empty form image as background, can I randomly fill up the form to generate synthetically filled forms? (provided I somehow specify the location of blank spaces)

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.