opencv_dart icon indicating copy to clipboard operation
opencv_dart copied to clipboard

How to pass floating types, such as `VecPoint2f`, to functions?

Open redcurry opened this issue 8 months ago • 5 comments

Functions such as arcLength take a VecPoint, but there isn't an equivalent arcLength2f that take a VecPoint2f. What's the best way to handle this? I could convert VecPoint2f to VecPoint, but I lose some precision doing that.

redcurry avatar Apr 24 '25 02:04 redcurry

@redcurry Unfortunately this is not supported now, to support it we have to add a new C API and it's dart wrapper.

Is the precision important for your application? If so, I can add it when having some time.

rainyl avatar Apr 24 '25 02:04 rainyl

No, it's not really that important. Just wondering if there was a way to do it now. I'll just convert VecPoint2f to VecPoint. Thanks.

redcurry avatar Apr 24 '25 03:04 redcurry

On second thought, it can impact the accuracy of my application (since it involves measuring), so I'll reopen this issue.

redcurry avatar Apr 26 '25 19:04 redcurry

It's fine to leave it open, but I have no much time recently, so it's unlikely to be solved in a short time.

What functions do you need? I am considering add APIs that take Mat as input so that high precision conditions can be covered.

rainyl avatar Apr 27 '25 01:04 rainyl

No worries, and thank you. At the moment, I need the arcLength function.

Update: I also need the boundingRect function.

redcurry avatar Apr 27 '25 03:04 redcurry

@redcurry more high-precision functions inside imgproc module have been added, they are ended with 2f or 2fAsync, e.g., arcLength2f and arcLength2fAsync, now you can upgrade opencv_core or opencv_dart to v1.4.2 to use them.

If you still have any problems, please open new issues, have fun with opencv_dart!

rainyl avatar Jul 03 '25 07:07 rainyl

Thank you so much!

redcurry avatar Jul 03 '25 13:07 redcurry