i = 2
feature_vector_set = []
while i < 2405 - 2:
j = 2
while j < 1200 - 2:
block = diff_image[i-2:i+3, j-2:j+3]
feature = block.flatten()
feature_vector_set.append(feature)
j = j+1
i = i+1
diff_image is int16 with shape(2405,1200) the whole loop takes 40mins to run and mainly caused by the following line:
feature_vector_set.append(feature)
Is there any alternative way to achieve the same result?