Loading ...
Sorry, an error occurred while loading the content.
 

Autotrace speckle reduction

Expand Messages
  • David A. Bartold
    Hi! I noticed Autotrace kinda sorta traces truecolor images-- you can quantize an image to a limited palette and that works great for line art, but not so
    Message 1 of 9 , Aug 12, 2001
      Hi! I noticed Autotrace kinda sorta traces truecolor images-- you can
      quantize an image to a limited palette and that works great for line art,
      but not so great for photos. Quantization leaves behind a bunch of small
      regions and singleton pixels. I have code (about 5k) that takes an 8bit
      paletted image and removes all the pixel islands. If you feed it a
      quantized photograph, it spits out a clip-arty looking 8bit image. I
      don't know what all would be required to integrate it into Autotrace,
      other than adding another parameter. Any interest?

      - David
    • Martin Weber
      Yes I am very interested and will test it. Thanks Martin ... -- Aufgepasst - jetzt viele 1&1 New WebHosting Pakete ohne Einrichtungsgebuehr + 1 Monat
      Message 2 of 9 , Aug 12, 2001
        Yes I am very interested and will test it.

        Thanks
        Martin

        > Hi! I noticed Autotrace kinda sorta traces truecolor images-- you can
        > quantize an image to a limited palette and that works great for line art,
        > but not so great for photos. Quantization leaves behind a bunch of small
        > regions and singleton pixels. I have code (about 5k) that takes an 8bit
        > paletted image and removes all the pixel islands. If you feed it a
        > quantized photograph, it spits out a clip-arty looking 8bit image. I
        > don't know what all would be required to integrate it into Autotrace,
        > other than adding another parameter. Any interest?
        >
        > - David
        >
        >
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >

        --
        Aufgepasst - jetzt viele 1&1 New WebHosting Pakete ohne
        Einrichtungsgebuehr + 1 Monat Grundgebuehrbefreiung!
        http://puretec.de/index.html?ac=OM.PU.PU003K00736T0492a
      • David A. Bartold
        Ok, here s the test code. It needs glib but only for its typedefs and g_new/g_free. To use: save a truecolor image as in.bmp in the same directory as the
        Message 3 of 9 , Aug 12, 2001
          Ok, here's the test code. It needs glib but only for its typedefs and
          g_new/g_free. To use: save a truecolor image as in.bmp in the same
          directory as the executable. Run program, it will generate an 8 bit
          quantized image saved as quantized.bmp and then save the despeckled image
          as despeckled.bmp. The quantization is pretty cheesy-- the algorithm in
          autotrace is probably much better. You may then try to trace the
          despeckled image just to see what the final ouput looks like. There
          are some constants in main (), two of which control the algorithm, the
          other one controls the quantization. Those two constants are good
          parameters to expose to the user.

          The algorithm works by recoloring small features with the most similar
          color of all its neighboring pixels, effectively coalescing the feature
          with one or more of its neighbors. Multiple passes are made to combine
          singleton pixels into groups of two, then the groups of two to fours, then
          fours to eights, etc. Turning on adaptive feature coalescing prevents
          complementary colors from merging thus causing missing features in the
          output image. The algorithm seems to produce results comparable
          to traced photographs produced by other programs.

          - David

          On Sun, 12 Aug 2001, Martin Weber wrote:

          > Yes I am very interested and will test it.
          >
          > Thanks
          > Martin
        • David A. Bartold
          I cooked up a 24-bit version of the code. It doesn t require color quantization and produces output similar to the 8 bit version of the code. I don t know
          Message 4 of 9 , Aug 13, 2001
            I cooked up a 24-bit version of the code. It doesn't require color
            quantization and produces output similar to the 8 bit version of the code.
            I don't know which bit depth autotrace prefers, so this may or may not be
            useful.

            - David
          • David A. Bartold
            Ok, I figured out that 8bit bitmaps in autotrace are greyscale and the 24bit ones are used for all color images. Here s despeckle.c written to autotrace s
            Message 5 of 9 , Aug 14, 2001
              Ok, I figured out that 8bit bitmaps in autotrace are greyscale and the
              24bit ones are used for all color images. Here's despeckle.c written to
              autotrace's types. It provides the function:

              void
              despeckle (/* in/out */ bitmap_type *bitmap,
              /* in */ int level,
              /* in */ int tightness)

              which accepts both greyscale and color bitmaps (planes = 1 or 3)
            • Masatake YAMATO
              ... How do you think that you have write-access to our CVS repository at sourceforge.net? It seems that autotrace developers who have write-access are so
              Message 6 of 9 , Sep 3, 2001
                > Ok, I figured out that 8bit bitmaps in autotrace are greyscale and the
                > 24bit ones are used for all color images. Here's despeckle.c written to
                > autotrace's types. It provides the function:
                > ...

                How do you think that you have write-access to our CVS repository at
                sourceforge.net? It seems that autotrace developers who have
                write-access are so busy. Therefore none can review your code.


                Masatake YAMATO
              • Martin Weber
                Sorry, I wanted to test the code, but was too busy, perhaps I ll check it next weekend. Martin ... -- GMX - Die Kommunikationsplattform im Internet.
                Message 7 of 9 , Sep 3, 2001
                  Sorry, I wanted to test the code, but was too busy, perhaps I'll check it
                  next weekend.

                  Martin

                  > > Ok, I figured out that 8bit bitmaps in autotrace are greyscale and the
                  > > 24bit ones are used for all color images. Here's despeckle.c written to
                  > > autotrace's types. It provides the function:
                  > > ...
                  >
                  > How do you think that you have write-access to our CVS repository at
                  > sourceforge.net? It seems that autotrace developers who have
                  > write-access are so busy. Therefore none can review your code.
                  >
                  >
                  > Masatake YAMATO
                  >
                  >
                  >
                  >
                  > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                  >
                  >

                  --
                  GMX - Die Kommunikationsplattform im Internet.
                  http://www.gmx.net
                • Martin Weber
                  It is a very good program. I will add it to AutoTrace, but first we could think about how to improve t a bit. 1. Certain parts of text will disappear. What can
                  Message 8 of 9 , Sep 10, 2001
                    It is a very good program. I will add it to AutoTrace, but first we
                    could
                    think about how to improve t a bit.
                    1. Certain parts of text will disappear. What can we do here? (text.bmp)
                    2. I found that adaptive_feature_coalescing = 0 messes the whole picture
                    up.
                    Only 1 and 2 were useful. 3-8 gave the same results for me than 2. Any
                    pictures where this gives different results?
                    3. Have we realy to do a color quantization or couldn't we despeckle a
                    high
                    color image directly.
                    4. Speed up.
                    An other thing that will be added to the next AutoTrace version would be
                    an
                    adoption to pstoedit 3.30.

                    Martin

                    "David A. Bartold" schrieb:

                    > Ok, here's the test code. It needs glib but only for its typedefs and
                    > g_new/g_free. To use: save a truecolor image as in.bmp in the same
                    > directory as the executable. Run program, it will generate an 8 bit
                    > quantized image saved as quantized.bmp and then save the despeckled image
                    > as despeckled.bmp. The quantization is pretty cheesy-- the algorithm in
                    > autotrace is probably much better. You may then try to trace the
                    > despeckled image just to see what the final ouput looks like. There
                    > are some constants in main (), two of which control the algorithm, the
                    > other one controls the quantization. Those two constants are good
                    > parameters to expose to the user.
                    >
                    > The algorithm works by recoloring small features with the most similar
                    > color of all its neighboring pixels, effectively coalescing the feature
                    > with one or more of its neighbors. Multiple passes are made to combine
                    > singleton pixels into groups of two, then the groups of two to fours, then
                    > fours to eights, etc. Turning on adaptive feature coalescing prevents
                    > complementary colors from merging thus causing missing features in the
                    > output image. The algorithm seems to produce results comparable
                    > to traced photographs produced by other programs.
                    >
                    > - David
                    >
                    > On Sun, 12 Aug 2001, Martin Weber wrote:
                    >
                    > > Yes I am very interested and will test it.
                    > >
                    > > Thanks
                    > > Martin
                    >
                    >
                    >
                    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                    >
                    > ------------------------------------------------------------------------
                    > Name: despeckle.tgz
                    > despeckle.tgz Type: WinZip File (application/x-compressed)
                    > Encoding: BASE64
                    > Description: despeckle.tgz
                  • David A. Bartold
                    Hello, I apologize for not replying sooner.. I haven t had any free time at all the past weeks. ... This sounds like a problem you fixed below about the lines
                    Message 9 of 9 , Sep 12, 2001
                      Hello, I apologize for not replying sooner.. I haven't had any free time
                      at all the past weeks.

                      On Mon, 10 Sep 2001, Martin Weber wrote:

                      > It is a very good program. I will add it to AutoTrace, but first we
                      > could think about how to improve t a bit.
                      > 1. Certain parts of text will disappear. What can we do here? (text.bmp)

                      This sounds like a problem you fixed below about the lines disappearing?

                      > 2. I found that adaptive_feature_coalescing = 0 messes the whole picture
                      > up.

                      Yes, well, technically the way the algorithm works is: Assuming the
                      adaptive feature coalescing is off (i.e. 0), the despeckle level
                      determines the smallest possible feature size remaining on the image after
                      running it through the despeckle function. A level of 0 means 1 pixel
                      minimum size, 1 means 2 pixels, 2 means 4 pixels, etc. The adaptive
                      parameter allows small features to remain depending on 1: the adaptive
                      coalescing parameter, 2: the contrast with the neighbor with closest
                      color, and 3: the current iteration. So if you supply zero as the
                      parameter's value and despeckle at a level of 5, the smallest pixel region
                      is 2^5 pixels.

                      There is one feature the algorithm lacks: when features are recolored they
                      get the same value as the color of the closest neighbor. A better way
                      would be compute a color average.

                      > Only 1 and 2 were useful. 3-8 gave the same results for me than 2. Any
                      > pictures where this gives different results?

                      I've noticed that too: being able to specify fractions for lower values
                      is essential because the parameter contributes a 1/x coefficent in
                      determining the error threshold. It would be nice if the adaptive
                      parameter made a linear difference.

                      > 3. Have we realy to do a color quantization or couldn't we despeckle a
                      > high
                      > color image directly.

                      No color quantization is needed.

                      > I did some small modifications of the despeckle program. Please test it.

                      I will try it out.

                      > 1. By exchanging <= with < I removed the problem that thin nonvertical
                      > or nonhorizontal lines disappeared.

                      This is a definitely a bug.

                      > 2. Changed the coalescence parameter from gint to gdouble.
                      > 3. Changed the default value of the coalescence parameter from 2 to 1.0.

                      Cool.

                      > Any other possibilities to improve? Also a speedup is necessary.

                      Efficency improvements are good. For improving the algorithm, see above
                      about color averaging, but it will likely decrease speed.

                      - Davdi
                    Your message has been successfully submitted and would be delivered to recipients shortly.