Performing sliding window for feature extraction on a test image is very slow. What is the reason
1 view (last 30 days)
I am new to Matlab. Please help me to clear the issue. I need to perform feature extraction on a test image by sliding the window on image of size 512x512. The window size is 70x30. First I am cropping the image and extracting the feature, the storing in a CSV file for further manipulation. Performing the said operation is very slow. Matlab shows the status as busy for long time. I could not understand why the process is very slow. How to make it fast. the code is:
crop_image = imcrop(img,[i,j,30-1,70-1]);
toCsv(k,:) = HOG(crop_image);
Walter Roberson on 2 Mar 2016
imcrop is going to be less efficient than just indexing the image.
crop_image = img(j:j+70-1, i:i+30-1, :)
Could you confirm that you want to move the window by only 1 row (or column) at a time, not by full blocks? I suspect you end up re-calculating a fair bit, but I am not sure how HOG is calculated.
Is there a reason you are not using http://www.mathworks.com/help/vision/ref/extracthogfeatures.html ?