I would like to do an affine transformation on a very low resolution bitmap and I would like to do it while preserving the maximum amount of information.
My input data is a 1 bit 64-by-64 pixel image of hand written character and my output would be greyscale and higher resolution. Upon analysing the image I construct a series of affine transformations (rotation, scaling, shear, translation) what I could multiply into a single affine transformation matrix.
My problem is that given the input image and my computed affine transformation matrix, how can I calculate my output image in the highest possible quality? I have read articles about different interpolation techniques, but all of them are about how to do interpolation for scaling, and not for general affine transforms.
Here is a demo what is doing exactly what I am looking for. Given an affine transformation matrix and an interpolation technique it calculates an image.
http://bigwww.epfl.ch/demo/jaffine/index.html
Can you explain me what are the steps required for calculating a higher resolution (for example 4x) greyscale image, if I have a lower resolution 1-bit input and a given T affine transformation matrix?
Can you link me to some source code or tutorials or articles or possibly even books about how to implement a linear, cubic or better interpolation with affine transform?
I need to implement this problem in Java, and I know Java has an Affine class, but I don't know if it implements interpolation. Do you know any C++ or Java library what has nice to read code for figuring out how to write an algorithm for doing affine transform using interpolation?
Are there any freely available libraries for Java or C++ which have built-in functions for calculating affine transform using interpolation?
The same people you linked to have a C implementation with several interpolation options here. You could probably use JNI to wrap it. There is also JavaCV, which wraps OpenCV. OpenCV contains the warpAffine, which has interpolation. Also, check out the Java Advanced Imaging API here.
OK, here is the solution I ended up with.
I transformed all my array[][] into a BufferedImage object
Applied the affine transformation using AffineTransformOp with interpolation bicubic
Transformed back the BufferedImage object into array[][]: