Sign up ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I would like to do the following transformations on a very low resolution bitmap (64x64 pixels).

I am doing this transformation on a computer images, but it has nothing to do with computers, you can think about an image as rectangular grid with a real number mapped for each integer coordinate. I represent each point in a tuple (x, y, value). This means that my original image is just a set of points represented this way.

I will be doing geometric transformations on all the points.

  1. Moving the non-white areas to the center
  2. Scaling the non-white parts to fill the boundary
  3. Possibly doing some rotation and
  4. shearing.

My problem is that so far all the transformations are working perfectly, but I don't understand the theory behind that how can I put back a rotated, sheared, scaled, moved grid into the original 64x64 one.

I read articles about interpolating, and all of them starts by a point inside a 0..1, 0..1 unit square.

unit square

I understand this case (looks like a simple scaling), but in my case I don't know what is my reference grid and what are my pixels.

Can you explain to me that in a case where you do a series of transformations what is the reference grid, what are my points and that most importantly how do I get the transformed points back onto a 64x64 grid?

share|cite|improve this question
In case you find this useful:… – leonbloy Oct 22 '11 at 17:39
Are you uing Affine Transformations? – luser droog Oct 22 '11 at 17:43
Sorry, I looked up Affine Transformation better, yes, I am only using Affine Tranformations. – zsero Oct 22 '11 at 18:59
I think the reason you're not getting any answers may be that it's unclear what exactly you're doing and what you don't know how to do. For instance, "putting back a ... grid into the original one" is an unusual expression that I find hard to interpret. It would help if you wrote down in mathematical notation what transforms you perform and what other transforms you'd like to perform but can't. – joriki Oct 25 '11 at 1:27
OK, in the meantime I kind of understood how to solve the problem. It only works with affine transform, not with any random dots. I have to calculate the inverse of the affine transform and then I can do interpolation. I found it explained here: – zsero Oct 25 '11 at 3:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.