sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] Pic2Shape - v1.1a - 20 Mar 25 (Image Contouring)

    Scheduled Pinned Locked Moved Plugins
    19 Posts 8 Posters 379 Views 9 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • TIGT Offline
      TIG Moderator
      last edited by TIG

      This is worthy successor to my oldie ImageTrimmer - much faster and with better in-built toolset...
      Can't wait to try it !

      TIG

      1 Reply Last reply Reply Quote 0
      • fredo6F Offline
        fredo6
        last edited by

        Thanks TIG... Now released

        1 Reply Last reply Reply Quote 2
        • Dave RD Offline
          Dave R
          last edited by

          Very cool! Thank you sir!

          Etaoin Shrdlu

          %

          (THERE'S NO PLACE LIKE)

          G28 X0.0 Y0.0 Z0.0

          M30

          %

          1 Reply Last reply Reply Quote 0
          • R Offline
            rv1974
            last edited by

            There's a serious problem (based on what I saw in YT video) with jaggedness. the plugin needs some contour refining\smoothing\straightening engine.

            1 Reply Last reply Reply Quote 0
            • fredo6F Offline
              fredo6
              last edited by

              You can do smoothing of curves afterwards, with dedicated tools. It's difficult to do it appropriately when extracting contours from the image, because there are too many situations.

              And of course, without the plugin, you can always draw over the image with arcs, splines and lines....

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by TIG

                Feel free to cannibalize parts of my ImageTrimmer, which smooths jaggedness...

                You pass the edges' collected vertex points, and set an epsilon factor... thus.

                      ### epsilon is a float perhaps < 0.2 
                      ### perhaps it's set by the user ? experiment for best default...
                      ### the vertices are collected from the current outline[s]
                      points = vertices.collect{|v| v.position }
                      simplified_curve = douglas_peucker(points, epsilon) ### might return []
                      simplified_curve << simplified_curve[0] if simplified_curve[0]  ### so it 'loops'
                      edges = some_entities.add_curve(simplified_curve) if simplified_curve[0]
                      ### sort out edges' faces, hide edges etc as desired
                

                the 'douglas_peucker()' method is this...

                  ### http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
                  ### http://en.wiki.mcneel.com/default.aspx/McNeel/
                                                        PolylineSimplification.html
                  ###
                  def douglas_peucker(points, epsilon)
                    ###
                    return points if points.length < 3
                    ### Find the point with the maximum distance
                    dmax = 0
                    index = 0
                    line = [points.first,  points.last]
                    1.upto(points.length - 2) { |i|
                       d = points[i].distance_to_line(line)
                       if d > dmax
                         index = i
                         dmax = d
                       end
                    }
                    ### If max distance is greater than epsilon, recursively simplify
                    result = []
                    if dmax >= epsilon
                      ### Recursive call
                      recResults1 = ImageTrimmer.douglas_peucker(points[0..index], epsilon)
                      recResults2 = ImageTrimmer.douglas_peucker(points[index...points.length], epsilon)
                      ### Build the result list
                      result = recResults1[0...-1] + recResults2
                    else
                      result = [points.first, points.last]
                    end#if
                    ###
                    return result
                    ###
                  end #def
                

                TIG

                1 Reply Last reply Reply Quote 0
                • fredo6F Offline
                  fredo6
                  last edited by fredo6

                  Thanks TIG.
                  Pic2Shape already includes a simplify method, more sophisticated that the Douglas Peucker algorithm.
                  The real issue is that the smooting is a matter of mixing local and global scale, but also boundaries of pixels, which itself is not always clean.

                  image.png

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    rv1974
                    last edited by

                    it'd be interesting to process this fence in free inkscape for comparison

                    1 Reply Last reply Reply Quote 0
                    • fredo6F Offline
                      fredo6
                      last edited by

                      Please do it and report.

                      DXF conversion is likely to give better results.

                      1 Reply Last reply Reply Quote 0
                      • kimgaK Offline
                        kimga
                        last edited by

                        I was about to try this extension out - using SketchUp 2025 Pro, but the extension doesn’t seem to process the image. Image size 155x50 mm / 300 pixel/inch.

                        After 10 minutes still at Initialization…

                        Is there any guideline on max/ recommended picture size?

                        I tried it with a smaller resolution image, but I still can not get through Initialization....

                        Thank you
                        pic2shape.jpg

                        1 Reply Last reply Reply Quote 0
                        • kimgaK Offline
                          kimga
                          last edited by kimga

                          update: I succeeded with the plugin, when I opened the image in a new file.

                          The original image was on a bent plane. I suppose that was the problem…

                          pic2shape 2.jpg

                          R N 2 Replies Last reply Reply Quote 0
                          • R Offline
                            rv1974 @kimga
                            last edited by TIG

                            @kimga Are you going to to have trees with this amount of edges per leaf ) ?

                            1 Reply Last reply Reply Quote 1
                            • N Offline
                              nasmrtcz @kimga
                              last edited by

                              @kimga @TIG Hi. I also have this issue. It works really great in the picture, but after applying it on a textured face, it freezes like the leaf.

                              1 Reply Last reply Reply Quote 0
                              • fredo6F Offline
                                fredo6
                                last edited by

                                Do you have the model for me to explore the issue.

                                1 Reply Last reply Reply Quote 0
                                • S Offline
                                  schramdesigns
                                  last edited by

                                  I installed Fredo6 Pic2Shape but can not find it anywhere to use it. What gives?

                                  Rich O BrienR 1 Reply Last reply Reply Quote 0
                                  • Rich O BrienR Online
                                    Rich O Brien Moderator @schramdesigns
                                    last edited by

                                    @schramdesigns Have you met the requirements in the top post?

                                    Download the free D'oh Book for SketchUp 📖

                                    1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      schramdesigns
                                      last edited by

                                      I installed this and cant find it to use it.

                                      1 Reply Last reply Reply Quote 0
                                      • Rich O BrienR Online
                                        Rich O Brien Moderator
                                        last edited by

                                        That suggests you either haven't installed Libfredo or you have not restarted SketchUp. But since you are omitting lots of info to help us understand fully its hard to say.

                                        Download the free D'oh Book for SketchUp 📖

                                        1 Reply Last reply Reply Quote 0
                                        • 1 / 1
                                        • First post
                                          Last post
                                        Buy SketchPlus
                                        Buy SUbD
                                        Buy WrapR
                                        Buy eBook
                                        Buy Modelur
                                        Buy Vertex Tools
                                        Buy SketchCuisine
                                        Buy FormFonts

                                        Advertisement