chriswolfvision / local_adaptive_binarization

Local adaptive image binarization
125 stars 25 forks source link

Couldn't get it to work on Windows #3

Open SB2020-eye opened 3 years ago

SB2020-eye commented 3 years ago

Hi. I know little to no C++. I saw your disclaimer about Windows. I'm just reporting that I couldn't get it to work on Windows (Win10, using Visual Studio Code). But the problem could very well be me. I don't know how to "compile" something in C++ , for example. (Though I did try, search the web, and try again for the past 4 hours or so.)

If anyone has any suggestions to get it working, that would be much appreciated by this novice.

Thanks!

chriswolfvision commented 3 years ago

Hi, as I said, I don't work on windows - that's the choices one can make when working in academia. If somebody wants to port it, be me guest, but I am not willing to do it.

Best regards, Christian

SB2020-eye commented 3 years ago

I do understand, Christian. :) All the best to you.

If someone else comes along that can make it work in Windows (or in python), great. Please add to the thread. :)

woctezuma commented 2 years ago

If someone else comes along that can make it work in Windows (or in python), great. Please add to the thread. :)

I am on Windows, and I have used the Python plug-in for GIMP which is mentioned in the README.

https://github.com/chriswolfvision/local_adaptive_binarization#gimppython-version

The installation is as simple as copying a .py file in the right folder. The usage consists in running pressing a button in GIMP itself.

char101 commented 1 year ago

Compilation on Windows:

Source modification:

diff --git a/binarizewolfjolion.cpp b/binarizewolfjolion.cpp
index e92d124..dcf8c4a 100644
--- a/binarizewolfjolion.cpp
+++ b/binarizewolfjolion.cpp
@@ -13,8 +13,8 @@
  **************************************************************/

 #include <stdio.h>
-#include <unistd.h>
-#include <getopt.h>
+//#include <unistd.h>
+#include "getopt.h"
 #include <iostream>
 // #include <cv>
 // #include <highgui>
@@ -377,7 +377,7 @@ int main (int argc, char **argv)

     // Load the image in grayscale mode
-    Mat input = imread(inputname,CV_LOAD_IMAGE_GRAYSCALE);
+    Mat input = imread(inputname,cv::ImreadModes::IMREAD_GRAYSCALE);

     if ((input.rows<=0) || (input.cols<=0)) {

Compilation script (modify as required):

@echo off
setlocal
set OPENCV_DIR=T:\OCR\opencv
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" amd64
if not exist getopt.h curl -O https://raw.githubusercontent.com/skandhurkat/Getopt-for-Visual-Studio/master/getopt.h
cl /MT /O2 /arch:AVX2 /Gw /EHsc /I %OPENCV_DIR%\build\include binarizewolfjolion.cpp %OPENCV_DIR%\build\x64\vc15\lib\opencv_world460.lib
if not exist opencv_world460.dll copy %OPENCV_DIR%\build\x64\vc15\bin\opencv_world460.dll .
endlocal

Compiled executable (NOTE: to run it requires opencv_world460.dll from opencv directory, I don't include it here since it is a 64MB dll) (virustotal result):

binarizewolfjolion.zip