2

I'm looking to map an ImageView drawing rect to a quadrilateral.

I was hoping I could do this by overriding ViewGroup.getChildStaticTransformation (View child, Transformation t) and messing around with the Matrix with and without a Camera, but its not as simple as I would like.

I want be able to take a bitmap and project it onto a 3d plane / surface.

I thought I had found a nice and easy solution with Matrix.setRectToRect(...) but not quite there. As RectF only allows the edges to be specified rather than the corners I cannot use to map to a trapezium. I would like to just be able to specify my destination shape rather than mess around with 3D animation classes or manually rotating a Camera.

I know i need to brush up on my Linear Algebra but I'm hoping someone can give me some pointers :)

Thanks!

EDIT: looking around I see I want to use a Projective Transformation

EDIT: I'm going to test out this solution

Community
  • 1
  • 1
Dori
  • 18,283
  • 17
  • 74
  • 116
  • if you need to map something like human faces i suggest to use OpenCV, but in general i don't get your question as it's written right now. – axis Oct 02 '12 at 16:20
  • Sorry I must not have explained myself very well, I have edited the question – Dori Oct 03 '12 at 07:20

1 Answers1

1

Doh, its Matrix.setPolyToPoly() that i was looking for! It was there the whole time, since API level 1 (thank god!)

Dori
  • 18,283
  • 17
  • 74
  • 116