목록Wireless Comm./Python (24)
UOMOP

import cv2 import math import time import random import graycode import numpy as np from PIL import Image from numpy import sqrt import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler from pyldpc import make_ldpc, encode, decode, get_message class For_Image: def image2bit(path): gray_bit = list() img_gray = cv2.imread(path, cv2.IMREAD_GRAYSCALE) img_gray_flat = img_gray..

import cv2 import math import random import graycode import numpy as np from PIL import Image from numpy import sqrt import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler from pyldpc import make_ldpc, encode, decode, get_message def Bit_Gen(how_many): return (np.random.randint(2, size=how_many)).tolist() def BER_Check(list_1, list_2): print(len(list_1)) print(len(list_..
pip install pyldpc pip install graycode import cv2 import math import random import graycode import numpy as np from PIL import Image from numpy import sqrt import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler from pyldpc import make_ldpc, encode, decode, get_message def Bit_Gen(how_many): return (np.random.randint(2, size=how_many)).tolist() def BER_Check(list_1, lis..
class Tx: def Modulation(input_sig, mode): # mode : {M-ASK, M-FSK, M-PSK} if mode[-3] == 'P': M = int(mode[0]) k = int(math.log2(M)) start_phase = np.pi * (1 / M) phase_list = list([start_phase]) phase_step = start_phase * 2 for i in range(int(M / 2) - 1): start_phase = phase_list[i] + phase_step phase_list.append(start_phase) phase_list_rev = list(reversed(phase_list)) for i in range(len(phase_..

def forward_6(input_sig, SNR, mod_mode, rayleigh, chcode_mode): error = 0 if chcode_mode == "LDPC": encoded_sig, redund_bit = Tx.LDPC_Encode(input_sig) elif chcode_mode == "block": block_level = 6 encoded_sig = Tx.block_encode(input_sig, n=block_level) modulated_sig, table_for_demod = Tx.Modulation(input_sig=encoded_sig, mode=mod_mode) if rayleigh == "Yes" : AWGN_input = Fading_Channel.rayleigh(..
def Restore_Image(input, c_or_g): # print("input's len : {}".format(len(input))) if c_or_g == "color": one_step = int(len(input) / 3) channel_1 = input[0:one_step] channel_2 = input[one_step:2 * one_step] channel_3 = input[2 * one_step:len(input)] print("ch_1 len : {}".format(len(channel_1))) print("ch_2 len : {}".format(len(channel_2))) print("ch_3 len : {}".format(len(channel_3))) str_1 = list..