質問編集履歴

3

1

2021/11/23 13:11

投稿

gknjnjtnj
gknjnjtnj

スコア7

test CHANGED
File without changes
test CHANGED
@@ -106,7 +106,7 @@
106
106
 
107
107
  if (fgmask[i*16+y][j*16+x]==255):#1画素ずつ白かどうかの判定
108
108
 
109
- fgmask_sum[y,x] += 1
109
+ fgmask_sum[i,j] += 1
110
110
 
111
111
  fgmask_mean = np.mean(fgmask_sum)#全領域の白の要素の平均
112
112
 

2

1

2021/11/23 13:11

投稿

gknjnjtnj
gknjnjtnj

スコア7

test CHANGED
File without changes
test CHANGED
@@ -94,7 +94,7 @@
94
94
 
95
95
  fgmask = fgbg.apply(frame)
96
96
 
97
- fgmask_sum = np.zeros((30,40))
97
+ fgmask_sum = np.zeros((30,40))#16*16 ごとに領域分けした時の領域の数
98
98
 
99
99
  for i in range(int(rows/REGION_HIGH)):#30
100
100
 
@@ -104,11 +104,11 @@
104
104
 
105
105
  for x in range(REGION_WIDTH):#16
106
106
 
107
- if (fgmask[i*16+y][j*16+x]==255):
107
+ if (fgmask[i*16+y][j*16+x]==255):#1画素ずつ白かどうかの判定
108
108
 
109
109
  fgmask_sum[y,x] += 1
110
110
 
111
- fgmask_mean = np.mean(fgmask_sum)
111
+ fgmask_mean = np.mean(fgmask_sum)#全領域の白の要素の平均
112
112
 
113
113
  for y in range(int(rows/REGION_HIGH)):#30
114
114
 

1

エラー発生箇所の明示

2021/11/23 13:02

投稿

gknjnjtnj
gknjnjtnj

スコア7

test CHANGED
File without changes
test CHANGED
@@ -110,11 +110,11 @@
110
110
 
111
111
  fgmask_mean = np.mean(fgmask_sum)
112
112
 
113
- for y in range(int(rows/REGION_HIGH)):
113
+ for y in range(int(rows/REGION_HIGH)):#30
114
114
 
115
- for x in range(int(cols/REGION_WIDTH)):
115
+ for x in range(int(cols/REGION_WIDTH)):#40
116
116
 
117
- if fgmask_sum[x][y] >= fgmask_mean:
117
+ if fgmask_sum[x][y] >= fgmask_mean:#エラーが発生している行
118
118
 
119
119
  fgmask_mask[16*y:16*y+16,16*x:16*x+16] = np.copy(white_mask)
120
120