jhansireddy / AndroidScannerDemo

ScanLibrary is an android document scanning library built on top of OpenCV, using the app you will be able to select the exact edges and crop the document accordingly from the selected 4 edges and change the perspective transformation of the cropped image.
MIT License
1.07k stars 472 forks source link

B&W filter issue #117

Closed rishavsingla closed 3 years ago

rishavsingla commented 4 years ago

I tried B&W filter. It does not work for me. Black Ink spread whereever the image is. So please help me

vamsee9 commented 4 years ago

You need to edit (decrease) some values in scanlibrary -> src -> main -> jni -> scan.cpp scroll down or find (Ctrl + F) and search for BW scrol little bit down you will see these lines

//  cvtColor(mbgra, dst, CV_BGR2GRAY);
    float alpha = 2.2;
    float beta = 0;
    float gama = 2.2;
    dst.convertTo(dst, -1, gama, beta);

    threshold(dst,dst,0,255,THRESH_BINARY | THRESH_OTSU);

Edit them and test up to best levels I have edited on my own but these are not best values

maxakash commented 4 years ago

I have made changes to above values, but they are not visible in the app. I have even tried cleaning the project.

jhansireddy commented 3 years ago

You should do an NDK build after changing the scan.cpp

maxakash commented 3 years ago

I am new to ndk build. Can you please tell me how to do it?

@jhansireddy

jhansireddy commented 3 years ago

https://developer.android.com/ndk/guides