0

I am trying to detect a straight line on an image containing a not so straight line using OpenCV python.

For example in this image, we can see there is a somewhat horizontal line.

Raw image

I have tried using Hough lines but only small segments are detected. Do you know how I should proceed for this? Ideally I would have a detected line as follows: detected line

6
  • Which straight line do you want to detect there? The "somewhat straight horizontal line" isnt straight at all. Can you define the requirements and the goal? Maybe show the desired result. Commented May 31, 2022 at 9:14
  • 1
    Try 1. Threshold 2. Use RANSAC line "fitting" Commented May 31, 2022 at 9:32
  • by the way, that polar transform is horribly botched. someone "threw" the points, which is wrong and impossible to "fix up". they need to be "pulled". if you're wondering why there are gaps and noise, that's why. simply use OpenCV's polar warp. that does it right. Commented May 31, 2022 at 11:12
  • @ChristophRackwitz I am not sure I can do it with this function, with the image I have, it is one column per angle Commented May 31, 2022 at 12:28
  • that is precisely what opencv's polar warp is for. perhaps you need to flip/mirror/transpose/rot90 your input... you'll figure it out... or add the source data to your question Commented May 31, 2022 at 22:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.