Haroon Amjad
Haroon Amjad

Reputation: 31

How to Perspective Transform Image Using Corner Coordinates In Flutter

I need to Perspective Transform (using corner coordinates) document image in my flutter app.

See Example Here: 4 Point Image Perspective Transform

I have already tried implementing OpenCV C++ Library using dart FFI.

https://medium.com/flutter-community/integrating-c-library-in-a-flutter-app-using-dart-ffi-38a15e16bc14

Problems in this approach:

  1. Increases App Size
  2. Can't Execute Asyncronously (App UI freezes until execution completes)

I have also tried combining these two approaches: Transform Image widget and render widget UI as Image. https://medium.flutterdevs.com/perspective-in-flutter-904c6cade292

https://medium.com/flutter-community/export-your-widget-to-image-with-flutter-dc7ecfa6bafb

But Renders Image with respect to screen resolution. For Example: If Image resoulution is 2000x2000 px and it is taking only 400x400 px on screen, then rendered image will be 400x400 px.

Is there any other performance and size efficient way of doing Perspective Transform of Image using 4 Corner Coordinates ?

Upvotes: 3

Views: 1697

Answers (1)

Related Questions