diff --git a/CMakeLists.txt b/CMakeLists.txt index d1954cb..f734306 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,9 @@ project(vobsub2srt) cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) + set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules) if(NOT CMAKE_BUILD_TYPE) diff --git a/CMakeModules/FindTesseract.cmake b/CMakeModules/FindTesseract.cmake index 4b15d74..36cf0fb 100644 --- a/CMakeModules/FindTesseract.cmake +++ b/CMakeModules/FindTesseract.cmake @@ -43,18 +43,8 @@ if(TESSERACT_DATA_PATH) add_definitions(-DTESSERACT_DATA_PATH="${TESSERACT_DATA_PATH}") endif() -set(CMAKE_REQUIRED_INCLUDES ${Tesseract_INCLUDE_DIR}) -check_cxx_source_compiles( - "#include \"tesseract/baseapi.h\" - using namespace tesseract; - int main() { - }" - TESSERACT_NAMESPACE) -if(TESSERACT_NAMESPACE) - add_definitions("-DCONFIG_TESSERACT_NAMESPACE") -else() - message(WARNING "You are using an old Tesseract version. Support for Tesseract 2 is deprecated and will be removed in the future!") -endif() +add_definitions("-DCONFIG_TESSERACT_NAMESPACE") + list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${Tesseract_INCLUDE_DIR}) if(BUILD_STATIC) diff --git a/src/vobsub2srt.c++ b/src/vobsub2srt.c++ index 2f9e1a0..1d49006 100644 --- a/src/vobsub2srt.c++ +++ b/src/vobsub2srt.c++ @@ -269,6 +269,22 @@ int main(int argc, char **argv) { dump_pgm(subname, sub_counter, width, height, stride, image, image_size); } + // for 4.x version use dark text on light background. + bool inverting_images = true; + + if (inverting_images) { + int size_r = width * height; + unsigned char* image_rev = new unsigned char[size_r]; + for (int i = 0; i < size_r; i++) + { + int val = static_cast(image[i]); + unsigned char cz = (255 - val); + image_rev[i] = cz; + } + + image = image_rev; + } + #ifdef CONFIG_TESSERACT_NAMESPACE char *text = tess_base_api.TesseractRect(image, 1, stride, 0, 0, width, height); #else