def spiht_image_pack(img, wavename, level, bpp, mode = "bi.orth", delta = 0.01, display_progress = True, str_pr = "", d = {}, handle = True): if not isinstance(img,tuple): img = (img) bpp = (bpp) ch_stream = { "size": 0, "channels":len(img), "bpp":bpp, "quant_delta":delta, "wave_type": wavename, "mode":mode, "decomp_level":level, "wise_bit":[], "payload":[] } for i in range(len(img)): m = np.asarray(img[i]) if mode == "bi.orth": if wavename == "cdf97": w = lwt.cdf97(m,level,False) elif wavename == "cdf53": w = lwt.cdf53(m,level,False) else: w = dwt.dwt2(m,wavename,mode, level) stream = spiht_pack(w,bpp[i],delta,display_progress,str_pr + "[channel "+str(i)+"]",d,handle) ch_stream["payload"] += stream["payload"] ch_stream["wave_type"] = w.name ch_stream["size"] += stream["size"] ch_stream["wise_bit"] += [stream["wise_bit"]] ch_stream["rows"] = stream["rows"] ch_stream["cols"] = stream["cols"] ch_stream["test_data"] = stream["test_data"] return ch_stream
def fvht_image_pack(img, wavename, level, f_center, Lbpp, lbpp, alpha, c, gamma, mode = "bi.orth", delta = 0.01, display_progress = True, str_pr = "", d = {}, handle = True): if not isinstance(img,tuple): img = (img) ch_stream = { "size": 0, "channels":len(img), "bpp":Lbpp, "quant_delta":delta, "wave_type": wavename, "mode":mode, "decomp_level":level, "wise_bit":[], "Lbpp": Lbpp, "lbpp": lbpp, "alpha": alpha, "c": c, "gamma": gamma, "fovea_center": f_center, "payload":[] } for i in range(len(img)): m = np.asarray(img[i]) if mode == "bi.orth": if wavename == "cdf97": w = lwt.cdf97(m,level,False) elif wavename == "cdf53": w = lwt.cdf53(m,level,False) else: w = dwt.dwt2(m,wavename,level,mode) stream = fvht_pack(w, f_center, Lbpp, lbpp, alpha, c, gamma, delta, display_progress,str_pr + "[channel "+str(i)+"]",d,handle) ch_stream["payload"] += stream["payload"] ch_stream["wave_type"] = w.name ch_stream["size"] += stream["size"] ch_stream["wise_bit"] += [stream["wise_bit"]] ch_stream["rows"] = stream["rows"] ch_stream["cols"] = stream["cols"] ch_stream["bits"] = stream["bits"] ch_stream["test_data"] = stream["test_data"] return ch_stream