【EI/Scopus检索|2025光学、图像、遥感与通信融合创新大会】7月光学工程、信号处理、模式识别、遥感测绘、光学与通信技术领域国际研讨会来袭!
import numpy as np
import matplotlib.pyplot as plt
def qpsk_mod_demod(symbols, snr_db=20):
"""QPSK调制与相干解调"""
# 调制(映射到星座图)
constellation = {0: 1+1j, 1: -1+1j, 2: -1-1j, 3: 1-1j}
tx_symbols = np.array([constellation[s] for s in symbols])
# 添加高斯噪声(AWGN信道)
noise_var = 10**(-snr_db/10)
noise = np.sqrt(noise_var/2) * (np.random.randn(len(tx_symbols)) + 1j*np.random.randn(len(tx_symbols)))
rx_signal = tx_symbols + noise
# 相干解调(相位恢复)
phase_est = np.angle(np.mean(rx_signal**4)) / 4 # 四阶相位估计
rx_corrected = rx_signal * np.exp(-1j*phase_est)
# 判决
decision = np.zeros(len(symbols), dtype=int)
for i, s in enumerate(rx_corrected):
if s.real > 0:
decision[i] = 0 if s.imag > 0 else 3
else:
decision[i] = 1 if s.imag > 0 else 2
# 可视化
plt.figure(figsize=(10,4))
plt.subplot(121); plt.title("Tx Constellation"); plt.plot(tx_symbols.real, tx_symbols.imag, 'bo')
plt.subplot(122); plt.title("Rx Constellation"); plt.plot(rx_corrected.real, rx_corrected.imag, 'ro')
plt.tight_layout(); plt.show()
return decision
# 测试:100个符号的QPSK传输
symbols = np.random.randint(0, 4, 100)
decoded = qpsk_mod_demod(symbols)
print(f"BER: {np.mean(symbols != decoded):.4f}")
import tensorflow as tf
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.models import Sequential
def build_srcnn():
"""构建SRCNN超分辨率模型"""
model = Sequential([
Conv2D(64, 9, padding='same', activation='relu', input_shape=(None, None, 1)),
Conv2D(32, 1, padding='same', activation='relu'),
Conv2D(1, 5, padding='same', activation='linear')
])
model.compile(optimizer='adam', loss='mse')
return model
def apply_srcnn(model, lr_image):
"""应用超分辨率重建"""
# 预处理:双三次上采样到目标尺寸
hr_shape = (lr_image.shape[0]*2, lr_image.shape[1]*2)
hr_image = tf.image.resize(lr_image, hr_shape, method='bicubic')
# 预测残差并重建
residual = model.predict(hr_image[np.newaxis, ..., np.newaxis])
sr_image = hr_image + residual[0, ..., 0]
return np.clip(sr_image, 0, 1)
# 测试:使用预训练模型(实际应用需训练)
model = build_srcnn()
# model.load_weights('srcnn_weights.h5') # 加载预训练权重
# 示例低分辨率图像 (实际应用中需真实LR图像)
lr_image = np.random.rand(64, 64)
sr_image = apply_srcnn(model, lr_image)
# 可视化
plt.figure(figsize=(10,5))
plt.subplot(121); plt.title("LR Image"); plt.imshow(lr_image, cmap='gray')
plt.subplot(122); plt.title("SR Reconstruction"); plt.imshow(sr_image, cmap='gray')
plt.show()
import numpy as np
from skimage import io, color
def change_detection(img1_path, img2_path, threshold=0.3):
"""变化向量分析(CVA)变化检测"""
# 加载两期影像并转为Lab色彩空间
img1 = io.imread(img1_path)
img2 = io.imread(img2_path)
lab1 = color.rgb2lab(img1)
lab2 = color.rgb2lab(img2)
# 计算变化向量
delta_L = lab2[:,:,0] - lab1[:,:,0]
delta_a = lab2[:,:,1] - lab1[:,:,1]
delta_b = lab2[:,:,2] - lab1[:,:,2]
change_magnitude = np.sqrt(delta_L**2 + delta_a**2 + delta_b**2)
# 归一化并阈值分割
change_magnitude_norm = (change_magnitude - np.min(change_magnitude)) / (np.max(change_magnitude) - np.min(change_magnitude))
change_mask = change_magnitude_norm > threshold
# 可视化
plt.figure(figsize=(15,5))
plt.subplot(131); plt.title("Time 1"); plt.imshow(img1)
plt.subplot(132); plt.title("Time 2"); plt.imshow(img2)
plt.subplot(133); plt.title(f"Change Map (Threshold={threshold})"); plt.imshow(change_mask, cmap='gray')
plt.tight_layout(); plt.show()
return change_mask
# 测试:使用示例卫星影像(实际应用需真实影像)
# change_mask = change_detection("satellite_2020.jpg", "satellite_2025.jpg")
import numpy as np
from scipy.fft import fft, ifft
def dispersion_compensation(signal, length_km, dispersion_param=17, wavelength=1550e-9):
"""
光纤色散频域补偿
signal: 输入信号 (时域)
length_km: 光纤长度 (km)
dispersion_param: 色散参数 (ps/nm/km)
wavelength: 工作波长 (m)
"""
# 参数计算
c = 3e8 # 光速
dwl = 0.1e-9 # 波长变化范围
beta2 = -(wavelength**2 * dispersion_param * 1e-6) / (2*np.pi*c) # 色散系数
# 频域响应
N = len(signal)
omega = 2*np.pi * np.fft.fftfreq(N) * 1e12 # 角频率 (rad/ps)
H = np.exp(-1j * beta2 * length_km * 1e3 * omega**2 / 2) # 色散传递函数
# 频域补偿
signal_fd = fft(signal)
compensated_fd = signal_fd * np.conj(H) # 应用逆滤波器
compensated_td = ifft(compensated_fd)
return np.real(compensated_td)
# 测试:生成带色散的光脉冲
t = np.linspace(-10, 10, 1000)
pulse = np.exp(-t**2/2) * np.exp(1j*2*np.pi*5*t) # 高斯脉冲
dispersed = dispersion_compensation(pulse, length_km=100, dispersion_param=17)
compensated = dispersion_compensation(dispersed, length_km=100, dispersion_param=17)
# 可视化
plt.figure(figsize=(10,5))
plt.plot(t, np.abs(pulse), 'b-', label="Original")
plt.plot(t, np.abs(dispersed), 'r--', label="Dispersed")
plt.plot(t, np.abs(compensated), 'g-.', label="Compensated")
plt.legend(); plt.title("Optical Dispersion Compensation"); plt.xlabel("Time (ps)"); plt.ylabel("Amplitude")
plt.show()