목록Wireless Comm. (94)
UOMOP
import cv2 import math import time import random import numpy as np from PIL import Image from numpy import sqrt from tqdm import trange import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler import torch import torchvision from torchvision import transforms import torch.nn.functional as F import torch.nn as nn import torch.optim as optim from torchvision import transfo..
def PSNR(ori_img, con_img): max_pixel = 255.0 mse = np.mean((ori_img - con_img)**2) if mse ==0: return 100 psnr = 20* math.log10(max_pixel / math.sqrt(mse)) return round(psnr, 2) def img2bit(path): gray_bit = list() img_gray = cv2.imread(path, cv2.IMREAD_GRAYSCALE) img_gray_flat = img_gray.flatten() for i in range(len(img_gray_flat)): gray_bit.append(format(img_gray_flat[i], 'b').zfill(8)) gray_..
import cv2 import math import time import random import graycode import numpy as np from PIL import Image from numpy import sqrt from tqdm import trange 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) ..
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 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_..