title: making a rotated DoG filter using filter2D
body: <p>I have an assignment for a ComputerVision course I'm having trouble with. I need to filter out the yellow lines of the image below using a rotated DoG filter.</p>
  
  <p><a href="https://i.stack.imgur.com/YPVLd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YPVLd.png" alt="Image we will be working with"></a></p>
  
  <p>As a first step I want to make a custom 2D gaussian kernel(with 2 different sigma's, because they ask for it in the assignment, I don't understand the reason for it yet). Basicly I think the amount of blur in some directions will be different.</p>
  
  <pre><code>Gkernel = cv2.getGaussianKernel(5, 0.5)
  Gkernel2 = cv2.getGaussianKernel(5, 0.35)
  TGkernel2 = cv2.transpose(Gkernel2)
  twoDG = Gkernel * TGkernel2
  </code></pre>
  
  <p>Now I use a sobel filter to create a differential of Gaussian (DoG) filter;</p>
  
  <pre><code>DoG = cv2.Sobel(twoDG, cv2.CV_64F, 0, 1, ksize = 5) #derive in the y direction(first order)
  </code></pre>
  
  <p>Now I create a rotation matrix so that the yellow lines would be vertical in the image;</p>
  
  <pre><code>rot = cv2.getRotationMatrix2D((2,2), 15, 0.8)
  rotDoG = cv2.warpAffine(DoG, rot, (DoG.shape[1], DoG.shape[0]))
  img = cv2.imread('./images/'+sys.argv[1])#I pass the name of the file as a CLI argument
  gray = cv2.cvtColor( img, cv2.COLOR_BGR2GRAY )
  filtered = cv2.filter2D(gray, cv2.CV_64F, rotDoG)
  </code></pre>
  
  <p>If I had to tackle this problem without directives from the teacher, I would first rotate the image so that the yellow lines are in a vertical position, then apply a DoG filter. From wikipedia a DoG is a band-pass filter that discards all but a handful of spatial frequencies that are present in the original grayscale image. So I would only want to keep the now vertical yellow lines.</p>
  
  <p>What are the things I'm doing wrong and why, how would you tackle this problem? Any help is appreciated for a novice CV enthusiast.</p>