Changeset 2125


Ignore:
Timestamp:
Dec 6, 2007, 11:46:38 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Show the results of serpentine Floyd-Steinberg on a grey 90% image.
  • Fix the 4-0-2 output generation.
Location:
www/study
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • www/study/part3.html

    r2122 r2125  
    220220</p>
    221221
    222 <p> And here are the results of <b>serpentine Floyd-Steinberg</b>. Only a
     222<p> The major problem with Floyd-Steinberg is the <b>worm artifacts</b> it
     223creates. Here is an example of an image made of 90% grey dithered with
     224standard Floyd-Steinberg and with <b>serpentine Floyd-Steinberg</b>. Most
     225of the worm artifacts have disappeared or were highly reduced: </p>
     226
     227<p style="text-align: center;">
     228  <img src="out3-3-1.png" width="256" height="256"
     229       class="inline" alt="Floyd-Steinberg on grey 90%" />
     230  <img src="out3-3-2.png" width="256" height="256"
     231       class="inline" alt="serpentine Floyd-Steinberg on grey 90%" />
     232</p>
     233
     234<p> And here are the results of serpentine Floyd-Steinberg on Lenna. Only a
    223235very close look will show the differences with standard Floyd-Steinberg, but
    224236a few of the artifacts did disappear: </p>
     
    226238<p style="text-align: center;">
    227239  <img src="out3-1-2.png" width="256" height="256"
    228        class="inline" alt="Floyd-Steinberg error diffusion" />
     240       class="inline" alt="serpentine Floyd-Steinberg" />
    229241  <img src="grad3-1-2.png" width="32" height="256"
    230        class="inline" alt="Floyd-Steinberg error diffusion gradient" />
     242       class="inline" alt="serpentine Floyd-Steinberggradient" />
    231243</p>
    232244
  • www/study/study.py

    r2121 r2125  
    4242        dest = Image((w, h), True)
    4343        self.copyTo(dest, (-x, -y))
     44        return dest
     45    def getZoom(self, z):
     46        (w, h) = self.size()
     47        dest = Image((w * z, h * z), True)
     48        for y in range(h):
     49            for x in range(w):
     50                rgb = self.getRgb(x, y)
     51                for j in range(z):
     52                    for i in range(z):
     53                        dest.setRgb(x * z + i, y * z + j, *rgb)
    4454        return dest
    4555
     
    769779    #test3xx(gradient256bw, ERROR_STAR, False).save("grad3-2-9.png")
    770780
     781# Output 3-3-1: Floyd-Steinberg on grey 90%
     782# Output 3-3-2: serpentine Floyd-Steinberg on grey 90%
     783if chapter(3):
     784    tmp = Image((128, 128))
     785    for y in range(128):
     786        for x in range(128):
     787            tmp.setGray(x, y, 0.90)
     788    test3xx(tmp, ERROR_FSTEIN, False).getZoom(2).save("out3-3-1.png")
     789    test3xx(tmp, ERROR_FSTEIN, True).getZoom(2).save("out3-3-2.png")
     790
    771791##############################################################################
    772792if chapter(4):
     
    832852    return dest
    833853
     854if chapter(4):
    834855    test402(lenna256bw, ERROR_FSTEIN, False).save("out4-0-2.png")
    835856    test402(gradient256bw, ERROR_FSTEIN, False).save("grad4-0-2.png")
Note: See TracChangeset for help on using the changeset viewer.