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

Paste image functionality #267

Closed dev-firstlvlpets closed 4 weeks ago

dev-firstlvlpets commented 1 month ago

Hey all,

sorry, I didn't find what I am looking for so I am asking directly here:

What is the dart equivalent for the following python "paste image" code:

large_img[y_offset:y_end,x_offset:x_end] = small_img

rainyl commented 1 month ago

@dev-firstlvlpets Dart has no usable multidimensional array libraries like numpy, so you need to interop Mat and List manually, similar to native c++ operations.

For you question, you can use Mat.copyTo to copy a small Mat to a ROI of larger Mat. refer to https://answers.opencv.org/question/79889/copy-small-part-of-mat-to-another/

EDIT: You can use Mat.fromRange to create a reference of another Mat.

dev-firstlvlpets commented 1 month ago

Ah ok I see. That is a numpy feature.

Thanks for the quick answer 👍 That helps a lot.

Btw thanks for providing OpenCV library for flutter/dart, great work 🥇

rainyl commented 4 weeks ago

Thank you~

If you have no more problems, I am going to close this issue, feel free to reopen it if you still have questions about this 😄