python - Optimizing distance calculation between rows and matrices with numpy -
i have image processing problem trying create known histogram of activated patches
.
i have codebook (a numpy array, 200x36) , image (another numpy array, 128x128). each pixel, have see codebook vector nearest
.
the distance between codebook vector , pixel defined euclidean distance between vector , 6x6 patch left cornered @ pixel, reshaped form 1x36 vector.
for each pixel, extracting patch , computing nearest codebook vector using code d,i=spatial.kdtree(cdata).query(patch.reshape((1,6*6)))
. o(n) number of pixels. there way improve running time? reasonable approximation fine.
Comments
Post a Comment