I have an image:
I want to divide this image into 3 equal parts and calculate the SIFT for each part individually and then concatenate the results.
I found out that Matlab's blockproc
does just that, but I do not know how to get it to work with my function. Here is what I have:
[r c] = size(image);
c_new = floor(c/3); %round it
B = blockproc(image, [r c_new], @block_fun)
So according to Matlabs documentation the function, block_fun will be applied to the original image in blocks of size r
and c_new
.
this is what I wrote as block_fun
function feats = block_fun(img)
[keypoints, descriptors] = vl_sift(single(img));
feats = descriptors;
end
So, my matrix B
should be a concatenation of the SIFT descriptors of all three parts of the same image? right?
But the error that I get when I run the command:
B = blockproc(image, [r c_new], @block_fun)
Function BLOCKPROC encountered an error while evaluating the user supplied function handle, FUN.
The cause of the error was:
Error using single Conversion to single from struct is not possible.