rainyl / opencv_dart

OpenCV bindings for Dart language and Flutter. Support Asynchronous Now!
https://pub.dev/packages/opencv_dart
Apache License 2.0
136 stars 18 forks source link

Regarding FloodFill #235

Closed Marlenfranto closed 2 months ago

Marlenfranto commented 2 months ago

I have an OpenCV-based Android application that allows users to change the color of an image where they touch. We are currently exploring the possibility of migrating this functionality to Flutter, but I couldn't find the floodFill function in Flutter's OpenCV support.

Is there any alternative method or approach to achieve similar functionality in Flutter?

Below is the Android code for reference.

` for (int i = 0; i < points.size(); i++) {

        Point seedPoint = new Point(points.get(i).x * ((double) bitmap.getWidth() / (double) width), points.get(i).y * ((double) bitmap.getHeight() / (double) height));

        int floodFillFlag = 8;
        Imgproc.floodFill(mRgbMat, cannyMat, seedPoint, new Scalar((double) Color.red(mDefaultColor), (double) Color.green(mDefaultColor), (double) Color.blue(mDefaultColor)), new Rect(), new Scalar(5.0, 5.0, 5.0), new Scalar(5.0, 5.0, 5.0), floodFillFlag);
    }`
rainyl commented 2 months ago

Oh it's not implemented.

@Marlenfranto I can add it, do you need other unimplemented functions, so I can add them all.

Marlenfranto commented 2 months ago

@rainyl , at the moment, I specifically need the floodFill function, as all other image processing functions are working perfectly in my project.

Thank you in advance for your assistance!

rainyl commented 2 months ago

@Marlenfranto Get it, I will add it later.

rainyl commented 2 months ago

I have added cv.floodFill and cv.floodFillAsync, check the example in test. https://github.com/rainyl/opencv_dart/blob/1167883aed2b425b6792bfd62ca9eea702e55493/test/imgproc/imgproc_test.dart#L288-L311

image

rainyl commented 2 months ago

@Marlenfranto BTW, this will be included in the next release, now you can update the dependency of opencv_dart to:

  opencv_dart:
    git:
      url: https://github.com/rainyl/opencv_dart.git
      ref: 1167883

to use it for now.

And if you find any bugs, please open new issues.