OpenCV Questions and Answers – Canny Edge Detection

This set of OpenCV Multiple Choice Questions & Answers (MCQs) focuses on “Canny Edge Detection”.

1. Who developed the canny Edge Detection Algorithm?
a) John F. Canny
b) Petr Canny
c) Canny Peter Dylan
d) Canner Roods

Explanation: Canny Edge Detection Algorithm was developed by Australian Computer scientist, John F. Canny in year 1986. Canny edge detection is a algorithm to extract useful structural information from different vision objects and dramatically reducing the amount of data to be processed.

2. Which of the following is the first step in Canny Edge Detection Algorithm?
a) Noise Reduction
b) Finding Intensity Gradient of the Image
c) Non-maximum Suppression
d) Hysteresis Thresholding

Explanation: There are 4-5 steps in applying the Canny Edge Detection algorithm. The first step is Noise Reduction. Since edge detection is susceptible to noise in the image, first step is to remove the noise in the image with a 5×5 Gaussian filter.

3. Which of the following is the second step in Canny Edge Detection Algorithm?
a) Noise Reduction
b) Finding Intensity Gradient of the Image
c) Non-maximum Suppression
d) Hysteresis Thresholding

Explanation: There are 4-5 steps in applying the Canny Edge Detection algorithm. The first step is Noise Reduction. The second step in Canny Edge Detection Algorithm is Finding Intensity Gradient of the Image. Smoothened image is then filtered with a Sobel kernel in both horizontal and vertical direction to get first derivative in horizontal direction (Gx) and vertical direction (Gy).

4. spatialGradient() function calculates the first order image derivative in both x and y using a Sobel operator.
a) True
b) False

Explanation: spatialGradient() function or method calculates the first order image derivative in both x and y using a Sobel operator. spatialGradient() function is declared as dx, dy= cv.spatialGradient( src[, dx[, dy[, ksize[, borderType]]]]).

5. Which of the following is the third step in Canny Edge Detection Algorithm?
a) Noise Reduction
b) Finding Intensity Gradient of the Image
c) Non-maximum Suppression
d) Hysteresis Thresholding

Explanation There are 4-5 steps in applying the Canny Edge Detection algorithm. The first step is Noise Reduction. The second step in Canny Edge Detection Algorithm is Finding Intensity Gradient of the Image. The third step is Non-maximum Suppression. After getting gradient magnitude and direction, a full scan of image is done to remove any unwanted pixels which may not constitute the edge. For this, at every pixel, pixel is checked if it is a local maximum in its neighborhood in the direction of gradient.

6. Which of the following operator is known as direction mask?
a) Prewitt Operator
b) Sobel Operator

Explanation: Robinson Compass Masks is also known as direction mask. In this operator we take one mask and rotate it in all the 8 (Eight) compass major directions to calculate edges of each direction.

7. What is the formula to calculate the angle in the Gradient calculation of canny Edge detector?
a) θ (x, y) = arctan(Iy – Ix)
b) θ (x, y) = arctan(Iy* Ix)
c) θ (x, y) = arctan(Iy / Ix)
d) θ (x, y) = arctan(Iy + Ix)

Explanation: The formula to calculate and find the direction or angle in the Gradient calculation of canny Edge detector is θ (x, y) = arctan(Iy/Ix), where, Iy is first derivative in horizontal direction and Ix is first derivative in vertical direction.

8. Which type of edge does sobel operator detect?
a) Vertical edges and Diagonal edges
b) Vertical edges and Horizontal edges
c) Diagonal Edges
d) Diagonal Edges and Horizontal edges

Explanation: Like Prewitt operator sobel operator is also used to detect two kinds of edges in an image: Vertical direction and Horizontal direction. In sobel operator the coefficients of masks are not fixed and they can be adjusted according to our requirement unless they do not violate any property of derivative masks.

9. sobel() function Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
a) True
b) False

Explanation: sobel() function Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. In all cases except one, the ksize×ksize separable kernel is used to calculate the derivative. When ksize = 1, the 3×1 or 1×3 kernel is used (that is, no Gaussian smoothing is done). ksize = 1 can only be used for the first or the second x- or y- derivatives.

10. Which of the following operator is TRUE about direction of gradient in canny edge detector algorithm?
a) Gradient direction is never perpendicular to edges
b) Gradient direction is always parallel to edges
c) Gradient direction is always perpendicular to edges
d) Gradient direction is always anti-parallel to edges

Explanation: Gradient direction is always perpendicular to edges. It is rounded to one of four angles representing vertical, horizontal and two diagonal directions. The direction is calculated by this formula θ (x, y) = arctan(Iy/Ix).

Sanfoundry Global Education & Learning Series – OpenCV.

To practice all areas of OpenCV, here is complete set of Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]