0

I have the following HW assignment: Go to the "saw" image. Do edge detection. Now, by convolution, replace each edge point by a small circle or with a small Gaussian.

Which filter can I use to perform this operation?

Thank you!

saw_image = imread('saw.jpg');
I  = rgb2gray(saw_image);
BW = edge(I,'canny');
[row, col] = find (BW);
a = sub2ind(size(I), row, col)';
WindowSize = 9;
newI=imfilter(I(a),fspecial('???',WindowSize));
Digital Da
  • 891
  • 1
  • 10
  • 23
  • You can use a gaussian filter; check [here](http://www.mathworks.com/help/images/ref/fspecial.html?searchHighlight=fspecial) for a list of pre-defined filters available with `fspecial` – Benoit_11 May 11 '15 at 11:10
  • When I use a gaussian filter my image becomes one straight horizontal line.. – Digital Da May 11 '15 at 11:29
  • How about using dilation with a circular structur element?http://de.mathworks.com/help/images/ref/imdilate.html – David_D May 13 '15 at 11:21

1 Answers1

0

Not exactly sure what is required. I assume you should do something like:

saw_image = randi(255,30,30,3);
I  = rgb2gray(saw_image);
BW = edge(I,'canny');
WindowSize = 3;
newI=imfilter(BW*255,fspecial('gaussian',WindowSize));

result = saw_image;
result(newI>0) = newI(newI>0);

This creates an edge image, convolutes this image and replaces all areas int he original image which are detected as edges with the edge values.

Steffen
  • 2,381
  • 4
  • 20
  • 33
  • Thank you for your answer, but this isn't what is required. Saw is an actual saw, and the aim of this section, as far as I understand it, is to replace the "teeth" of the saw with circles. – Digital Da May 11 '15 at 12:41
  • Hm, the text "replace each edge point by a small circle" sounds otherwise. To detect the teeth, you could look for corner detection. – Steffen May 11 '15 at 13:16