Results 1 to 5 of 5
  1. #1
    tiny is offline Member
    Join Date
    Mar 2010
    Posts
    6
    Rep Power
    0

    Question Skeletonization / thinning issue

    Hi all!
    First : im working on a skeletonized picture

    After skeletonization the lines are "snaky" and not straight.
    My problem:
    1. how to straighten out the lines?
    2. how to remove the small unwanted branches sticking out everywhere?

    Anyone got some ideas for this or know about some good reading on the topic?
    Thanks in advance!

  2. #2
    iluxa is offline Senior Member
    Join Date
    Mar 2010
    Posts
    266
    Rep Power
    5

    Default

    to straighten out the lines, would you can try is have the various points on the line "attract" each other:

    suppose you have a snaky line between x=0 to x=100, so it's a bunch of [x, y] points.

    for every point, calculate something like
    Java Code:
    // let points[] be all points, and index - the current index
    double finalY = (points[index].y + 
        points[index-1].y / 2 + points[index+1]/2 + 
        points[index-2].y / 4 + points[index+2]/4) / 2.5;
    that way, the final position of every point depends on positions of its neighbors, and the line will straighten a bit.

    for your other question, hard to say without looking at the actual image... can you upload the image somewhere and post a link?

  3. #3
    tiny is offline Member
    Join Date
    Mar 2010
    Posts
    6
    Rep Power
    0

    Default

    Hi and thanks for you answer!
    I'm gonna play around with that and see if i can make something out of it.

    I've attached two images:
    Skeletons.jpg which is the binary image produced after several iterations of erosion and skeletonization.
    On skeletons2.jpg i have identified what i'm actually after. So you can see that i have alot of "noise" which i need to get rid of.
    again, many thanks!
    Attached Thumbnails Attached Thumbnails Skeletonization / thinning issue-skeletons.jpg   Skeletonization / thinning issue-skeletons2.jpg  

  4. #4
    iluxa is offline Senior Member
    Join Date
    Mar 2010
    Posts
    266
    Rep Power
    5

    Default

    wow, your images look a lot worse than i thought :)

    you could try to smoothen them a bit - calculate color of each pixel so it takes into account its neighbors (kind of what i was talking about above), then plot it - you'll get shades of gray, darker where the pixels are dense and lighter in other areas - then you could perhaps identify the dark "ridges" and try to make lines out of those... sounds like a hard problem though, good luck!

  5. #5
    tiny is offline Member
    Join Date
    Mar 2010
    Posts
    6
    Rep Power
    0

    Default

    It's not a bad idea. I'm not sure but maybe i could do something like that..
    Thanks alot for your help!

Similar Threads

  1. nio issue
    By mawandiadeepak in forum Networking
    Replies: 2
    Last Post: 03-17-2010, 06:23 AM
  2. JSF issue
    By premjo in forum New To Java
    Replies: 0
    Last Post: 02-14-2010, 03:19 PM
  3. Issue
    By FlashNinja in forum New To Java
    Replies: 20
    Last Post: 11-28-2009, 10:44 PM
  4. PDF Box issue
    By jazz2k8 in forum Advanced Java
    Replies: 0
    Last Post: 03-20-2009, 12:04 PM
  5. Issue
    By chaitu444 in forum New To Java
    Replies: 2
    Last Post: 11-06-2007, 08:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •