コード例 #1
0
        p6fimage = util.post_process_image(p6image)
        filename = "p6_Masked_Image_" + str(i) + "_" + str(j) + ".jpg"
        snr_p6 = util.signalToNoise(brain, p6fimage)
        print(filename, snr_p6)
        util.saveImage(filename, p6fimage)

glhp = np.array([200, 40, 120, 10])
for k in glhp:
    p7lmask = noise.gaussianLowpassFilter(brain_size, k)
    p7lapplied = util.applyMask(dft_brain, p7lmask)
    p7limage = util.getImage(p7lapplied)
    p7lfimage = util.post_process_image(p7limage)
    filename = "p7_GLP_Masked_Image_" + str(k) + ".jpg"
    util.saveImage(filename, p7lfimage)

    p7hmask = noise.gaussianHighpassFilter(brain_size, k)
    p7happlied = util.applyMask(dft_brain, p7hmask)
    p7himage = util.getImage(p7happlied)
    p7hfimage = util.post_process_image(p7himage)
    filename = "p7_GHP_Masked_Image_" + str(k) + ".jpg"
    util.saveImage(filename, p7hfimage)

noisy = util.loadMatrix("images/noisyimage.npy")
noisy_2 = noisy.real.astype(np.complex128)
noisy_image = util.getImage(noisy_2)
noisyfi = util.post_process_image(noisy_image)
#util.displayImage(noisyfi)
noisy_2_write = util.writableDFT(noisy_2)
#util.displayImage_plt(noisy_2_write)
height_noisy, width_noisy = noisy_2.shape
noisy_size = np.array([height_noisy, width_noisy])
コード例 #2
0
# count = 0
# for cut in cutout:
#     print(cut)
#     mask = isn.gaussianHighpassFilter(mask_size2, cut)
#     a = util.applyMask(img_copy, mask)
#     b = util.writableDFT(a)
#     c = util.normalizeImage(b)
#     d = util.post_process_image(c)
#     count += 1
#     print(count)
#     util.displayImage(d)

nmask_size = (h2, w2)

img_copy = util.getImage(img3)

mask = isn.idealHighpassFilter(nmask_size, 100)
mask1 = isn.idealLowpassFilter(nmask_size, 100)
mask2 = isn.gaussianHighpassFilter(nmask_size, 100)
mask3 = isn.ringLowpassFilter(nmask_size, 100, 10)
mask4 = isn.butterworthHighpassFilter(nmask_size, 50, 2)

masks = (mask, mask1, mask2, mask3, mask4)

count = 0
for mask in masks:
    a = util.applyMask(mask, img_copy)
    count += 1
    print(count)
    util.displayImage(a)
コード例 #3
0
 def test_gaussianHighpassFilter_half_width(self):
     expected = self.setup.getExpectedOutput(self._testMethodName)
     self.actual = noise.gaussianHighpassFilter(self.emptymask, 100)
     self.actual = self.setup.normalizeImage(self.actual)
     self.assertTrue(self.setup.imagesEqual(expected, self.actual))