Giter Club home page Giter Club logo

Comments (8)

yushulx avatar yushulx commented on June 22, 2024 1

@apoorvpandey For inquiries related to the detection algorithm, please reach out to [email protected].

from flutter-document-scanner.

yushulx avatar yushulx commented on June 22, 2024

@apoorvpandey According to your log, the app crashed in the libDynamsoftImageProcessing.so. Will the app crash if you comment out the document detection method? If the crash is caused by the detection method, could you please provide your camera frame info, such as width and height? It would be better if you can dump the frame data and share it with me for investigating.

from flutter-document-scanner.

yushulx avatar yushulx commented on June 22, 2024

@apoorvpandey A possible workaround is to convert the image data from YUV to RGBA before calling the detection method.

if (format == ImagePixelFormat.IPF_NV21.index) {
            List<Uint8List> planes = [];
            for (int planeIndex = 0; planeIndex < 3; planeIndex++) {
              Uint8List buffer;
              int planeWidth;
              int planeHeight;
              if (planeIndex == 0) {
                planeWidth = width;
                planeHeight = height;
              } else {
                planeWidth = width ~/ 2;
                planeHeight = height ~/ 2;
              }

              buffer = Uint8List(planeWidth * planeHeight);

              int pixelStride = pixelStrides[planeIndex];
              int rowStride = strides[0];
              int index = 0;
              for (int i = 0; i < planeHeight; i++) {
                for (int j = 0; j < planeWidth; j++) {
                  buffer[index++] =
                      bytes[planeIndex][i * rowStride + j * pixelStride];
                }
              }

              planes.add(buffer);
            }

            data = yuv420ToRgba8888(planes, imageWidth, imageHeight);
          }

Then the crash line /lib/arm64/libDynamsoftImageProcessing.so (dynamsoft::DMMatrix::ConvertYUVToRGB(unsigned char const*, int, int, int, int, int, int, dynamsoft::DMMatrix*)+288) (BuildId: 78e13e1d2bad0502e5a91d11f2bf7f593ccfbd8d) won't be triggered.

The frame pixel format for iOS is Rgba8888, not yuv420. Have you encountered the crash issue on iOS?

from flutter-document-scanner.

apoorvpandey avatar apoorvpandey commented on June 22, 2024

Thanks for the solution, not tried it but the edge detection barely works it scans the small edges on a business cards instead of the whole cards. for example if a card has logos with some edges it will detect it first instead of the whole big card

from flutter-document-scanner.

yushulx avatar yushulx commented on June 22, 2024

@apoorvpandey Indeed, the algorithm has potential for further refinement. At present, you can only filter the results based on confidence and quadrilateral size.

from flutter-document-scanner.

apoorvpandey avatar apoorvpandey commented on June 22, 2024

Thanks closing the issue!

from flutter-document-scanner.

yushulx avatar yushulx commented on June 22, 2024

@apoorvpandey I've updated the camera logic for Android to bypass the crash issue. The camera frame of Android will be converted from YUV to RGBA8888 before calling the detection method. You can try it.

from flutter-document-scanner.

apoorvpandey avatar apoorvpandey commented on June 22, 2024

@yushulx Thank you for the update. I will check on it

from flutter-document-scanner.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.