Your question has many sub-question, I will try to get pointer for each point.
- See getRotationMatrix2D and this sample.
- No idea, but you seem to know how to do...
- Use threshold function, where each pixel below thresh will be white, and pixels above thresh will be black.
- You can detect each hole with Hough or use a simple medianBlur for example. It depends on your hole, maybe with an image sample, we could have more relevant idea.
- See this post where the thinning methods seem adapted to your context.
- A simple filter could be tested, but, you probably have to do some bibliography on that topic (look at research paper, which could be coded with OpenCV features.
- I don't understand what you mean here. Filter JPEG blocks? See if the image was in JPEG? Please give some more explanations.
To use every OpenCV functions with the java binding, see the doc here.