faster convol on local subsets? [message #78633] |
Sun, 04 December 2011 16:37 |
Andre
Messages: 4 Registered: June 2011
|
Junior Member |
|
|
Hello experts,
Maybe somebody has an easy solution for this?
I have a 2D array (img) and want the filter response from kernels that vary according to the image position. In a second array (loc, same dimensions as img) I have the information which kernel should be used at each pixel. My current approach is to first convolve the full image with the j-th kernel and take the response only at the positions with the current j indexed in the loc array:
for j=0, n do begin
kernel=kernel_store[*,*,j]
response_temp = convol(img, kernel, /edge_zero, /NAN)
index=where(loc eq j)
if (index[0] gt -1)then response[index]=response_temp[index]
endfor
I works fine, but it is relatively slow and I wonder if there is a smarter (faster) to apply only the convolutions that are really needed?
Thanks in advance for any help!
|
|
|