Edge detection with edge function in matlab

1 view (last 30 days)
Putra A
Putra A on 22 Apr 2013
Answered: Sarvesh Kale on 31 Jan 2023
Dear Forum Member,
I have a problem on detecting edge using edge function in matlab, i know that i can detect edge using canny method, the step is : # Image Smhoothing # Edge strength detection -> here we can use different operator, sobel,prewitt etc # Non maxima suppression to do thinning # and finally hysterisis thresholding
when i use edge function in matlab i am aware that there are several choise of operator, but can i define my own custom direction kernel for sobel operator ?
because usually sobel use this direction kernel, i think this is the default in matlab function:
maskX = [-1 0 1 ; -2 0 2; -1 0 1]; maskY = [-1 -2 -1 ; 0 0 0 ; 1 2 1] ;
in my case i want to change the direction kernel to this one :
maskX = [5 5 5 ; -3 0 -3; -3 -3 -3]; maskY = [5 5 5 ; -3 0 -3 ; -3 -3 -3] ;

Answers (1)

Sarvesh Kale
Sarvesh Kale on 31 Jan 2023
You cannot use maskX = [5 5 5 ; -3 0 -3; -3 -3 -3]; maskY = [5 5 5 ; -3 0 -3 ; -3 -3 -3] ; as your masks, here are the following reasons
  1. The kernel masks suggested by you do not sum to 0, which means you will end up changing the pixel intensities, the masks [-1 0 1 ; -2 0 2; -1 0 1] and [-1 -2 -1 ; 0 0 0 ; 1 2 1] sum to 0 and are mathematically calculating the 2nd derivative in X and y direction
  2. Edge detection is about finding differences in pixel intensities in X and Y direction and your suggested mask is certainly not doing that
Hope the above explanation helps.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!