DocLense icon indicating copy to clipboard operation
DocLense copied to clipboard

Implementing measuring handles

Open anushbhatia opened this issue 3 years ago • 13 comments

Adding a feature to add dynamic cropping box explained in this [repo]https://github.com/doo/scanbot-sdk-example-flutter) image Adding measuring handles in the project to get better output.

anushbhatia avatar Mar 18 '21 19:03 anushbhatia

@anushbhatia https://pub.dev/packages/edge_detection . Here is a package that can help for this purpose .

Sahil-kachhap avatar Mar 19 '21 11:03 Sahil-kachhap

This can be used. Do you want to go ahead with this?

anushbhatia avatar Mar 19 '21 18:03 anushbhatia

If no one's assigned, can I work on it?

nicks101 avatar Mar 23 '21 07:03 nicks101

sure

anushbhatia avatar Mar 23 '21 09:03 anushbhatia

Hey @anushbhatia , for implementing edge detection we following choices.

  • use edge_detection package. The problem with this is it's not active and doesn't have a null safety version. Not customizable also.
  • use opencv package. Problems are the same as above.
  • use scanbot_sdk package. It's migrated to null safety. It's paid (have a free trial but we can't publish under it). It has many other functionalities also. Here's a reference.
  • Implement using OpenCV by binding to native code using dart:ffi. This is a little tricky. Here's an article for reference. Mainly we'll write C/C++ code within our project and use it in flutter with dart:ffi.

Please let me know which one should I go forward with. Also if you have any other suggestions, please let me know.

nicks101 avatar Mar 25 '21 07:03 nicks101

Hey @anushbhatia , for implementing edge detection we following choices.

  • use edge_detection package. The problem with this is it's not active and doesn't have a null safety version. Not customizable also.
  • use opencv package. Problems are the same as above.
  • use scanbot_sdk package. It's migrated to null safety. It's paid (have a free trial but we can't publish under it). It has many other functionalities also. Here's a reference.
  • Implement using OpenCV by binding to native code using dart:ffi. This is a little tricky. Here's an article for reference. Mainly we'll write C/C++ code within our project and use it in flutter with dart:ffi.

Please let me know which one should I go forward with. Also if you have any other suggestions, please let me know.

I have a codebase based on OpenCV you can use that will push it on another branch. i think the version I m using is stable in that can be used. Let me know I will upload the code if needed

anushbhatia avatar Mar 25 '21 20:03 anushbhatia

Hey @anushbhatia , for implementing edge detection we following choices.

  • use edge_detection package. The problem with this is it's not active and doesn't have a null safety version. Not customizable also.
  • use opencv package. Problems are the same as above.
  • use scanbot_sdk package. It's migrated to null safety. It's paid (have a free trial but we can't publish under it). It has many other functionalities also. Here's a reference.
  • Implement using OpenCV by binding to native code using dart:ffi. This is a little tricky. Here's an article for reference. Mainly we'll write C/C++ code within our project and use it in flutter with dart:ffi.

Please let me know which one should I go forward with. Also if you have any other suggestions, please let me know.

Is there any way we can make use of a wrapper around the python code of opencv-python or opencv-python-contrib?

smaranjitghose avatar Mar 25 '21 23:03 smaranjitghose

Hey @anushbhatia , for implementing edge detection we following choices.

  • use edge_detection package. The problem with this is it's not active and doesn't have a null safety version. Not customizable also.
  • use opencv package. Problems are the same as above.
  • use scanbot_sdk package. It's migrated to null safety. It's paid (have a free trial but we can't publish under it). It has many other functionalities also. Here's a reference.
  • Implement using OpenCV by binding to native code using dart:ffi. This is a little tricky. Here's an article for reference. Mainly we'll write C/C++ code within our project and use it in flutter with dart:ffi.

Please let me know which one should I go forward with. Also if you have any other suggestions, please let me know.

I have a codebase based on OpenCV you can use that will push it on another branch. i think the version I m using is stable in that can be used. Let me know I will upload the code if needed

Yes, please upload it. Will look into it.

nicks101 avatar Mar 26 '21 03:03 nicks101

Hey @anushbhatia , for implementing edge detection we following choices.

  • use edge_detection package. The problem with this is it's not active and doesn't have a null safety version. Not customizable also.
  • use opencv package. Problems are the same as above.
  • use scanbot_sdk package. It's migrated to null safety. It's paid (have a free trial but we can't publish under it). It has many other functionalities also. Here's a reference.
  • Implement using OpenCV by binding to native code using dart:ffi. This is a little tricky. Here's an article for reference. Mainly we'll write C/C++ code within our project and use it in flutter with dart:ffi.

Please let me know which one should I go forward with. Also if you have any other suggestions, please let me know.

Is there any way we can make use of a wrapper around the python code of opencv-python or opencv-python-contrib?

So there are two ways that I could find -

  1. Deploy python code (probably flask) and use API in dart.

  2. There's a package starflut which does exactly this. Integrated python code in flutter. Will have to check about null safety version.

These are related links -

How to run the python code in the Flutter app

Python and Dart Integration in Flutter Mobile Application

nicks101 avatar Mar 26 '21 04:03 nicks101

In 2021, we don't use Flask anymore..the defacto choice has become Fastapi. That being said in case you plan to go ahead with the api integration, let me know if you need any assistance

smaranjitghose avatar Mar 27 '21 06:03 smaranjitghose

In 2021, we don't use Flask anymore..the defacto choice has become Fastapi. That being said in case you plan to go ahead with the api integration, let me know if you need any assistance

If I go with making my own API (either with FastApi or flask or any other tech), we'll have to deploy it as well right? Also, the app needs internet then, it won't work offline. There could be some third-party APIs available also.

Just to be clear, this is what we want :

  1. A screen with a camera preview that has two buttons: take a photo and choose an image from the gallery
  2. A screen that appears when an image was taken or chosen that displays the image and renders the detected edges on top
  3. There is a button that lets the user return from the edge screen to the main screen
  4. The UI must not be blocked during edge detection. Instead, the image is shown already and the edges appear once the process is finished

nicks101 avatar Mar 27 '21 07:03 nicks101

https://github.com/smaranjitghose/DocLense/tree/old_code this is the code used before implementing the measuring handles.

anushbhatia avatar Mar 27 '21 20:03 anushbhatia

In 2021, we don't use Flask anymore..the defacto choice has become Fastapi. That being said in case you plan to go ahead with the api integration, let me know if you need any assistance

If I go with making my own API (either with FastApi or flask or any other tech), we'll have to deploy it as well right? Also, the app needs internet then, it won't work offline. There could be some third-party APIs available also.

Just to be clear, this is what we want :

  1. A screen with a camera preview that has two buttons: take a photo and choose an image from the gallery
  2. A screen that appears when an image was taken or chosen that displays the image and renders the detected edges on top
  3. There is a button that lets the user return from the edge screen to the main screen
  4. The UI must not be blocked during edge detection. Instead, the image is shown already and the edges appear once the process is finished

For this, we can do one thing simply

  1. if the user is online then we can provide this feature of the measuring handles.
  2. if the user is offline we can go ahead with the usual method

anushbhatia avatar Mar 27 '21 20:03 anushbhatia