Canny edge detection is an image processing technique widely used in computer vision applications for detecting edges in images. It helps in identifying the boundaries between different objects in an image. In this tutorial, we will be building a canny edge detection function from scratch in Matlab and use it to estimate the camera pose.
The are five steps in Canny edge detection process:
The first step in Canny edge detection is to apply Gaussian filter to the image to remove noise. This can be done using the imgaussfilt
function in Matlab:
main.m175 chars6 lines
The second step is to calculate the gradient of the blurred image using Sobel operators. This can be done using the imgradient
function in Matlab:
main.m170 chars6 lines
The third step is to perform non-maximum suppression to thin out the edges. This can be done as follows:
main.m1057 chars30 lines
The fourth step is to perform double thresholding to determine potential edges. This can be done as follows:
main.m600 chars20 lines
The fifth and final step is to track the edges by hysteresis. This can be done as follows:
main.m318 chars13 lines
The canny edge detection function can be used in camera pose estimation by first detecting the edges in the reference image and the new image, and then matching the two images using some feature detection and matching algorithm such as SIFT or SURF. Once the corresponding points are extracted, the camera pose can be estimated using linear homography estimation or PnP algorithm.
main.m1018 chars24 lines
This is how we can use the canny edge detection function to estimate the camera pose in Matlab.
gistlibby LogSnag