Using opencv library, example of connecting project to c++ code and performing document scanning
For project setup, please follow https://github.com/leadrien/opencv_native_androidstudio
It is great tutorial on how to setup project including c++ support, adding opencv library for c++ and java, etc...
In this project, you will have 2 options: