예제 #1
0
 def backward(self, prefix = "/tmp/", N=5, T=2, K=2):
     _2d_transform = MDWT()
     _2d_level = "LL"*K
     for k in range(K):
         tmp = decomposition.readL(prefix, "000")
         t_transform = MCDWT(tmp.shape) # t_transform = SMCTF(tmp.shape)
         t_transform.backward(prefix + _2d_level, N, T)
         _2d_transform.backward(prefix, N)
         _2d_level = "LL"*k
예제 #2
0
def LHtoBlack(path, N):
    for i in range(N):

        LH, HL, HH = decomposition.readH(path, "{:03d}".format(i))
        LL = decomposition.readL(path, "{:03d}".format(i))

        y = math.ceil(LH.shape[0] / 2)
        x = math.ceil(LH.shape[1] / 2)

        LH[x][y][0] = 255
        LH[x][y][1] = 255
        LH[x][y][2] = 255

        return LL, LH, HL, HH
예제 #3
0
        import weighted_average as predictor
    if args.predictor == 3:
        import left_prediction as predictor
    if args.predictor == 4:
        import right_prediction as predictor
    if args.predictor == 5:
        import left_MC_prediction as predictor
    if args.predictor == 6:
        import right_MC_prediction as predictor
    if args.predictor == 7:
        import offset_prediction as predictor

    if args.backward:
        if __debug__:
            print("Backward transform")

        # The first image is read only for knowing the dimenssions of
        # the images.
        p = decomposition.readL(args.prefix, "000")
        d = MCDWT(p.shape)

        d.backward(args.prefix, args.decompositions, args.iterations)
    else:
        if __debug__:
            print("Forward transform")

        p = decomposition.readL(args.prefix, "000")
        d = MCDWT(p.shape)

        p = d.forward(args.prefix, args.decompositions, args.iterations)
예제 #4
0
    parser.add_argument("-N",
                        help="Number of decompositions",
                        default=5,
                        type=int)

    parser.add_argument("-T",
                        help="Number of temporal levels",
                        default=2,
                        type=int)

    args = parser.parse_args()

    if args.backward:
        if __debug__:
            print("Backward transform")

        p = decomposition.readL("{}000".format(args.mc_decompositions))
        d = MCDWT(p.shape)

        d.backward(args.mc_decompositions, args.decompositions, args.N, args.T)
    else:
        if __debug__:
            print("Forward transform")

        p = decomposition.readL("{}000".format(args.decompositions))
        d = MCDWT(p.shape)

        p = d.forward(args.decompositions, args.mc_decompositions, args.N,
                      args.T)
예제 #5
0
from MDWT import MDWT

sys.path.insert(0, "..")
from src.IO import decomposition
             
'''CALCULAR ENERGIA DE CADA BANDA'''
print("JLL --> {}\n".format('Energia LL/Energia HH'))
print("JHL --> {}\n".format('Energia HL/Energia HH'))
print("JLH --> {}\n\n".format('Energia LH/Energia HH'))

    

'''MODIFICA LA SUBBANDA HH PONIENDOLA EN NEGRO CON UN PUNTO BLANCO EN EL CENTRO'''
    for i in range(args.N):
        LH, HL, HH = decomposition.readH("{}{:03d}".format(args.decompositions, i))
        LL = decomposition.readL("{}{:03d}".format(args.decompositions, i))

        y = math.ceil(HH.shape[0]/2)
        x = math.ceil(HH.shape[1]/2)

        HH = HH * 0
        HH[x][y][0] = 255
        HH[x][y][1] = 255
        HH[x][y][2] = 255

        decomposition.writeH([LH,HL,HH],"{}{:03d}".format(args.decompositions, i))

    '''SE RECONSTRUYE LA IMAGEN Y SE VUELVE A DESCOMPONERLA'''
    d.backward(args.decompositions, '/tmp/recons_MDWT_', args.N)
    d.forward('/tmp/recons_MDWT_', args.decompositions, args.N)