scantailor will get you most of the way there. the original project is dead but there are a few forks on github. It has been a while since I did any serious scanning so I can't remember which version I used.
https://github.com/4lex4/scantailor-advanced
https://github.com/trufanov-nok/scantailor-universal