However, when we really want to perform edge detection for certain purpose, the problems arise. Look at the following example:
1. Original image
S = imread('p5-in1.jpg');
2. Edge detection using different methods
S2 = RGB2Gray(S);
S3 = edge(S2,'sobel');
3. Edge detection for the white rabbit
Since we know the RGB value for white color is [255,255,255], we can pre-process the image to extract the white color region from the image.
Sw = S(:,:,1)>200 & S(:,:,2)>200 & S(:,:,3)>200;
Sw2 = edge(double(Sw),'prewitt');
Well, it seems like make more sense. Let's have a look on how to perform edge detection on the black rabbit:
4. Edge detection for the black rabbit
Sb = S(:,:,1)<40>
Sb2 = edge(double(Sb),'prewitt');
The post processing can be used to remove unwanted noise.