title: Matlab Image Processing Sliding Window SVM
body: <p>I am trying to create a object detection SVM that can detect remote control calls rolling slowly on the floor. i am using HOG cpp script in matlab (via mex) and the SVM-Light library (<a href="http://svmlight.joachims.org/" rel="nofollow">http://svmlight.joachims.org/</a>)</p>
  
  <p>i was wondering how i could go about detecting the cars if they are closer to the camera (i know that i need to have different sized windows im just not sure how to implement it) and how to tell SVM not to detect anything if it cannot see a car.There will only be one car in the frame at all times. I am using a Matlab 2012a. I was also wondering on how to speed up the Sliding window algorithm and also was wondering if the size of the training images will affect the results dramatically. </p>
  
  <p>here is my sliding window code</p>
  
  <pre><code>[bottomRightCol bottomRightRow d] = size(im);
  
  fcount = 1;
  
  for y = 1:bottomRightCol-wSize(2)    
      for x = 1:bottomRightRow-wSize(1)
          img = imcut([[x,y]; [x+(wSize(1)-1), y+(wSize(2)-1)]],im);      
          featureVector{fcount} = HOG(double(img));
          boxPoint{fcount} = [x,y];
          fcount = fcount+1;
          x = x+1;
      end
  end
  
  lebel = ones(length(featureVector),1);
  P = cell2mat(featureVector);
  [~, predictions] = svmclassify(P',lebel,model);
  [a, indx]= max(predictions);
  bBox = cell2mat(boxPoint(indx));
  rectangle('Position',[bBox(1),bBox(2),wSize(1),wSize(2)],'LineWidth',3, 'EdgeColor','r');
  </code></pre>
  
  <p>sorry about all the questions but any help or advice would be greatly appreciated</p>
  
  <p>Cheers :D</p>