Пример #1
0
 def initialize_watermaker(self):
     text = self.entry_text.get()
     # Create Watermarker object and pass it text from entry_text
     self.watermarker = Watermarker(text)
Пример #2
0
            print "Minimum JPG quality:", test_jpg(w, out)
            print "Max Gaussian sigma:", test_filter(
                w, out, "gauss-%s.png", gaussian_filter,
                [i / 10.0 for i in range(1, 50)])
            print "Max Laplacian of Gaussian sigma:", test_filter(
                w, out, "log-%s.png", gaussian_laplace,
                [i / 10.0 for i in range(1, 50)])
            print "Max tv-denoising weight:", test_filter(
                w, out, "tv-%s.png", tv_denoise, range(50, 1000, 25))
            print "Max noise ratio: ", test_filter(
                w, out, "noise-%s.png", add_noise,
                [i / 20.0 for i in range(1, 20)])
            print "Max random block coverage: ", test_filter(
                w, out, "blocks-%s.png",
                lambda img, k: add_blocks(img, k, 50, 50),
                [i / 20.0 for i in range(1, 20)])

            for flt in [
                    "contour", "detail", "edge_enhance", "edge_enhance_more",
                    "emboss", "find_edges", "smooth", "smooth_more", "sharpen"
            ]:
                print "Max iterations of %r:" % (flt, ), test_recursive_filter(
                    w, out, "%s-%%s.png" % (flt, ),
                    lambda img: misc.imfilter(img, flt), range(1, 30))
            print


if __name__ == "__main__":
    w = Watermarker(6, 4)
    run_tests(w, "123456", [2, 4, 6, 8])
Пример #3
0
                  type=int,
                  default=6,
                  help="Payload length (default is 6)")
parser.add_option("-e",
                  dest="ecc_length",
                  type=int,
                  default=4,
                  help="ECC length (default is 4)")

if __name__ == "__main__":
    (options, args) = parser.parse_args()
    if len(args) != 2:
        parser.error("Usage: [options] <input image file> <payload>")
    infile, payload = args
    if not options.outfile:
        options.outfile = "%s-%s.png" % (
            os.path.basename(infile).split(".")[0], payload)

    t0 = time.time()
    w = Watermarker(options.payload_length,
                    options.ecc_length,
                    seed=options.seed,
                    mother=options.mother)
    out = w.embed(misc.imread(infile), payload, options.k)
    t1 = time.time()
    if options.tv_weight > 0:
        out = tv_denoise(out, options.tv_weight)

    misc.imsave(options.outfile, out)
    print "Created %s in %s seconds" % (options.outfile, t1 - t0)