• Simplifying wiggly paths

    From Malcolm McLean@21:1/5 to All on Tue Dec 6 02:52:32 2022
    I'm working on a problem where a user enters a degraded, wiggly curve (it's actually created by tracing software from what might have been once a rectangle, for example, but has been physically printed, then scanned, and so on, so that there are plenty
    of stray pixels picked up by the tracing software).

    So basically what I want to do is sample the curve at a fairly low resolution, then re-fit it, to get rid of the noise. However I want to retain the genuine sharp corners. So in the rectangle case, the desired output wouldn't be a mathematical rectangle,
    but it would be four clean almost straight curves, connected by four corners of almost ninety degreees.

    The curve tends to go back on itself. It's like a coastline. It's easy to pick out the real curve from the noise by eye, but harder to do it automatically.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul N@21:1/5 to Malcolm McLean on Tue Dec 6 05:04:10 2022
    On Tuesday, December 6, 2022 at 10:52:35 AM UTC, Malcolm McLean wrote:
    I'm working on a problem where a user enters a degraded, wiggly curve (it's actually created by tracing software from what might have been once a rectangle, for example, but has been physically printed, then scanned, and so on, so that there are plenty
    of stray pixels picked up by the tracing software).

    So basically what I want to do is sample the curve at a fairly low resolution, then re-fit it, to get rid of the noise. However I want to retain the genuine sharp corners. So in the rectangle case, the desired output wouldn't be a mathematical
    rectangle, but it would be four clean almost straight curves, connected by four corners of almost ninety degreees.

    The curve tends to go back on itself. It's like a coastline. It's easy to pick out the real curve from the noise by eye, but harder to do it automatically.

    Would it help to assume that if the "curve" is close enough to a straight line, then it is meant to be one, and choose the best straight line that fits?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Malcolm McLean@21:1/5 to Paul N on Tue Dec 6 06:50:29 2022
    On Tuesday, 6 December 2022 at 13:04:13 UTC, Paul N wrote:
    On Tuesday, December 6, 2022 at 10:52:35 AM UTC, Malcolm McLean wrote:
    I'm working on a problem where a user enters a degraded, wiggly curve (it's actually created by tracing software from what might have been once a rectangle, for example, but has been physically printed, then scanned, and so on, so that there are
    plenty of stray pixels picked up by the tracing software).

    So basically what I want to do is sample the curve at a fairly low resolution, then re-fit it, to get rid of the noise. However I want to retain the genuine sharp corners. So in the rectangle case, the desired output wouldn't be a mathematical
    rectangle, but it would be four clean almost straight curves, connected by four corners of almost ninety degreees.

    The curve tends to go back on itself. It's like a coastline. It's easy to pick out the real curve from the noise by eye, but harder to do it automatically.
    Would it help to assume that if the "curve" is close enough to a straight line, then it is meant to be one, and choose the best straight line that fits?

    That's part of the idea. However the underlying shapes might not have straight lines.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Malcolm McLean on Sun Dec 11 23:49:31 2022
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    I'm working on a problem where a user enters a degraded, wiggly curve
    (it's actually created by tracing software from what might have been
    once a rectangle, for example, but has been physically printed, then
    scanned, and so on, so that there are plenty of stray pixels picked up
    by the tracing software).

    So basically what I want to do is sample the curve at a fairly low resolution, then re-fit it, to get rid of the noise. However I want to
    retain the genuine sharp corners. So in the rectangle case, the
    desired output wouldn't be a mathematical rectangle, but it would be
    four clean almost straight curves, connected by four corners of almost
    ninety degreees.

    The curve tends to go back on itself. It's like a coastline. It's easy
    to pick out the real curve from the noise by eye, but harder to do it automatically.

    How is this going? I can't help, but I was hoping so see some
    interesting discussion as it seems both challenging and likely to have
    been solved before (though possibly with constraints that don't match
    your circumstances).

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Malcolm McLean@21:1/5 to Ben Bacarisse on Mon Dec 12 04:34:28 2022
    On Sunday, 11 December 2022 at 23:49:36 UTC, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.ar...@gmail.com> writes:

    I'm working on a problem where a user enters a degraded, wiggly curve
    (it's actually created by tracing software from what might have been
    once a rectangle, for example, but has been physically printed, then scanned, and so on, so that there are plenty of stray pixels picked up
    by the tracing software).

    So basically what I want to do is sample the curve at a fairly low resolution, then re-fit it, to get rid of the noise. However I want to retain the genuine sharp corners. So in the rectangle case, the
    desired output wouldn't be a mathematical rectangle, but it would be
    four clean almost straight curves, connected by four corners of almost ninety degreees.

    The curve tends to go back on itself. It's like a coastline. It's easy
    to pick out the real curve from the noise by eye, but harder to do it automatically.
    How is this going? I can't help, but I was hoping so see some
    interesting discussion as it seems both challenging and likely to have
    been solved before (though possibly with constraints that don't match
    your circumstances).

    I got an artist to draw up a test set for me.

    The core of it is a function called "GetRealCorners", which takes a Bezier path,
    and returns the real corners. A Bezier path has a corner if the two handles at a knot point don't form a straight line. But a mathematical corner could represent
    either a real corner in the underlying image, or local noise.

    So what I am doing is taking ten pixels in curve space on each side of the corner.
    If either the leading or the trailing sample isn't at least three times a long as it is
    wide, as measured by the bounding box, I say that the corner isn't real. If any of the leading or the trailing curves overhangs the corner, I say the corner isn't
    real. Then I compare the angles of the tangents at the corner point to the vectors
    obtained by going from start to end on the leading and trailing curves. If they are
    not similar enough, I say the corner isn't real. Finally I take the angle between the
    start o fthe leading curve, the corner, and the end of the trailing curve. If it is too
    close to 180 degrees, I say the corner isn't real.

    Having marked the real corners, I sample the curve at fairly coarse intervals, apply a Gaussian filter to smoothing things out and then refit it with a sloppy tolerance factor, which gives me a fairly smooth curve between the corners.

    Whilst it works on the test set, the snag is that I had to fiddle with the parameters
    in an ad hoc way to achieve this.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Malcolm McLean on Mon Dec 12 10:21:16 2022
    On Monday, 12 December 2022 at 13:34:30 UTC+1, Malcolm McLean wrote:

    Whilst it works on the test set, the snag is that I had to fiddle with
    in an ad hoc way to achieve this.

    Next step is Machine Learning (learning the parameters)...

    Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Y V A@21:1/5 to Malcolm McLean on Thu Apr 20 04:31:34 2023
    Hello.....
    Girls, boys, come see:

    ⠀⠀⠀⠀⠀⠀⠀⠀kohtumispaik2.freehostpro.com/a.php ⠀⠀⠀⠀⠀⠀⠀⠀kohtumispaik3.66ghz.com/a.php ⠀⠀⠀⠀⠀⠀⠀⠀kohtumispaik4.medianewsonline.com/a.php ⠀⠀⠀⠀⠀⠀⠀⠀aaaaaaaaaaaaaaaar.medianewsonline.com/firstpage.php ⠀⠀⠀⠀⠀⠀⠀⠀themostconfortabletalkplace.medianewsonline.com/a.php


    I will wait You there patiently, but I may not be all the time there.



    On Tuesday, December 6, 2022 at 12:52:35 PM UTC+2, Malcolm McLean wrote:
    I'm working on a problem where a user enters a degraded, wiggly curve (it's actually created by tracing software from what might have been once a rectangle, for example, but has been physically printed, then scanned, and so on, so that there are plenty
    of stray pixels picked up by the tracing software).

    So basically what I want to do is sample the curve at a fairly low resolution, then re-fit it, to get rid of the noise. However I want to retain the genuine sharp corners. So in the rectangle case, the desired output wouldn't be a mathematical
    rectangle, but it would be four clean almost straight curves, connected by four corners of almost ninety degreees.

    The curve tends to go back on itself. It's like a coastline. It's easy to pick out the real curve from the noise by eye, but harder to do it automatically.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Y V A@21:1/5 to Julio Di Egidio on Thu Apr 20 04:31:50 2023
    Hello.....
    Girls, boys, come see:

    ⠀⠀⠀⠀⠀⠀⠀⠀kohtumispaik2.freehostpro.com/a.php ⠀⠀⠀⠀⠀⠀⠀⠀kohtumispaik3.66ghz.com/a.php ⠀⠀⠀⠀⠀⠀⠀⠀kohtumispaik4.medianewsonline.com/a.php ⠀⠀⠀⠀⠀⠀⠀⠀aaaaaaaaaaaaaaaar.medianewsonline.com/firstpage.php ⠀⠀⠀⠀⠀⠀⠀⠀themostconfortabletalkplace.medianewsonline.com/a.php


    I will wait You there patiently, but I may not be all the time there.



    On Monday, December 12, 2022 at 8:21:18 PM UTC+2, Julio Di Egidio wrote:
    On Monday, 12 December 2022 at 13:34:30 UTC+1, Malcolm McLean wrote:

    Whilst it works on the test set, the snag is that I had to fiddle with
    in an ad hoc way to achieve this.
    Next step is Machine Learning (learning the parameters)...

    Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)