2023年11月28日開發手記

2021-10-01 05:20:44 字數 1536 閱讀 8115

為了方便後面目標識別的處理,將投影求分類的函式嵌入進fft濾波函式中,共同組成fttmovedetect函式,利用python的切片功能實現投影

**:

arryallw[:] = arryallw[:] +arryh[:]

arryallh[:] = arryallh[:] + arryl[:]

為在投影中分割多目標區域,引入兩個變數:yindexh 與yindexl,用於記錄分界點的個數,其中分界點由python中的卷積函式求出:

arryallhh[0, :] = np.convolve(arryallhh[0, :], conmask, mode='

same

') #

numpy函式中的卷積函式庫

arryallhl[0, :] = np.convolve(arryallhl[0, :], conmask, mode='

same

') #

numpy函式中的卷積函式庫

又引入兩個陣列:yarryh[:]與yarryl[:] 用於記錄分界點的位置,分界點位置的判斷由以下語句實現:

for a in range(1, int(high / steppingh), 1):

if arryallhh[0, a] > 0 and arryallhh[0, (a - 1)] <=0:

yarryh[0, yindexh] =a

yindexh = yindexh + 1

if arryallhh[0, a] <= 0 and arryallhh[0, (a - 1)] >0:

yarryh[0, yindexh] = a - 1yindexh = yindexh + 1

if arryallhl[0, a] > 0 and arryallhl[0, (a - 1)] <=0:

yarryl[0, yindexl] =a

yindexl = yindexl + 1

if arryallhl[0, a] <= 0 and arryallhl[0, (a - 1)] >0:

yarryl[0, yindexl] = a - 1yindexl = yindexl + 1

接下來根據得到的分界點的數量與位置對運**像進行分割:
for b in range(0, yindexl, 2):

frameshow = cv2.rectangle(frameshow, (xarryl[0,i]*steppingw, yarryl[0,b]*steppingh) , (xarryl[0, i+1]*steppingw, yarryl[0,b+1]*steppingh), (200, 10, 140), 6)

多目標檢測完成,效果如圖:

2023年11月20日開發手記

兩種運動檢測演算法的介紹 幀差法 二維頻域運動目標檢測 通過對動態影象的行列分解,將三維頻域內的運動檢測問題轉化到兩組二維頻域內進行,從而降低了濾波器設計的難度。給出了一種提取主運動能量的自適應濾波演算法,通過剔除背景和雜訊的頻率成分,有效地檢測出運動目標。複雜度分析 針對幀差法進行分析,複雜度主要...

2023年11月21日開發手記

更改了幾處bug 1 將棧由全域性變數變為區域性變數,修正了起始點不變的問題。2 將低通濾波器改為高通濾波器,修正了壓入棧的資料過多問題。f np.fft.fft2 new gray array rows,cols f.shape f 0 fftadd 0 f rows fftadd rows 0 ...

2023年11月20日開發手記

兩種運動檢測演算法的介紹 幀差法 二維頻域運動目標檢測 通過對動態影象的行列分解,將三維頻域內的運動檢測問題轉化到兩組二維頻域內進行,從而降低了濾波器設計的難度。給出了一種提取主運動能量的自適應濾波演算法,通過剔除背景和雜訊的頻率成分,有效地檢測出運動目標。複雜度分析 針對幀差法進行分析,複雜度主要...