Content-Length: 252923 | pFad | https://github.com/opencv/opencv/issues/27365

52 cv::line() with thickness might take a very long time for pathological huge segments · Issue #27365 · opencv/opencv · GitHub
Skip to content

cv::line() with thickness might take a very long time for pathological huge segments #27365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks done
chacha21 opened this issue May 27, 2025 · 3 comments
Open
4 tasks done

Comments

@chacha21
Copy link
Contributor

chacha21 commented May 27, 2025

System Information

OpenCV 4.12.0

Detailed description

When using cv::line() with a pathological huge segment (the segment points being very far away from the image bounds, but crossing the image anyway), with thickness, FillConvexPoly() will be called.
This FillConvexPoly() will inherit from very distant points and consume a huge amount of (wasted) time.

A solution would be to clip line points within static void ThickLine() (the only trick is to take care of the line width to preserve line caps)

I will submit a PR

Steps to reproduce

cv::Mat src = cv::Mat::zeros(cv::Size(256, 256), CV_8UC3);
cv::Point p1(-1000000000, -1000000000);
cv::Point p2(1000000000, 1000000000);
cv::line(src, p1, p2, cv::Scalar(255, 0, 0, 255), 10);//takes a very long time

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)
@Alokbpandey

This comment has been minimized.

@siya100
Copy link

siya100 commented Jun 2, 2025

hey @chacha21 can you assign this issue to me

@chacha21
Copy link
Contributor Author

chacha21 commented Jun 2, 2025

hey @chacha21 can you assign this issue to me

I have already posted a PR #27366

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/opencv/opencv/issues/27365

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy