第4章 Python 數字圖像處理(DIP) - 頻率域濾波12 - 選擇性濾波 - 帶阻

目錄

    • 選擇性濾波
      • 帶阻濾波器和帶通濾波器
      • 陷波濾波器

選擇性濾波

處理特定的頻帶的濾波器稱為頻帶濾波器

  • 帶阻濾波器

    • 若某個頻帶中的頻率被濾除
  • 帶通濾波器

    • 若某個頻帶中的頻率被通過

處理小頻率矩形區域的濾波器稱為陷波濾波器

  • 陷波帶阻濾波器

    • 若某個頻帶中的頻率被拒絕
  • 陷波帶通濾波器

    • 若某個頻帶中的頻率被通過

帶阻濾波器和帶通濾波器

頻率域中的帶通和帶阻濾波器傳遞函數,可通過組合低通和高通濾波器傳遞函數來構建。然后高通濾波器也是由低通濾波器推導而來,所以說低通濾波器傳遞函數是形成高通、帶阻、帶通濾波器傳遞函數的基礎。

可以由帶阻濾波器傳遞函數獲得帶通濾波器傳遞函數

HBP(u,v)=1?HBR(u,v)(4.148)H_{BP}(u, v) = 1 - H_{BR}(u, v) \tag{4.148}HBP?(u,v)=1?HBR?(u,v)(4.148)

高斯帶阻濾波器傳遞函數

H(u,v)=1?e?[(D(u,v)?C0)2W2](4.149)H(u, v) = 1 - e^{-\big[\frac{(D(u, v) - C_0)^2}{W^2} \ \ \big]} \tag{4.149}H(u,v)=1?e?[W2(D(u,v)?C0?)2???](4.149)

低于C0C_0C0?時,該函數表現為一個低通高斯函數;等于C0C_0C0?時,始終為0;高于C0C_0C0?時,表現為一個高通高斯函數。但該函數在原點關不總是1。可以修改為:

H(u,v)=1?e?[D2(u,v)?C02D(u,v)W]2(4.150)H(u, v) = 1 - e^{-\big[\frac{D^2(u, v) - C_0^2}{D(u, v) W} \ \ \big]^2} \tag{4.150}H(u,v)=1?e?[D(u,v)WD2(u,v)?C02????]2(4.150)

巴特沃斯帶阻濾波器傳遞函數

H(u,v)=11+[D(u,v)WD2(u,v)?C02]2nH(u, v) = \frac{1}{1 + \bigg[\frac{D(u, v) W}{D^2(u, v) - C_0^2} \bigg]^{2n}}H(u,v)=1+[D2(u,v)?C02?D(u,v)W?]2n1?

def idea_band_resistant_filter(source, center, radius=10, w=5):"""create idea band resistant filter param: source: input, source imageparam: center: input, the center of the filter, where is the lowest value, (0, 0) is top left corner, source.shape[:2] is center of the source imageparam: radius: input, int, the radius of circle of the band pass filter, default is 10param: w:      input, int, the width of the band of the filter, default is 5return a [0, 1] value band resistant filter"""    M, N = source.shape[1], source.shape[0]u = np.arange(M)v = np.arange(N)u, v = np.meshgrid(u, v)D = np.sqrt((u - center[1]//2)**2 + (v - center[0]//2)**2)D0 = radiushalf_w = w / 2kernel_1 = D.copy()assert radius > half_w, "radius must greater than W/2"#==================piecewise================kernel = np.piecewise(kernel_1, [kernel_1 <= D0 + half_w, kernel_1 <= D0 - half_w], [1, 0])kernel = 1 - kernel#==================where==================
#     kernel = np.where(kernel_1 > D0 + half_w, 1, kernel_1)
#     kernel = np.where(kernel <= D0 - half_w, 1, kernel)
#     kernel = np.where(kernel != 1, 0, kernel)# =================公式法================
#     kernel_2 = D.copy()
#     kernel_1[D >  D0 + half_w] = 1
#     kernel_1[D <= D0 + half_w] = 0
#     kernel_2[D > D0 - half_w] = 1
#     kernel_2[D <= D0 - half_w] = 0
#     kernel = kernel_1 - kernel_2 return kernel
def gauss_band_resistant_149(source, center, radius=10, w=5):"""create gaussian band resistant filter, equation 4.149param: source: input, source imageparam: center: input, the center of the filter, where is the lowest value, (0, 0) is top left corner, source.shape[:2] is center of the source imageparam: radius: input, int, the radius of circle of the band pass filter, default is 10param: w:      input, int, the width of the band of the filter, default is 5return a [0, 1] value gaussian band resistant filter"""    N, M = source.shape[:2]u = np.arange(M)v = np.arange(N)u, v = np.meshgrid(u, v)D = np.sqrt((u - center[1]//2)**2 + (v - center[0]//2)**2)C0 = radiuskernel = 1 - np.exp(-(D - C0)**2 / (w**2))return kernel
def gauss_band_resistant_filter(source, center, radius=10, w=5):"""create gaussian band resistant filter, equation 4.150param: source: input, source imageparam: center: input, the center of the filter, where is the lowest value, (0, 0) is top left corner, source.shape[:2] is center of the source imageparam: radius: input, int, the radius of circle of the band pass filter, default is 10param: w:      input, int, the width of the band of the filter, default is 5return a [0, 1] value gaussian band resistant filter"""    N, M = source.shape[:2]u = np.arange(M)v = np.arange(N)u, v = np.meshgrid(u, v)D = np.sqrt((u - center[1]//2)**2 + (v - center[0]//2)**2)C0 = radiuskernel = 1 - np.exp(-((D**2 - C0**2) / (D * w))**2)return kernel
def butterworth_band_resistant_filter(source, center, radius=10, w=5, n=1):"""create butterworth band resistant filter, equation 4.150param: source: input, source imageparam: center: input, the center of the filter, where is the lowest value, (0, 0) is top left corner, source.shape[:2] is center of the source imageparam: radius: input, int, the radius of circle of the band pass filter, default is 10param: w:      input, int, the width of the band of the filter, default is 5param: n:      input, int, order of the butter worth fuction, return a [0, 1] value butterworth band resistant filter"""    N, M = source.shape[:2]u = np.arange(M)v = np.arange(N)u, v = np.meshgrid(u, v)D = np.sqrt((u - center[1]//2)**2 + (v - center[0]//2)**2)C0 = radiustemp = (D * w) / (D**2 - C0**2)kernel = 1 / (1 + temp ** (2*n)) return kernel
# 帶阻濾波器傳遞函數
img_temp = np.zeros([1000, 1000])
C0 = 100# 1理想帶阻濾波器
IBRF = idea_band_resistant_filter(img_temp, img_temp.shape, radius=C0, w=100)
hx_i = IBRF[500:, 500].flatten()# 2由高斯低通和高斯高通濾波器函數相加形成的帶阻傳遞函數,最小值不是0,并且與C0不重合
GHPF = gauss_high_pass_filter(img_temp, img_temp.shape, radius=C0)
GLPF = gauss_low_pass_filter(img_temp, img_temp.shape, radius=C0/2)
GLPF = GHPF + GLPF
hx_g = GLPF[500:, 500].flatten()# 3由式4.149得到的,原點處的值不是1
GBRF_149 = gauss_band_resistant_149(img_temp, img_temp.shape, radius=C0, w=100)
hx_g149 = GBRF_149[500:, 500].flatten()# 4由式4.150得到的
GBRF = gauss_band_resistant_filter(img_temp, img_temp.shape, radius=C0, w=100)
hx_gbrf = GBRF[500:, 500].flatten()fig = plt.figure(figsize=(16, 3))
ax_1 = fig.add_subplot(1, 4, 1)
ax_1.plot(hx_i), ax_1.set_yticks([0, 1.0]), ax_1.set_xticks([100, 500]), ax_1.set_ylim(0, 1.1), ax_1.set_xlim(0, 500)ax_2 = fig.add_subplot(1, 4, 2)
ax_2.plot(hx_g), ax_2.set_yticks([0.75, 1.0]), ax_2.set_xticks([100, 500]), ax_2.set_ylim(0.75, 1.1), ax_2.set_xlim(0, 500)ax_3 = fig.add_subplot(1, 4, 3)
ax_3.plot(hx_g149), ax_3.set_yticks([0, 1.0]), ax_3.set_xticks([100, 500]), ax_3.set_ylim(0, 1.1), ax_3.set_xlim(0, 500)ax_3 = fig.add_subplot(1, 4, 4)
ax_3.plot(hx_gbrf), ax_3.set_yticks([0, 1.0]), ax_3.set_xticks([100, 500]), ax_3.set_ylim(0, 1.1), ax_3.set_xlim(0, 500)plt.tight_layout()
plt.show()

在這里插入圖片描述

# 理想、高斯、巴特沃斯帶阻傳遞函數
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import cmimg_temp = np.zeros([512, 512])
center = img_temp.shaperadius = 128
w = 60
IBRF = idea_band_resistant_filter(img_temp, img_temp.shape, radius=radius, w=w)
GBFR = gauss_band_resistant_filter(img_temp, img_temp.shape, radius=radius, w=w)
BBRF = butterworth_band_resistant_filter(img_temp, img_temp.shape, radius=radius, w=w, n=1)filters = ['IBRF', 'GBFR', 'BBRF']
# 用來繪制3D圖
M, N = img_temp.shape[1], img_temp.shape[0]
u = np.arange(M)
v = np.arange(N)
u, v = np.meshgrid(u, v)fig = plt.figure(figsize=(15, 15))for i in range(len(filters)):ax_1 = fig.add_subplot(3, 3, i*3 + 1, projection='3d')plot_3d(ax_1, u, v, eval(filters[i]))ax_2 = fig.add_subplot(3, 3, i*3 + 2)ax_2.imshow(eval(filters[i]),'gray'), ax_2.set_title(filters[i]), ax_2.set_xticks([]), ax_2.set_yticks([])h_1 = eval(filters[i])[img_temp.shape[0]//2:, img_temp.shape[1]//2]ax_3 = fig.add_subplot(3, 3, i*3 + 3)ax_3.plot(h_1), ax_3.set_xticks([0, radius//2]), ax_3.set_yticks([0, 1]), ax_3.set_xlim([0, 320]), ax_3.set_ylim([0, 1.2])
plt.tight_layout()
plt.show()

在這里插入圖片描述

陷波濾波器

陷波濾波器是最有用的選擇性濾波

零相移濾波器必須關于原點(頻率矩形中心)對稱,中以為(u0,v0)(u_0, v_0)(u0?,v0?)的陷波濾波器傳遞函數在(?u0,?v0)(-u_0, -v_0)(?u0?,?v0?)位置必須有一個對應的陷波。陷波帶阻濾波器傳遞函數可用中心被平移到陷波濾波中心的高通濾波器函數的乘積來產生

HNR(u,v)=∏k=1QHk(u,v)H?k(u,v)(4.151)H_{NR}(u, v) = \prod_{k=1}^Q H_k(u, v) H_{-k}(u, v) \tag{4.151}HNR?(u,v)=k=1Q?Hk?(u,v)H?k?(u,v)(4.151)

每個濾波器的距離計算公式為
Dk(u,v)=[(u?M/2?uk)2+(v?N/2?vk)2]1/2(4.152)D_{k}(u, v) = \big[(u - M / 2 - u_{k})^2 + (v - N / 2 - v_{k})^2 \big]^{1/2} \tag{4.152}Dk?(u,v)=[(u?M/2?uk?)2+(v?N/2?vk?)2]1/2(4.152)
D?k(u,v)=[(u?M/2+uk)2+(v?N/2+vk)2]1/2(4.153)D_{-k}(u, v) = \big[(u - M / 2 + u_{k})^2 + (v - N / 2 + v_{k})^2 \big]^{1/2} \tag{4.153}D?k?(u,v)=[(u?M/2+uk?)2+(v?N/2+vk?)2]1/2(4.153)

nnn階巴特沃斯帶陰濾波器
HNR(u,v)=∏k=13[11+[D0k/Dk(u,v)]n][11+[D0k/D?k(u,v)]n](4.154)H_{NR}(u, v) = \prod_{k=1}^3\bigg[ \frac{1}{1 + [D_{0k}/D_{k}(u,v)]^n} \bigg] \bigg[ \frac{1}{1 + [D_{0k}/D_{-k}(u,v)]^n} \bigg] \tag{4.154}HNR?(u,v)=k=13?[1+[D0k?/Dk?(u,v)]n1?][1+[D0k?/D?k?(u,v)]n1?](4.154)

常數D0kD_{0k}D0k?對每對陷波是相同的,但對不同的陷波對,它可以不同。

陷波帶通濾波器傳遞函數可用陷波帶阻濾波器得到
HNP(u,v)=1?HNR(u,v)(4.155)H_{NP}(u, v) = 1 - H_{NR}(u, v) \tag{4.155}HNP?(u,v)=1?HNR?(u,v)(4.155)

def butterworth_notch_resistant_filter(img, uk, vk, radius=10, n=1):"""create butterworth notch resistant filter, equation 4.155param: img:    input, source imageparam: uk:     input, int, center of the heightparam: vk:     input, int, center of the widthparam: radius: input, int, the radius of circle of the band pass filter, default is 10param: w:      input, int, the width of the band of the filter, default is 5param: n:      input, int, order of the butter worth fuction, return a [0, 1] value butterworth band resistant filter"""   M, N = img.shape[1], img.shape[0]u = np.arange(M)v = np.arange(N)u, v = np.meshgrid(u, v)DK = np.sqrt((u - M//2 - uk)**2 + (v - N//2 - vk)**2)D_K = np.sqrt((u - M//2 + uk)**2 + (v - N//2 + vk)**2)D0 = radiuskernel = (1 / (1 + (D0 / (DK+1e-5))**n)) * (1 / (1 + (D0 / (D_K+1e-5))**n))return kernel
# 巴特沃斯帶阻陷波濾波器 BNRF
img_temp = np.zeros([512, 512])
BNF_1 = butterworth_notch_resistant_filter(img_temp, radius=10, uk=30, vk=40, n=3)
BNF_2 = butterworth_notch_resistant_filter(img_temp, radius=10, uk=30, vk=80, n=3)
BNF_3 = butterworth_notch_resistant_filter(img_temp, radius=10, uk=-30, vk=80, n=3)plt.figure(figsize=(16, 12))
plt.subplot(141), plt.imshow(BNF_1, 'gray'), plt.title('BNF_1')
plt.subplot(142), plt.imshow(BNF_2, 'gray'), plt.title('BNF_2')
plt.subplot(143), plt.imshow(BNF_3, 'gray'), plt.title('BNF_3')BNF_dst = BNF_1 * BNF_2 * BNF_3plt.subplot(144), plt.imshow(BNF_dst, 'gray'), plt.title('BNF_dst')plt.tight_layout()
plt.show()

在這里插入圖片描述

# 使用陷波濾波刪除數字化印刷圖像中的莫爾模式
img_ori = cv2.imread("DIP_Figures/DIP3E_Original_Images_CH04/Fig0464(a)(car_75DPI_Moire).tif", 0)M, N = img_ori.shape[:2]# 填充
fp = pad_image(img_ori, mode='reflect')
# 中心化
fp_cen = centralized_2d(fp)
# 正變換
fft = np.fft.fft2(fp_cen)# 頻譜
spectrum = spectrum_fft(fft)
# 對頻譜做對數變換
spectrum_log = np.log(1 + spectrum)# 巴特沃斯陷波帶阻濾波器
BNRF_1 = butterworth_notch_resistant_filter(fp, radius=9, uk=60, vk=80, n=4)
BNRF_2 = butterworth_notch_resistant_filter(fp, radius=9, uk=-60, vk=80, n=4)
BNRF_3 = butterworth_notch_resistant_filter(fp, radius=9, uk=60, vk=160, n=4)
BNRF_4 = butterworth_notch_resistant_filter(fp, radius=9, uk=-60, vk=160, n=4)BNRF = BNRF_1 * BNRF_2 * BNRF_3 * BNRF_4 fft_filter = fft * BNRF# 濾波后的頻譜
spectrum_filter = spectrum_fft(fft_filter)
spectrum_filter_log = np.log(1 + spectrum_filter)# 傅里葉反變換
ifft = np.fft.ifft2(fft_filter)# 去中心化反變換的圖像,并取左上角的圖像
img_new = centralized_2d(ifft.real)[:M, :N]
img_new = np.clip(img_new, 0, img_new.max())
img_new = np.uint8(normalize(img_new) * 255)fig = plt.figure(figsize=(10, 14))ax_1 = fig.add_subplot(2, 2, 1)
ax_1.imshow(img_ori, 'gray'), ax_1.set_title('Original'), ax_1.set_xticks([]), ax_1.set_yticks([])ax_2 = fig.add_subplot(2, 2, 2)
ax_2.imshow(spectrum_log, 'gray'), ax_2.set_title('Spectrum Before Filter'), ax_2.set_xticks([]), ax_2.set_yticks([])ax_3 = fig.add_subplot(2, 2, 3)
ax_3.imshow(spectrum_filter_log, 'gray'), ax_3.set_title('Spectrum After Filter'), ax_3.set_xticks([]), ax_3.set_yticks([])ax_4 = fig.add_subplot(2, 2, 4)
ax_4.imshow(img_new, 'gray'), ax_4.set_title('Denoising'), ax_4.set_xticks([]), ax_4.set_yticks([])plt.tight_layout()
plt.show()

在這里插入圖片描述

使用陷波濾波去除周期干擾

def narrow_notch_filter(img, w=5, opening=10, vertical=True, horizontal=False):"""create narrow notch resistant filter, using opencvparam: img:        input, source imageparam: w:          input, int, width of the resistant, value is 0, default is 5param: opening:    input, int, opening of the resistant, value is 1, default is 10param: vertical:   input, boolean, whether vertical or not, default is "True"param: horizontal: input, boolean, whether horizontal or not, default is "False"return a [0, 1] value butterworth band resistant filter"""      dst = np.ones(img.shape, dtype=np.uint8) * 255c_height, c_width = img.shape[0] // 2, img.shape[1] // 2if vertical:cv2.rectangle(dst, ((img.shape[1] - w)//2, 0), (c_width + w//2, img.shape[0]), (0), -1)cv2.rectangle(dst, (0, (img.shape[0] - opening)//2), (img.shape[1], c_height + opening//2), (255), -1)horizontal_ = np.ones(img.shape, dtype=np.uint8) * 255if horizontal:        cv2.rectangle(horizontal_, (0, (img.shape[0] - w)//2), (img.shape[1], c_height + w//2), (0), -1)cv2.rectangle(horizontal_, ((img.shape[1] - opening)//2, 0), (c_width + opening//2, img.shape[0]), (255), -1)dst = dst * horizontal_dst = dst / dst.max()return dst
def narrow_notch_filter(img, w=5, opening=10, vertical=True, horizontal=False):"""create narrow notch resistant filterparam: img:        input, source imageparam: w:          input, int, width of the resistant, value is 0, default is 5param: opening:    input, int, opening of the resistant, value is 1, default is 10param: vertical:   input, boolean, whether vertical or not, default is "True"param: horizontal: input, boolean, whether horizontal or not, default is "False"return a [0, 1] value butterworth band resistant filter"""       assert w > 0, "W must greater than 0"w_half = w//2opening_half = opening//2img_temp = np.ones(img.shape[:2])N, M = img_temp.shape[:]img_vertical = img_temp.copy()img_horizontal = img_temp.copy()if horizontal:img_horizontal[M//2 - w_half:M//2 + w - w_half, :] = 0img_horizontal[:, N//2 - opening_half:N//2 + opening - opening_half] = 1if vertical:img_vertical[:, N//2 - w_half:N//2 + w - w_half] = 0img_vertical[M//2 - opening_half:M//2 + opening - opening_half, :] = 1img_dst = img_horizontal * img_verticalreturn img_dst
# NNF narrow_notch_filter
img_temp = np.zeros([512, 512])
NNF = narrow_notch_filter(img_temp, 5, 20, vertical=True, horizontal=False)
plt.figure(figsize=(10, 8))
plt.imshow(NNF,'gray'),plt.title('NNF')
plt.show()

在這里插入圖片描述

# 使用陷波濾波去除周期干擾
img_ori = cv2.imread("DIP_Figures/DIP3E_Original_Images_CH04/Fig0465(a)(cassini).tif", 0)M, N = img_ori.shape[:2]# 填充為'constant'可得到跟書上一樣的頻譜,這里使用'reflect'
fp = pad_image(img_ori, mode='constant')
# 中心化
fp_cen = centralized_2d(fp)
# 正變換
fft = np.fft.fft2(fp_cen)# 頻譜
spectrum = spectrum_fft(fft)
# 對頻譜做對數變換
spectrum_log = np.log(1 + spectrum)# 巴特沃斯陷波帶阻濾波器
NRF = narrow_notch_filter(fp, w=8, opening=20, vertical=True, horizontal=False)fft_filter = fft * NRF# 濾波后的頻譜
spectrum_filter = spectrum_fft(fft_filter)
spectrum_filter_log = np.log(1 + spectrum_filter)# 傅里葉反變換
ifft = np.fft.ifft2(fft_filter)# 去中心化反變換的圖像,并取左上角的圖像
img_new = centralized_2d(ifft.real)[:M, :N]
img_new = np.uint8(normalize(img_new) * 255)fig = plt.figure(figsize=(10, 10))ax_1 = fig.add_subplot(2, 2, 1)
ax_1.imshow(img_ori, 'gray'), ax_1.set_title('Original'), ax_1.set_xticks([]), ax_1.set_yticks([])ax_2 = fig.add_subplot(2, 2, 2)
ax_2.imshow(spectrum_log, 'gray'), ax_2.set_title('Spectrum Before Filter'), ax_2.set_xticks([]), ax_2.set_yticks([])ax_3 = fig.add_subplot(2, 2, 3)
ax_3.imshow(spectrum_filter_log, 'gray'), ax_3.set_title('Spectrum After Filter'), ax_3.set_xticks([]), ax_3.set_yticks([])ax_4 = fig.add_subplot(2, 2, 4)
ax_4.imshow(img_new, 'gray'), ax_4.set_title('Denoising'), ax_4.set_xticks([]), ax_4.set_yticks([])plt.tight_layout()
plt.show()

在這里插入圖片描述

# 周期干擾的空間模式
img_ori = cv2.imread("DIP_Figures/DIP3E_Original_Images_CH04/Fig0465(a)(cassini).tif", 0)
M, N = img_ori.shape[:2]# 填充為'constant'可得到跟書上一樣的頻譜,這里使用'reflect'
fp = pad_image(img_ori, mode='constant')
# 中心化
fp_cen = centralized_2d(fp)
# 正變換
fft = np.fft.fft2(fp_cen)# # 頻譜
# spectrum = spectrum_fft(fft)
# # 對頻譜做對數變換
# spectrum_log = np.log(1 + spectrum)# 巴特沃斯陷波帶阻濾波器
NRF = narrow_notch_filter(fp, w=8, opening=20, vertical=True, horizontal=False)
NRF = 1 - NRF
fft_filter = fft * NRF# 濾波后的頻譜
spectrum_filter = spectrum_fft(fft_filter)
spectrum_filter_log = np.log(1 + spectrum_filter)# 傅里葉反變換
ifft = np.fft.ifft2(fft_filter)# 去中心化反變換的圖像,并取左上角的圖像
img_new = centralized_2d(ifft.real)[:M, :N]
img_new = np.uint8(normalize(img_new) * 255)fig = plt.figure(figsize=(10, 10))# ax_1 = fig.add_subplot(2, 2, 1)
# ax_1.imshow(img_ori, 'gray'), ax_1.set_title('Original'), ax_1.set_xticks([]), ax_1.set_yticks([])# ax_2 = fig.add_subplot(2, 2, 2)
# ax_2.imshow(spectrum_log, 'gray'), ax_2.set_title('Spectrum Before Filter'), ax_2.set_xticks([]), ax_2.set_yticks([])ax_3 = fig.add_subplot(2, 2, 3)
ax_3.imshow(NRF, 'gray'), ax_3.set_title('Spectrum After Filter'), ax_3.set_xticks([]), ax_3.set_yticks([])ax_4 = fig.add_subplot(2, 2, 4)
ax_4.imshow(img_new, 'gray'), ax_4.set_title('Noise'), ax_4.set_xticks([]), ax_4.set_yticks([])plt.tight_layout()
plt.show()

在這里插入圖片描述

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/260684.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/260684.shtml
英文地址,請注明出處:http://en.pswp.cn/news/260684.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

command line

對chrome 的IPC 感興趣&#xff0c;想通過他的單元測試來窺探。 無意中看到有一個command_line 類&#xff0c;因為是第二次碰到 &#xff2f;&#xff33;&#xff27;中也有一個&#xff43;&#xff4f;&#xff4d;&#xff4d;&#xff41;&#xff4e;&#xff44;類正好…

[物理學與PDEs]第1章第4節 電磁能量和電磁動量, 能量、動量守恒與轉化定律 4.3 電磁能量 (動量) 密度, 電磁能量流 (動量流) 密度...

1. 電磁能量密度: $\cfrac{1}{2}\sex{\ve_0E^2\cfrac{1}{\mu_0}B^2}$. 2. 電磁能量流密度向量: ${\bf S}\cfrac{1}{\mu_0}{\bf E}\times {\bf B}$. 3. 電磁動量密度向量: $\cfrac{1}{c^2}{\bf S}$. 4. 電磁動量流密度張量: $\cfrac{1}{2}\sex{\ve_0E^2\cfrac{1}{\mu_0}B^2}{\bf…

python打包工具報錯_python打包生成exe報錯

如圖所示 如果出現的是這個問題可以可以考慮以下方法 首先卸載原先下載的 Pyinstaller pip uninstall pyinstaller 再執行以下代碼&#xff0c;去github上下載 pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip 注釋&#xff1a;再次打包&#xff…

創建DLL、Lib以及使用DLL、Lib

1.要在生成DLL文件的同時生成Lib文件&#xff0c;函數聲明時前面要加__declspec(dllexport)。 可在頭文件中如下定義&#xff1a; #ifndef __MYDLL_H #define __MYDLL_H#ifdef MYDLL_EXPORTS #define MYDLL __declspec(dllexport) #else #define MYDLL __declspec(dllimport) #…

去除lcd圖片的摩爾紋_寶媽時尚產后有妊娠紋怎么辦?教你這三招,輕松修復肚皮!...

產后肚子上長妊娠紋&#xff0c;相信是很多媽媽的痛點。首先我們來介紹一下什么是妊娠紋。由于妊娠期荷爾蒙的影響&#xff0c;加之腹部膨隆使皮膚的彈力纖維與膠原纖維損傷或斷裂&#xff0c;腹部皮膚變薄變細&#xff0c;出現一些寬窄不同、長短不一的粉紅色或紫紅色的波浪狀…

anaconda 換清華鏡像源 windows

方法1 Windows 下安裝好Anaconda 應該會有如下這些應用&#xff0c;我們打開如下圖anaconda Prompt(下面簡稱prompt)&#xff0c;(當然CMD也可以&#xff0c;只是我比較喜歡用prompt) 打開如下圖 使用下面命令&#xff0c;即可以添加清華鏡像 conda config --add channels …

php冒泡排序和快速排序筆記

<?php $arr array(12,1,5,88,35,0,18,100,50,21,28,7,9,9.5);//交換兩值 function swap(&$m, &$n){$temp $m;$m $n;$n $temp;/* 如數組中有小數時&#xff0c;以下方法會省略小數點后面的數$m $m ^ $n;$n $m ^ $n;$m $m ^ $n;*/ }//冒泡排序 function bubbl…

提高表格可讀性的一些技巧

表格的應用由于工作原因&#xff0c;經常接觸到表格。我們發現&#xff0c;表格不但廣泛的運用在各類數據收集和分析&#xff0c;同時通過表格這樣一種二維矩陣來整理和陳列信息時&#xff08;即便最后的展示方式并非一個典型的表格樣式&#xff09;&#xff0c;能夠很好的表達…

分頁第一頁用0還是1_如何設計api分頁

常規的分頁方式API處理分頁看似簡單&#xff0c;實際上暗藏危機。最常見的分頁方式&#xff0c;大概是下面這樣的/users/?page1&limit5//服務端返回最理想的情況下&#xff0c;客戶端請求第一頁的5條數據&#xff0c;服務端如常返回&#xff0c;比如下圖:拿Twitter的圖用一…

數據挖掘腫瘤預測_科研套路不嫌多,數據挖掘發3分

解螺旋公眾號陪伴你科研的第2003天如何復現一篇3分生信研究做科研需要先學習套路&#xff0c;才能超越套路。今天給大家介紹的套路文獻是今年發表在《Oncology reports》(IF 3.041)上的一篇文章。文章的標題雖然看上去比較泛&#xff0c;但也讓讀者一眼就能知道主題了&#xff…

Jupyter notebook 導出PDF的3種方法

很多用Jupyter notebook的都想導出PDF&#xff0c;但是我們點擊Download as PDF via LaTex. 然后呢&#xff1f; Ohzzzzzzzzz 出現下圖的錯誤&#xff0c;看到這里感覺糟糕透啦。雖然可以根據提供的方法解決這個問題。下面我說說我的方法吧。 方法1 打開jupyter notebook&a…

mybatis中的#{value}和${value}的區別

2019獨角獸企業重金招聘Python工程師標準>>> 1. #{value}將傳入的數據都當成一個字符串&#xff0c;會對自動傳入的數據加一個雙引號。 2. ${value}將傳入的數據直接顯示生成在sql中。 3. #{value}方式能夠很大程度防止sql注入。  4.${value}方式無法防止Sql注入。…

數據庫備份失敗問題

備份對于服務器“服務器名”失敗。&#xff08;Microsoft.SqlServer.Smo&#xff09; 其他信息&#xff1a;System.Data.SqlClient.SqlError:無法打開備份設備c:\abc.bak。出現操作系統錯誤5(拒絕訪問。)。(Microsoft.SqlServer.Smo&#xff09; 解決辦法&#xff1a; Sql Serv…

重寫setTimeout擴展參數

1 //判斷函數行參長度來決定是否需要重寫setTimeout&#xff0c;ie8以下為undefined2 if(window.setTimeout.length undefined){3 var __sto window.setTimeout;4 window.setTimeout function(callback,timeout,param){5 var args Array.prototype.slice.c…

針對access數據庫的增刪改查

1、執行查詢操作&#xff1a;&#xff08;ExecuteReader方法&#xff09; string myConnectionString "Provider Microsoft.Jet.OLEDB.4.0;Data Source "Server.MapPath("~/") "App_Data/access.mdb"; //使用相對路徑連接數據庫 string mySel…

pandas 在jupyter notebook時候能用,但在vscode, pycharm不能用

先看錯誤。 AttributeError: partially initialized module ‘pandas’ has no attribute ‘Series’ (most likely due to a circular import) 分一下這種錯誤 ‘…’ has no attribute ‘…’ 庫沒有 ’…’ 這種問題&#xff0c;要么庫沒有裝好&#xff0c;或者裝的庫的…

解決 IDEA 調用其他類的時候自動加上包路徑和類名的情況_idea 快捷鍵匯總(轉)...

1.IDEA常用快捷鍵Alt回車 導入包,自動修正CtrlN 查找類CtrlShiftN 查找文件CtrlAltL 格式化代碼CtrlAltO 優化導入的類和包AltInsert 生成代碼(如get,set方法,構造函數等)CtrlE或者AltShiftC 最近更改的代碼CtrlR 替換文本CtrlF 查找文本CtrlShiftSpace 自動補全代碼Ctrl空格 代…

8位可控加減法器_自主可控:QTouch在軍工道系統上的應用

自主可控&#xff1a;QTouch在軍工道系統上的應用一、系統介紹"道系統"操作系統是一款面向各領域的嵌入式實時操作系統&#xff0c;支持單核及多核CPU硬件配置&#xff0c;可替換相關領域的VxWorks 6.8/6.9操作系統二、產品特性 具備自主知識產權的嵌入式實時操作系統…

截獲所有以太網幀數據并進行具體分析

/* capture_packet.c - 截獲所有以太網幀數據并進行具體分析 *//* 常用函數的頭文件 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <unistd.h> #include <signal.h>/* 與網絡相關…

Spark啟動程序:Master

臨時筆記def main(argStrings: Array[String]) {//讀取以spark.開頭的配置屬性val conf new SparkConf//檢查環境變量&#xff1a;SPARK_MASTER_HOST、SPARK_MASTER_PORT、SPARK_MASTER_WEBUI_PORT //再檢查配置屬性&#xff1a;master.ui.port //檢查其他master配置&am…